@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | public function ignore(...$tables) |
89 | 89 | { |
90 | - DbExporter::$ignore = array_merge(DbExporter::$ignore, (array) $tables); |
|
90 | + DbExporter::$ignore = array_merge(DbExporter::$ignore, (array)$tables); |
|
91 | 91 | |
92 | 92 | return $this; |
93 | 93 | } |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | protected $description = 'Command to copy the migrations and/or the seeds to a remote host.'; |
14 | 14 | |
15 | 15 | protected $ignoredFiles = [ |
16 | - '..', |
|
17 | - '.', |
|
18 | - '.gitkeep', |
|
19 | - ]; |
|
16 | + '..', |
|
17 | + '.', |
|
18 | + '.gitkeep', |
|
19 | + ]; |
|
20 | 20 | |
21 | 21 | protected $uploadedFiles; |
22 | 22 | |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | { |
53 | 53 | return [ |
54 | 54 | [ |
55 | - 'migrations', |
|
56 | - 'm', |
|
57 | - InputOption::VALUE_NONE, |
|
58 | - 'Upload the migrations to a storage.', |
|
59 | - null, |
|
55 | + 'migrations', |
|
56 | + 'm', |
|
57 | + InputOption::VALUE_NONE, |
|
58 | + 'Upload the migrations to a storage.', |
|
59 | + null, |
|
60 | 60 | ], |
61 | 61 | [ |
62 | - 'seeds', |
|
63 | - 's', |
|
64 | - InputOption::VALUE_NONE, |
|
65 | - 'Upload the seeds to the remote host.', |
|
66 | - null, |
|
62 | + 'seeds', |
|
63 | + 's', |
|
64 | + InputOption::VALUE_NONE, |
|
65 | + 'Upload the seeds to the remote host.', |
|
66 | + null, |
|
67 | 67 | ], |
68 | - ]; |
|
68 | + ]; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | //end getOptions() |
@@ -89,6 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | //end handleOptions() |
91 | 91 | |
92 | + /** |
|
93 | + * @param string $what |
|
94 | + */ |
|
92 | 95 | protected function upload($what) |
93 | 96 | { |
94 | 97 | $localPath = Config::get('db-exporter.export_path.'.$what); |
@@ -122,6 +125,9 @@ discard block |
||
122 | 125 | |
123 | 126 | //end upload() |
124 | 127 | |
128 | + /** |
|
129 | + * @return string|null |
|
130 | + */ |
|
125 | 131 | protected function getDiskName() |
126 | 132 | { |
127 | 133 | // For now static from he config file. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->line("\n"); |
39 | 39 | $this->info(ucfirst($type)); |
40 | 40 | foreach ($files as $file) { |
41 | - $this->sectionMessage($type, $file.' uploaded.'); |
|
41 | + $this->sectionMessage($type, $file . ' uploaded.'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | |
92 | 92 | protected function upload($what) |
93 | 93 | { |
94 | - $localPath = Config::get('db-exporter.export_path.'.$what); |
|
94 | + $localPath = Config::get('db-exporter.export_path.' . $what); |
|
95 | 95 | $dir = scandir($localPath); |
96 | - $remotePath = Config::get('db-exporter.remote.'.$what); |
|
96 | + $remotePath = Config::get('db-exporter.remote.' . $what); |
|
97 | 97 | $this->line("\n"); |
98 | 98 | $this->info(ucfirst($what)); |
99 | 99 | // Prepare the progress bar |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // Capture the uploaded files for displaying later |
108 | - $this->uploadedFiles[$what][] = $remotePath.$file; |
|
108 | + $this->uploadedFiles[$what][] = $remotePath . $file; |
|
109 | 109 | |
110 | 110 | // Copy the files |
111 | 111 | Storage::disk($this->getDiskName())->put( |
112 | - $remotePath.$file, |
|
113 | - $localPath.'/'.$file |
|
112 | + $remotePath . $file, |
|
113 | + $localPath . '/' . $file |
|
114 | 114 | ); |
115 | 115 | $progress->advance(); |
116 | 116 | } |
@@ -42,9 +42,9 @@ |
||
42 | 42 | $formatter = $this->getHelperSet()->get('formatter'); |
43 | 43 | $filename = $this->getFilename(); |
44 | 44 | $errorMessages = [ |
45 | - 'Success!', |
|
46 | - "Database seed class generated in: {$filename}", |
|
47 | - ]; |
|
45 | + 'Success!', |
|
46 | + "Database seed class generated in: {$filename}", |
|
47 | + ]; |
|
48 | 48 | $formattedBlock = $formatter->formatBlock($errorMessages, 'info', true); |
49 | 49 | $this->line($formattedBlock); |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $pdo = DB::connection()->getPdo(); |
55 | 55 | |
56 | - return $pdo->query('SELECT table_name FROM information_schema.tables WHERE table_schema="'.$this->database.'"'); |
|
56 | + return $pdo->query('SELECT table_name FROM information_schema.tables WHERE table_schema="' . $this->database . '"'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | //end getTables() |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $pdo = DB::connection()->getPdo(); |
64 | 64 | |
65 | - return $pdo->query('SHOW INDEX FROM '.$this->database.'.'.$table.' WHERE Key_name != "PRIMARY"'); |
|
65 | + return $pdo->query('SHOW INDEX FROM ' . $this->database . '.' . $table . ' WHERE Key_name != "PRIMARY"'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | //end getTableIndexes() |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function getTableData($table) |
114 | 114 | { |
115 | - return DB::table($this->database.'.'.$table)->get(); |
|
115 | + return DB::table($this->database . '.' . $table)->get(); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | //end getTableData() |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $directories = explode($del, $path); |
130 | 130 | foreach ($directories as $directory) { |
131 | 131 | if (!empty($directory)) { |
132 | - $dir .= $del.$directory; |
|
132 | + $dir .= $del . $directory; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (!is_dir($dir)) { |
@@ -27,27 +27,27 @@ |
||
27 | 27 | * @var array |
28 | 28 | **/ |
29 | 29 | protected $selects = [ |
30 | - 'column_name as Field', |
|
31 | - 'column_type as Type', |
|
32 | - 'is_nullable as Null', |
|
33 | - 'column_key as Key', |
|
34 | - 'column_default as Default', |
|
35 | - 'extra as Extra', |
|
36 | - 'data_type as Data_Type', |
|
37 | - ]; |
|
30 | + 'column_name as Field', |
|
31 | + 'column_type as Type', |
|
32 | + 'is_nullable as Null', |
|
33 | + 'column_key as Key', |
|
34 | + 'column_default as Default', |
|
35 | + 'extra as Extra', |
|
36 | + 'data_type as Data_Type', |
|
37 | + ]; |
|
38 | 38 | /** |
39 | 39 | * Select fields from constraints. |
40 | 40 | * |
41 | 41 | * @var array |
42 | 42 | **/ |
43 | 43 | protected $constraints = [ |
44 | - 'key_column_usage.table_name as Table', |
|
45 | - 'key_column_usage.column_name as Field', |
|
46 | - 'key_column_usage.referenced_table_name as ON', |
|
47 | - 'key_column_usage.referenced_column_name as References', |
|
48 | - 'REFERENTIAL_CONSTRAINTS.UPDATE_RULE as onUpdate', |
|
49 | - 'REFERENTIAL_CONSTRAINTS.DELETE_RULE as onDelete', |
|
50 | - ]; |
|
44 | + 'key_column_usage.table_name as Table', |
|
45 | + 'key_column_usage.column_name as Field', |
|
46 | + 'key_column_usage.referenced_table_name as ON', |
|
47 | + 'key_column_usage.referenced_column_name as References', |
|
48 | + 'REFERENTIAL_CONSTRAINTS.UPDATE_RULE as onUpdate', |
|
49 | + 'REFERENTIAL_CONSTRAINTS.DELETE_RULE as onDelete', |
|
50 | + ]; |
|
51 | 51 | |
52 | 52 | protected function getTables() |
53 | 53 | { |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'backup' => [ |
5 | - /* |
|
5 | + /* |
|
6 | 6 | * The disk where your files will be backed up |
7 | 7 | **/ |
8 | 8 | 'disk' => 'local', |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | // Symfony style block messages |
38 | 38 | $formatter = $this->getHelperSet()->get('formatter'); |
39 | 39 | $errorMessages = [ |
40 | - $title, |
|
41 | - $message, |
|
42 | - ]; |
|
40 | + $title, |
|
41 | + $message, |
|
42 | + ]; |
|
43 | 43 | $formattedBlock = $formatter->formatBlock($errorMessages, $style, true); |
44 | 44 | $this->line($formattedBlock); |
45 | 45 | } |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | { |
63 | 63 | return [ |
64 | 64 | [ |
65 | - 'database', |
|
66 | - InputArgument::OPTIONAL, |
|
67 | - 'Override the application database', |
|
65 | + 'database', |
|
66 | + InputArgument::OPTIONAL, |
|
67 | + 'Override the application database', |
|
68 | 68 | ], |
69 | - ]; |
|
69 | + ]; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | //end getArguments() |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | { |
76 | 76 | return [ |
77 | 77 | [ |
78 | - 'ignore', |
|
79 | - 'i', |
|
80 | - InputOption::VALUE_REQUIRED, |
|
81 | - 'Ignore tables to export, seperated by a comma', |
|
82 | - null, |
|
78 | + 'ignore', |
|
79 | + 'i', |
|
80 | + InputOption::VALUE_REQUIRED, |
|
81 | + 'Ignore tables to export, seperated by a comma', |
|
82 | + null, |
|
83 | 83 | ], |
84 | - ]; |
|
84 | + ]; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | //end getOptions() |
@@ -15,25 +15,25 @@ discard block |
||
15 | 15 | * @var string |
16 | 16 | **/ |
17 | 17 | protected $columns = [ |
18 | - 'int' => 'integer', |
|
19 | - 'smallint' => 'smallInteger', |
|
20 | - 'bigint' => 'bigInteger', |
|
21 | - 'char ' => 'string', |
|
22 | - 'varchar' => 'string', |
|
23 | - 'float' => 'float', |
|
24 | - 'double' => 'double', |
|
25 | - 'decimal' => 'decimal', |
|
26 | - 'tinyint' => 'boolean', |
|
27 | - 'date' => 'date', |
|
28 | - 'timestamp' => 'timestamp', |
|
29 | - 'datetime' => 'dateTime', |
|
30 | - 'longtext' => 'longText', |
|
31 | - 'mediumtext' => 'mediumText', |
|
32 | - 'text' => 'text', |
|
33 | - 'longblob' => 'binary', |
|
34 | - 'blob' => 'binary', |
|
35 | - 'enum' => 'enum', |
|
36 | - ]; |
|
18 | + 'int' => 'integer', |
|
19 | + 'smallint' => 'smallInteger', |
|
20 | + 'bigint' => 'bigInteger', |
|
21 | + 'char ' => 'string', |
|
22 | + 'varchar' => 'string', |
|
23 | + 'float' => 'float', |
|
24 | + 'double' => 'double', |
|
25 | + 'decimal' => 'decimal', |
|
26 | + 'tinyint' => 'boolean', |
|
27 | + 'date' => 'date', |
|
28 | + 'timestamp' => 'timestamp', |
|
29 | + 'datetime' => 'dateTime', |
|
30 | + 'longtext' => 'longText', |
|
31 | + 'mediumtext' => 'mediumText', |
|
32 | + 'text' => 'text', |
|
33 | + 'longblob' => 'binary', |
|
34 | + 'blob' => 'binary', |
|
35 | + 'enum' => 'enum', |
|
36 | + ]; |
|
37 | 37 | /** |
38 | 38 | * Primary key column types. |
39 | 39 | * |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | $this->schema[$value['table_name']] = [ |
188 | - 'up' => $up, |
|
189 | - 'constraint' => $Constraint, |
|
190 | - 'constraint_down' => $ConstraintDown, |
|
191 | - 'down' => $down, |
|
192 | - ]; |
|
188 | + 'up' => $up, |
|
189 | + 'constraint' => $Constraint, |
|
190 | + 'constraint_down' => $ConstraintDown, |
|
191 | + 'down' => $down, |
|
192 | + ]; |
|
193 | 193 | }//end foreach |
194 | 194 | |
195 | 195 | return $this; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $this->publishes( |
35 | 35 | [ |
36 | - realpath(__DIR__ . '/../') . '/config/db-exporter.php' => config_path('db-exporter.php'), |
|
36 | + realpath(__DIR__ . '/../') . '/config/db-exporter.php' => config_path('db-exporter.php'), |
|
37 | 37 | ], |
38 | 38 | 'config' |
39 | 39 | ); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ); |
45 | 45 | // Instatiate a new DbMigrations class to send to the handler |
46 | 46 | $this->migrator = $migrator; |
47 | - // Load the alias |
|
47 | + // Load the alias |
|
48 | 48 | $this->loadAlias(); |
49 | 49 | } |
50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $this->app->register(DbMigrationsServiceProvider::class); |
56 | 56 | // Register the base export handler class |
57 | 57 | $this->registerDbExportHandler(); |
58 | - // Handle the artisan commands |
|
58 | + // Handle the artisan commands |
|
59 | 59 | $this->registerCommands(); |
60 | 60 | } |
61 | 61 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | public function registerCommands() |
75 | 75 | { |
76 | 76 | $commands = [ |
77 | - 'Migrations', |
|
78 | - 'Seeds', |
|
79 | - 'Backup', |
|
77 | + 'Migrations', |
|
78 | + 'Seeds', |
|
79 | + 'Backup', |
|
80 | 80 | ]; |
81 | 81 | |
82 | 82 | foreach ($commands as $command) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $this->app->singleton( |
100 | 100 | 'db-exporter.migrations', |
101 | - function ($app) { |
|
101 | + function($app) { |
|
102 | 102 | return new Commands\MigrationsGeneratorCommand($app[DbExportHandler::class]); |
103 | 103 | } |
104 | 104 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $this->app->singleton( |
115 | 115 | 'db-exporter.seeds', |
116 | - function ($app) { |
|
116 | + function($app) { |
|
117 | 117 | return new Commands\SeedGeneratorCommand($app[DbExportHandler::class]); |
118 | 118 | } |
119 | 119 | ); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $this->app->singleton( |
127 | 127 | 'db-exporter.backup', |
128 | - function () { |
|
128 | + function() { |
|
129 | 129 | return new Commands\CopyToRemoteCommand(); |
130 | 130 | } |
131 | 131 | ); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $this->app->bind( |
142 | 142 | DbExportHandler::class, |
143 | - function ($app) { |
|
143 | + function($app) { |
|
144 | 144 | // Instatiate a new DbSeeding class to send to the handler |
145 | 145 | $seeder = new DbSeeding($app[DbMigrations::class]->database); |
146 | 146 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $this->app->bind( |
153 | 153 | 'DbExporter', |
154 | - function ($app) { |
|
154 | + function($app) { |
|
155 | 155 | return $app[DbExportHandler::class]; |
156 | 156 | } |
157 | 157 | ); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $this->app->singleton( |
35 | 35 | DbMigrations::class, |
36 | - function () { |
|
36 | + function() { |
|
37 | 37 | $connType = Config::get('database.default'); |
38 | 38 | $database = Config::get('database.connections.' . $connType); |
39 | 39 |