Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 399
Zeile 13... Zeile 13...
13
     * @param  string  $path
13
     * @param  string  $path
14
     * @return void
14
     * @return void
15
     */
15
     */
16
    public function dump(Connection $connection, $path)
16
    public function dump(Connection $connection, $path)
17
    {
17
    {
18
        $excludedTables = collect($connection->getSchemaBuilder()->getAllTables())
-
 
19
                        ->map->tablename
18
        $commands = collect([
20
                        ->reject(function ($table) {
19
            $this->baseDumpCommand().' --schema-only > '.$path,
21
                            return $table === $this->migrationTable;
20
            $this->baseDumpCommand().' -t '.$this->migrationTable.' --data-only >> '.$path,
22
                        })->map(function ($table) {
-
 
23
                            return '--exclude-table-data="*.'.$table.'"';
-
 
24
                        })->implode(' ');
21
        ]);
25
 
22
 
26
        $this->makeProcess(
23
        $commands->map(function ($command, $path) {
27
            $this->baseDumpCommand().' --file="${:LARAVEL_LOAD_PATH}" '.$excludedTables
-
 
28
        )->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [
24
            $this->makeProcess($command)->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [
29
            'LARAVEL_LOAD_PATH' => $path,
25
                'LARAVEL_LOAD_PATH' => $path,
-
 
26
            ]));
30
        ]));
27
        });
31
    }
28
    }
Zeile 32... Zeile 29...
32
 
29
 
33
    /**
30
    /**
34
     * Load the given schema file into the database.
31
     * Load the given schema file into the database.
Zeile 56... Zeile 53...
56
     *
53
     *
57
     * @return string
54
     * @return string
58
     */
55
     */
59
    protected function baseDumpCommand()
56
    protected function baseDumpCommand()
60
    {
57
    {
61
        return 'pg_dump --no-owner --no-acl -Fc --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"';
58
        return 'pg_dump --no-owner --no-acl --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"';
62
    }
59
    }
Zeile 63... Zeile 60...
63
 
60
 
64
    /**
61
    /**
65
     * Get the base variables for a dump / load command.
62
     * Get the base variables for a dump / load command.