@@ -56,7 +56,7 @@ |
||
| 56 | 56 | { |
| 57 | 57 | $name = $this->argument('name'); |
| 58 | 58 | if (empty($name)) { |
| 59 | - $name = $this->prompt(lang('Migrations.migSeeder'), null, static function ($val) { |
|
| 59 | + $name = $this->prompt(lang('Migrations.migSeeder'), null, static function($val) { |
|
| 60 | 60 | if (empty($val)) { |
| 61 | 61 | throw new InvalidArgumentException('Veuillez entrer le nom du seeder.'); |
| 62 | 62 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $runner->clearMessages(); |
| 64 | 64 | $runner->setFiles(Helper::getMigrationFiles($this->option('all') === true, $namespace)); |
| 65 | 65 | |
| 66 | - if (! $runner->latest($group)) { |
|
| 66 | + if (!$runner->latest($group)) { |
|
| 67 | 67 | $this->fail(lang('Migrations.generalFault')); // @codeCoverageIgnore |
| 68 | 68 | } |
| 69 | 69 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // @codeCoverageIgnoreStart |
| 58 | 58 | $force = $this->option('force'); |
| 59 | 59 | |
| 60 | - if (! $force && ! $this->confirm(lang('Migrations.rollBackConfirm'))) { |
|
| 60 | + if (!$force && !$this->confirm(lang('Migrations.rollBackConfirm'))) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | // @codeCoverageIgnoreEnd |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $runner->setFiles(Helper::getMigrationFiles(true)); |
| 75 | 75 | |
| 76 | - if (! $runner->regress($batch, $group)) { |
|
| 76 | + if (!$runner->regress($batch, $group)) { |
|
| 77 | 77 | $this->error(lang('Migrations.generalFault')); // @codeCoverageIgnore |
| 78 | 78 | } |
| 79 | 79 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $status = []; |
| 74 | 74 | |
| 75 | 75 | foreach (Helper::getMigrationFiles(true) as $namespace => $files) { |
| 76 | - if (! on_test()) { |
|
| 76 | + if (!on_test()) { |
|
| 77 | 77 | // Rendre Tests\\Support détectable pour les tests |
| 78 | 78 | $this->ignoredNamespaces[] = 'Tests\Support'; // @codeCoverageIgnore |
| 79 | 79 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if (! $status) { |
|
| 128 | + if (!$status) { |
|
| 129 | 129 | // @codeCoverageIgnoreStart |
| 130 | 130 | $this->error(lang('Migrations.noneFound'))->newLine(); |
| 131 | 131 | |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | // @codeCoverageIgnoreStart |
| 60 | 60 | $force = $this->option('force'); |
| 61 | 61 | |
| 62 | - if (! $force && ! $this->confirm(lang('Migrations.refreshConfirm'))) { |
|
| 62 | + if (!$force && !$this->confirm(lang('Migrations.refreshConfirm'))) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $name = $this->argument('name'); |
| 61 | 61 | if (empty($name)) { |
| 62 | - $name = $this->prompt('Nom de la base de données', null, static function ($val) { |
|
| 62 | + $name = $this->prompt('Nom de la base de données', null, static function($val) { |
|
| 63 | 63 | if (empty($val)) { |
| 64 | 64 | throw new InvalidArgumentException('Veuillez entrer le nom de la base de données.'); |
| 65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | if ($db instanceof SQLite) { |
| 80 | 80 | $ext = $this->option('ext', 'db'); |
| 81 | 81 | |
| 82 | - if (! in_array($ext, ['db', 'sqlite'], true)) { |
|
| 82 | + if (!in_array($ext, ['db', 'sqlite'], true)) { |
|
| 83 | 83 | $ext = $this->prompt('Please choose a valid file extension', ['db', 'sqlite']); // @codeCoverageIgnore |
| 84 | 84 | } |
| 85 | 85 | |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | $db = Database::connect($config, false); |
| 107 | 107 | $db->connect(); |
| 108 | 108 | |
| 109 | - if (! is_file($db->getDatabase()) && $name !== ':memory:') { |
|
| 109 | + if (!is_file($db->getDatabase()) && $name !== ':memory:') { |
|
| 110 | 110 | // @codeCoverageIgnoreStart |
| 111 | 111 | $this->error('Echec de la création de la base de données'); |
| 112 | 112 | |
| 113 | 113 | return; |
| 114 | 114 | // @codeCoverageIgnoreEnd |
| 115 | 115 | } |
| 116 | - } elseif (! Database::creator($db)->createDatabase($name)) { |
|
| 116 | + } elseif (!Database::creator($db)->createDatabase($name)) { |
|
| 117 | 117 | // @codeCoverageIgnoreStart |
| 118 | 118 | $this->error('Echec de la création de la base de données'); |
| 119 | 119 | |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | $limitRows = (int) $this->option('limit-rows', 10); |
| 107 | 107 | $limitFieldValue = (int) $this->option('limit-field-value', 15); |
| 108 | 108 | |
| 109 | - if (! in_array($tableName, $tables, true)) { |
|
| 109 | + if (!in_array($tableName, $tables, true)) { |
|
| 110 | 110 | $tabs = $tables; |
| 111 | 111 | $tables = []; |
| 112 | 112 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | namespace {namespace}; |
| 4 | 4 | |
| 5 | 5 | use BlitzPHP\Database\Migration\Migration; |
| 6 | -<?php if (! empty($table) && ! empty($action)): ?> |
|
| 6 | +<?php if (!empty($table) && !empty($action)): ?> |
|
| 7 | 7 | use BlitzPHP\Database\Migration\Structure; |
| 8 | 8 | <?php endif; ?> |
| 9 | 9 | |
@@ -17,7 +17,8 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | <?php if (empty($table) || empty($action)): ?> |
| 19 | 19 | // |
| 20 | -<?php else: ?> |
|
| 20 | +<?php else { |
|
| 21 | + : ?> |
|
| 21 | 22 | $this-><?= $action ?>('<?= $table ?>', function(Structure $table) { |
| 22 | 23 | <?php if ($session): ?> |
| 23 | 24 | $table->string('id', 128); |
@@ -28,12 +29,17 @@ discard block |
||
| 28 | 29 | $table->primary(['id', 'ip_address']); |
| 29 | 30 | <?php else: ?> |
| 30 | 31 | $table->primary('id'); |
| 31 | -<?php endif; ?> |
|
| 32 | +<?php endif; |
|
| 33 | +} |
|
| 34 | +?> |
|
| 32 | 35 | $table->index('timestamp'); |
| 33 | -<?php else: ?> |
|
| 36 | +<?php else { |
|
| 37 | + : ?> |
|
| 34 | 38 | $table->id(); |
| 35 | 39 | $table->timestamps(); |
| 36 | -<?php endif; ?> |
|
| 40 | +<?php endif; |
|
| 41 | +} |
|
| 42 | +?> |
|
| 37 | 43 | |
| 38 | 44 | return $table; |
| 39 | 45 | }); |
@@ -46,10 +52,13 @@ discard block |
||
| 46 | 52 | // |
| 47 | 53 | <?php elseif ($action === 'create') : ?> |
| 48 | 54 | $this->dropIfExists('<?= $table ?>'); |
| 49 | -<?php else: ?> |
|
| 55 | +<?php else { |
|
| 56 | + : ?> |
|
| 50 | 57 | $this->modify('<?= $table ?>', function(Structure $table) { |
| 51 | 58 | // |
| 52 | 59 | }); |
| 53 | -<?php endif; ?> |
|
| 60 | +<?php endif; |
|
| 61 | +} |
|
| 62 | +?> |
|
| 54 | 63 | } |
| 55 | 64 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | throw new InvalidArgumentException('Impossible d\'utiliser "create" et "modify" au même moment pour la génération des migrations.'); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if (! $create && ! $modify) { |
|
| 101 | + if (!$create && !$modify) { |
|
| 102 | 102 | $data['action'] = null; |
| 103 | 103 | } else { |
| 104 | 104 | $data['action'] = $create ? 'create' : 'modify'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (! is_string($table) || $table === '') { |
|
| 120 | + if (!is_string($table) || $table === '') { |
|
| 121 | 121 | if ($data['session']) { |
| 122 | 122 | $table = 'blitz_sessions'; |
| 123 | 123 | } elseif (is_string($create)) { |