add employee module

This commit is contained in:
iIronside
2021-11-16 13:14:28 +03:00
parent f7c8ab4de6
commit e561687b09
30 changed files with 4503 additions and 26 deletions

View File

@ -0,0 +1,30 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%manager}}`.
*/
class m211115_125911_create_manager_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%manager}}', [
'id' => $this->primaryKey(),
'user_id' => $this->integer(),
]);
$this->addForeignKey('manager_user', 'manager', 'user_id', 'user', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('manager_user', 'manager');
$this->dropTable('{{%manager}}');
}
}

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%manager_employee}}`.
*/
class m211115_131016_create_manager_employee_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%manager_employee}}', [
'id' => $this->primaryKey(),
'manager_id' => $this->integer(),
'employee_id' => $this->integer(),
]);
$this->addForeignKey('manager_employee', 'manager_employee', 'manager_id', 'manager', 'id');
$this->addForeignKey('employee_user', 'manager_employee', 'employee_id', 'user', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('manager_employee', 'manager_employee');
$this->dropForeignKey('employee_user', 'manager_employee');
$this->dropTable('{{%manager_employee}}');
}
}