@@ -157,13 +157,13 @@ |
||
157 | 157 | foreach ($results as $cfg) { |
158 | 158 | if ($cfg->parent) { |
159 | 159 | $results = $this->queryBuilder |
160 | - ->from($this->table) |
|
161 | - ->where('env')->is($cfg->env) |
|
162 | - ->where('module')->is($cfg->parent) |
|
163 | - ->where('status')->is(1) |
|
164 | - ->select() |
|
165 | - ->fetchObject() |
|
166 | - ->all(); |
|
160 | + ->from($this->table) |
|
161 | + ->where('env')->is($cfg->env) |
|
162 | + ->where('module')->is($cfg->parent) |
|
163 | + ->where('status')->is(1) |
|
164 | + ->select() |
|
165 | + ->fetchObject() |
|
166 | + ->all(); |
|
167 | 167 | |
168 | 168 | foreach ($results as $cfg) { |
169 | 169 | $config[$cfg->name] = $cfg->value ?? $cfg->default_value; |
@@ -71,7 +71,7 @@ |
||
71 | 71 | ) { |
72 | 72 | parent::__construct($app, $repository, $config, $filesystem); |
73 | 73 | $this->setName('migration:migrate') |
74 | - ->setDescription('Upgrade migration to latest'); |
|
74 | + ->setDescription('Upgrade migration to latest'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -71,7 +71,7 @@ |
||
71 | 71 | ) { |
72 | 72 | parent::__construct($app, $repository, $config, $filesystem); |
73 | 73 | $this->setName('migration:reset') |
74 | - ->setDescription('Rollback all migration done before'); |
|
74 | + ->setDescription('Rollback all migration done before'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | ) { |
81 | 81 | parent::__construct($app, $repository, $config, $filesystem); |
82 | 82 | $this->setName('migration:init') |
83 | - ->setDescription("Initialize the migration data. Note this command\n" |
|
84 | - . "is run only at the first time to create migration table"); |
|
83 | + ->setDescription("Initialize the migration data. Note this command\n" |
|
84 | + . "is run only at the first time to create migration table"); |
|
85 | 85 | |
86 | 86 | $this->schema = $schema; |
87 | 87 | } |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | $tableName = $this->table; |
120 | 120 | $this->schema->create($tableName, function (CreateTable $table) { |
121 | 121 | $table->string('version', 20) |
122 | - ->description('The migration version') |
|
123 | - ->primary(); |
|
122 | + ->description('The migration version') |
|
123 | + ->primary(); |
|
124 | 124 | $table->string('description') |
125 | - ->description('The migration description'); |
|
125 | + ->description('The migration description'); |
|
126 | 126 | $table->datetime('created_at') |
127 | 127 | ->description('Migration run time'); |
128 | 128 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ) { |
81 | 81 | parent::__construct($app, $repository, $config, $filesystem); |
82 | 82 | $this->setName('migration:create') |
83 | - ->setDescription('Create a new migration'); |
|
83 | + ->setDescription('Create a new migration'); |
|
84 | 84 | |
85 | 85 | $this->addArgument('name', 'name of migration', null, false, true); |
86 | 86 | } |
@@ -158,26 +158,3 @@ discard block |
||
158 | 158 | private function getTemplateClass(): string |
159 | 159 | { |
160 | 160 | return <<<EOF |
161 | - <?php |
|
162 | - namespace Platine\Framework\Migration; |
|
163 | - |
|
164 | - use Platine\Framework\Migration\AbstractMigration; |
|
165 | - |
|
166 | - class %classname% extends AbstractMigration |
|
167 | - { |
|
168 | - |
|
169 | - public function up(): void |
|
170 | - { |
|
171 | - //Action when migrate up |
|
172 | - |
|
173 | - } |
|
174 | - |
|
175 | - public function down(): void |
|
176 | - { |
|
177 | - //Action when migrate down |
|
178 | - |
|
179 | - } |
|
180 | - } |
|
181 | - EOF; |
|
182 | - } |
|
183 | -} |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ) { |
73 | 73 | parent::__construct($app, $repository, $config, $filesystem); |
74 | 74 | $this->setName('migration:exec') |
75 | - ->setDescription('Execute the migration up/down for one version'); |
|
75 | + ->setDescription('Execute the migration up/down for one version'); |
|
76 | 76 | |
77 | 77 | $this->addArgument('type', 'type of migration [up|down]', 'up', true, true, false, function ($val) { |
78 | 78 | if (!in_array($val, ['up', 'down'])) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | )); |
83 | 83 | } |
84 | 84 | |
85 | - return $val; |
|
85 | + return $val; |
|
86 | 86 | }); |
87 | 87 | |
88 | 88 | $this->addOption('-i|--id', 'the migration version', null, false, true); |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | protected function getExecuted(string $orderDir = 'ASC'): array |
215 | 215 | { |
216 | 216 | $migrations = $this->repository |
217 | - ->query() |
|
218 | - ->orderBy('version', $orderDir) |
|
219 | - ->all(); |
|
217 | + ->query() |
|
218 | + ->orderBy('version', $orderDir) |
|
219 | + ->all(); |
|
220 | 220 | $result = []; |
221 | 221 | |
222 | 222 | foreach ($migrations as $entity) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | protected function getMigrationClassName(string $description, string $version): string |
236 | 236 | { |
237 | 237 | return Str::camel($description, false) |
238 | - . Str::replaceFirst('_', '', $version); |
|
238 | + . Str::replaceFirst('_', '', $version); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -72,7 +72,7 @@ |
||
72 | 72 | ) { |
73 | 73 | parent::__construct($app, $repository, $config, $filesystem); |
74 | 74 | $this->setName('migration:status') |
75 | - ->setDescription('Show current status of your migrations'); |
|
75 | + ->setDescription('Show current status of your migrations'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |