fix: [migrations:localTools] Make sure the table do not exists before creating it

feature/docker-ci
mokaddem 2021-06-29 10:56:40 +02:00
parent f0f49ecbc3
commit b64d7890ca
1 changed files with 39 additions and 36 deletions

View File

@ -17,46 +17,49 @@ class LocalTools extends AbstractMigration
*/ */
public function change() public function change()
{ {
$table = $this->table('local_tools', [ $exists = $this->hasTable('local_tools');
'signed' => false, if (!$exists) {
'collation' => 'utf8mb4_unicode_ci', $table = $this->table('local_tools', [
]);
$table
->addColumn('id', 'integer', [
'autoIncrement' => true,
'limit' => 10,
'signed' => false, 'signed' => false,
]) 'collation' => 'utf8mb4_unicode_ci',
->addPrimaryKey('id')
->addColumn('name', 'string', [
'default' => null,
'null' => false,
'limit' => 191,
'comment' => 'The name of the individual connection',
])
->addColumn('connector', 'string', [
'default' => null,
'null' => false,
'limit' => 191,
'comment' => 'The library name used for the connection',
])
->addColumn('settings', 'text', [
'default' => null,
'null' => true,
])
->addColumn('exposed', 'boolean', [
'default' => 0,
'null' => false,
])
->addColumn('description', 'text', [
'default' => null,
'null' => true,
]); ]);
$table
->addColumn('id', 'integer', [
'autoIncrement' => true,
'limit' => 10,
'signed' => false,
])
->addPrimaryKey('id')
->addColumn('name', 'string', [
'default' => null,
'null' => false,
'limit' => 191,
'comment' => 'The name of the individual connection',
])
->addColumn('connector', 'string', [
'default' => null,
'null' => false,
'limit' => 191,
'comment' => 'The library name used for the connection',
])
->addColumn('settings', 'text', [
'default' => null,
'null' => true,
])
->addColumn('exposed', 'boolean', [
'default' => 0,
'null' => false,
])
->addColumn('description', 'text', [
'default' => null,
'null' => true,
]);
$table->addIndex('name') $table->addIndex('name')
->addIndex('connector'); ->addIndex('connector');
$table->create(); $table->create();
}
} }
} }