fix: [migration:user_org] Fixed if org_id column does not exist

pull/79/head
Sami Mokaddem 2021-11-24 22:49:40 +01:00
parent e8e1a16673
commit 999f4c8539
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 3 additions and 3 deletions

View File

@ -18,16 +18,16 @@ final class UserOrg extends AbstractMigration
*/ */
public function change(): void public function change(): void
{ {
$exists = $this->hasTable('users'); $exists = $this->table('users')->hasColumn('organisation_id');
if (!$exists) { if (!$exists) {
$alignments = $this->table('users') $this->table('users')
->addColumn('organisation_id', 'integer', [ ->addColumn('organisation_id', 'integer', [
'default' => null, 'default' => null,
'null' => true, 'null' => true,
'signed' => false, 'signed' => false,
'length' => 10 'length' => 10
]) ])
->addIndex('org_id') ->addIndex('organisation_id')
->update(); ->update();
} }
$q1 = $this->getQueryBuilder(); $q1 = $this->getQueryBuilder();