fix: [plugin:tags] Database migration

pull/79/head
Sami Mokaddem 2021-10-21 13:42:29 +02:00
parent 39f7a3f9e1
commit 121990a941
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 5 additions and 5 deletions

View File

@ -7,8 +7,8 @@ use Migrations\AbstractMigration;
class TagSystem extends AbstractMigration class TagSystem extends AbstractMigration
{ {
public function change() { public function change() {
$tags = $this->table('tags_tags') $tags = $this->table('tags_tags');
->addColumn('namespace', 'string', [ $tags->addColumn('namespace', 'string', [
'default' => null, 'default' => null,
'limit' => 255, 'limit' => 255,
'null' => true, 'null' => true,
@ -50,8 +50,8 @@ class TagSystem extends AbstractMigration
]) ])
->create(); ->create();
$tagged = $this->table('tags_tagged') $tagged = $this->table('tags_tagged');
->addColumn('tag_id', 'integer', [ $tagged->addColumn('tag_id', 'integer', [
'default' => null, 'default' => null,
'null' => false, 'null' => false,
'signed' => false, 'signed' => false,
@ -83,7 +83,7 @@ class TagSystem extends AbstractMigration
$tags->addIndex(['name'], ['unique' => true]) $tags->addIndex(['name'], ['unique' => true])
->update(); ->update();
$tagged->addIndex(['tag_id', 'fk_id', 'fk_table'], ['unique' => true]) $tagged->addIndex(['tag_id', 'fk_id', 'fk_model'], ['unique' => true])
->update(); ->update();
} }
} }