db->driverName === 'mysql') { // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%event_equipment_type}}', [ 'id' => $this->primaryKey(), 'name' => $this->string(255), 'created_at' => $this->dateTime()->notNull(), 'updated_at' => $this->dateTime()->notNull(), ], $tableOptions); $this->createTable('{{%event_equipment_type_assignment}}', [ 'id' => $this->primaryKey(), 'id_event' => $this->integer(), 'id_event_equipment_type' => $this->integer(), 'count' => $this->integer(), 'created_at' => $this->dateTime()->notNull(), 'updated_at' => $this->dateTime()->notNull(), 'FOREIGN KEY (id_event) REFERENCES event (id) ON DELETE CASCADE ON UPDATE CASCADE', 'FOREIGN KEY (id_event_equipment_type) REFERENCES event_equipment_type (id) ON DELETE CASCADE ON UPDATE CASCADE', ], $tableOptions); $this->createTable('{{%event_registration_equipment_type_assignment}}', [ 'id' => $this->primaryKey(), 'id_event_equipment_type' => $this->integer(), 'id_event_registration' => $this->integer(), 'created_at' => $this->dateTime()->notNull(), 'updated_at' => $this->dateTime()->notNull(), 'FOREIGN KEY (id_event_registration) REFERENCES event_registration (id) ON DELETE CASCADE ON UPDATE CASCADE', 'FOREIGN KEY (id_event_equipment_type) REFERENCES event_equipment_type (id) ON DELETE CASCADE ON UPDATE CASCADE', ], $tableOptions); } /** * {@inheritdoc} */ public function safeDown() { echo "m200911_200200_add_table_equipment cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "m200911_200200_add_table_equipment cannot be reverted.\n"; return false; } */ }