add company-manager role

This commit is contained in:
iIronside
2022-12-01 14:11:29 +03:00
parent 1f349aec84
commit 8cd2eebfee
28 changed files with 812 additions and 82 deletions

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%company_manager}}`.
*/
class m221129_100558_create_company_manager_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%company_manager}}', [
'id' => $this->primaryKey(),
'company_id' => $this->integer(),
'user_card_id' => $this->integer(),
]);
$this->addForeignKey('company_company_manager', 'company_manager', 'company_id', 'company', 'id');
$this->addForeignKey('user_card_company_manager', 'company_manager', 'user_card_id', 'user_card', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('company_company_manager', 'company_manager');
$this->dropForeignKey('user_card_company_manager', 'company_manager');
$this->dropTable('{{%company_manager}}');
}
}