add document module
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%document_template}}`.
|
||||
*/
|
||||
class m221108_135514_create_document_template_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%document_template}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'title' => $this->string(),
|
||||
'template_body' => $this->text()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropTable('{{%document_template}}');
|
||||
}
|
||||
}
|
36
console/migrations/m221108_135939_create_document_table.php
Normal file
36
console/migrations/m221108_135939_create_document_table.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%document}}`.
|
||||
*/
|
||||
class m221108_135939_create_document_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%document}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'company_id' => $this->integer(11)->notNull(),
|
||||
'contractor_company_id' => $this->integer(11),
|
||||
'manager_id' => $this->integer(11)->notNull(),
|
||||
'contractor_manager_id' => $this->integer(11)->notNull(),
|
||||
]);
|
||||
|
||||
$this->addForeignKey('company_document', 'document', 'company_id', 'company', 'id');
|
||||
$this->addForeignKey('contractor_company_document', 'document', 'contractor_company_id', 'company', 'id');
|
||||
$this->addForeignKey('manager_document', 'document', 'manager_id','manager', 'id');
|
||||
$this->addForeignKey('contractor_manager_document', 'document', 'contractor_manager_id','manager', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropTable('{{%document}}');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user