12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- use yii\db\Schema;
- use yii\db\Migration;
- class m231103_074827_report_photo extends Migration
- {
- public function init()
- {
- $this->db = 'db';
- parent::init();
- }
- public function safeUp()
- {
- $tableOptions = 'ENGINE=InnoDB';
- $this->createTable(
- '{{%report_photo}}',
- [
- 'id'=> $this->primaryKey()->unsigned(),
- 'topic_id'=> $this->integer()->unsigned()->notNull()->defaultValue(0),
- 'title'=> $this->text()->null()->defaultValue(null),
- 'sort'=> $this->integer()->unsigned()->notNull()->defaultValue(0),
- 'active'=> $this->integer()->notNull()->defaultValue(0),
- ],$tableOptions
- );
- $this->createIndex('sel','{{%report_photo}}',['id','topic_id','active'],false);
- $this->createIndex('sort','{{%report_photo}}',['sort'],false);
- }
- public function safeDown()
- {
- $this->dropIndex('sel', '{{%report_photo}}');
- $this->dropIndex('sort', '{{%report_photo}}');
- $this->dropTable('{{%report_photo}}');
- }
- }
|