* @copyright (c), Thread */ class m160810_130204_create_table_languages extends Migration { /** * @var string */ public $table = '{{%system_languages}}'; /** * */ public function init() { $this->db = ParentModule::getDb(); parent::init(); } /** * Implement migration */ public function safeUp() { $this->createTable($this->table, [ 'id' => $this->primaryKey()->unsigned()->comment('ID'), 'alias' => $this->string(50)->notNull()->comment('Value'), 'local' => $this->string(50)->notNull()->comment('local'), 'label' => $this->string(50)->notNull()->comment('label'), 'img_flag' => $this->string(255)->notNull()->defaultValue('')->comment('img_flag'), 'created_at' => $this->integer()->unsigned()->notNull()->defaultValue(0)->comment('Create time'), 'updated_at' => $this->integer()->unsigned()->notNull()->defaultValue(0)->comment('Update time'), 'published' => "enum('0','1') NOT NULL DEFAULT '0' COMMENT 'Published'", 'deleted' => "enum('0','1') NOT NULL DEFAULT '0' COMMENT 'Deleted'", 'by_default' => "enum('0','1') NOT NULL DEFAULT '0' COMMENT 'Deleted'", ]); $this->createIndex('published', $this->table, 'published'); $this->createIndex('deleted', $this->table, 'deleted'); $this->createIndex('by_default', $this->table, 'by_default'); } /** * Cancel migration */ public function safeDown() { $this->dropIndex('deleted', $this->table); $this->dropIndex('published', $this->table); $this->dropIndex('by_default', $this->table); } }