for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use yii\db\Migration;
/**
* Handles the creation of table `content`.
*/
// @codingStandardsIgnoreLine
class m161031_094747_create_content_table extends Migration
{
* {@inheritdoc}
public function up()
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('content', [
'id' => $this->primaryKey()->notNull()->append('AUTO_INCREMENT'),
'name' => $this->string(64)->notNull(),
'description' => $this->string(1024),
'flow_id' => $this->integer()->notNull(),
'type_id' => $this->string(45)->notNull(),
'data' => $this->text(),
'duration' => $this->integer()->notNull()->defaultValue(10),
'start_ts' => $this->timestamp()->null(),
'end_ts' => $this->timestamp()->null(),
'add_ts' => $this->timestamp()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),
'enabled' => $this->boolean()->notNull()->defaultValue(true),
], $tableOptions);
$this->createIndex(
'fk_content_flow1_idx',
'content',
'flow_id'
);
'fk_content_content_type1_idx',
'type_id'
$this->addForeignKey(
'fk_content_flow1',
'flow_id',
'flow',
'id',
'CASCADE',
'CASCADE'
'fk_content_content_type1',
'type_id',
'content_type',
public function down()
$this->dropTable('content');