create project
This commit is contained in:
75
console/migrations/m240110_155920_create_check_table.php
Normal file
75
console/migrations/m240110_155920_create_check_table.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%check}}`.
|
||||
*/
|
||||
class m240110_155920_create_check_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%check}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'number' => $this->string(255)->notNull(),
|
||||
'company_id' => $this->integer(11)->notNull(),
|
||||
'addresses_id' => $this->integer(11)->notNull(),
|
||||
'status' => $this->integer(1)->defaultValue(1),
|
||||
]);
|
||||
|
||||
$this->createIndex('idx-check-company_id', 'check', 'company_id');
|
||||
|
||||
$this->addForeignKey(
|
||||
'fk-check-company_id',
|
||||
'check',
|
||||
'company_id',
|
||||
'company',
|
||||
'id',
|
||||
'CASCADE'
|
||||
);
|
||||
|
||||
$this->createIndex('idx-check-addresses_id', 'check', 'addresses_id');
|
||||
|
||||
$this->addForeignKey(
|
||||
'fk-check-addresses_id',
|
||||
'check',
|
||||
'addresses_id',
|
||||
'addresses',
|
||||
'id',
|
||||
'CASCADE'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey(
|
||||
'fk-check-company_id',
|
||||
'check'
|
||||
);
|
||||
|
||||
// drops index for column `author_id`
|
||||
$this->dropIndex(
|
||||
'idx-check-company_id',
|
||||
'check'
|
||||
);
|
||||
|
||||
$this->dropForeignKey(
|
||||
'fk-check-addresses_id',
|
||||
'check'
|
||||
);
|
||||
|
||||
// drops index for column `author_id`
|
||||
$this->dropIndex(
|
||||
'idx-check-addresses_id',
|
||||
'check'
|
||||
);
|
||||
|
||||
$this->dropTable('{{%check}}');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user