add mark to project

This commit is contained in:
iIronside
2023-01-23 17:50:38 +03:00
parent 9eba04cae2
commit 8a1f99c707
26 changed files with 1199 additions and 87 deletions

View File

@ -0,0 +1,28 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%mark}}`.
*/
class m230123_084421_create_mark_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%mark}}', [
'id' => $this->primaryKey(),
'title' => $this->string()
]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('{{%mark}}');
}
}

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%project_mark}}`.
*/
class m230123_084629_create_project_mark_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%project_mark}}', [
'id' => $this->primaryKey(),
'project_id' => $this->integer(),
'mark_id' => $this->integer(),
]);
$this->addForeignKey('project_mark_project', 'project_mark', 'project_id', 'project', 'id');
$this->addForeignKey('project_mark_mark', 'project_mark', 'mark_id', 'mark', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('project_mark_project', 'project_mark');
$this->dropForeignKey('project_mark_mark', 'project_mark');
$this->dropTable('{{%project_mark}}');
}
}