fix: [migration] userorg migration fixed
parent
c7768921fb
commit
94457d3b97
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
use Migrations\AbstractMigration;
|
||||||
|
|
||||||
final class UserOrg extends AbstractMigration
|
final class UserOrg extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
@ -18,18 +18,15 @@ final class UserOrg extends AbstractMigration
|
||||||
*/
|
*/
|
||||||
public function change(): void
|
public function change(): void
|
||||||
{
|
{
|
||||||
$exists = $this->hasTable('users');
|
$alignments = $this->table('users')
|
||||||
if (!$exists) {
|
->addColumn('organisation_id', 'integer', [
|
||||||
$alignments = $this->table('users')
|
'default' => null,
|
||||||
->addColumn('organisation_id', 'integer', [
|
'null' => true,
|
||||||
'default' => null,
|
'signed' => false,
|
||||||
'null' => true,
|
'length' => 10
|
||||||
'signed' => false,
|
])
|
||||||
'length' => 10
|
->addIndex('org_id')
|
||||||
])
|
->update();
|
||||||
->addIndex('org_id')
|
|
||||||
->update();
|
|
||||||
}
|
|
||||||
$q1 = $this->getQueryBuilder();
|
$q1 = $this->getQueryBuilder();
|
||||||
$org_id = $q1->select(['min(id)'])->from('organisations')->execute()->fetchAll()[0][0];
|
$org_id = $q1->select(['min(id)'])->from('organisations')->execute()->fetchAll()[0][0];
|
||||||
if (!empty($org_id)) {
|
if (!empty($org_id)) {
|
||||||
|
|
Loading…
Reference in New Issue