db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%details}}', [ 'ID' => 'int(10) UNSIGNED NOT NULL', 'IMPORT_ID' => 'int(6) unsigned NOT NULL', 'BRAND' => 'varchar(100) NOT NULL', 'ARTICLE' => 'varchar(100) NOT NULL', 'FULL_ARTICLE' => 'varchar(150) NOT NULL', 'PRICE' => 'float(15,2) unsigned NOT NULL', 'DESCR' => 'varchar(200) NOT NULL', 'BOX' => 'int(6) unsigned NOT NULL', 'ADD_BOX' => 'int(6) unsigned NOT NULL DEFAULT 0', 'GROUP' => 'varchar(200) NOT NULL', 'timestamp' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',], $tableOptions); //$this->dropPrimaryKey('ID','{{%details}}'); $this->createIndex('ID_delete', '{{%details}}', 'ID', true); $this->execute('ALTER TABLE details CHANGE COLUMN ID ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT'); $this->addPrimaryKey('importer_id', '{{%details}}', 'import_id, brand, ARTICLE'); $this->createIndex('timestamp', '{{%details}}', 'timestamp', false); $this->createIndex('ARTICLE', '{{%details}}', 'ARTICLE', 'BRAND', 'ADD_BOX', false); $this->createIndex('IMPORT_ID', '{{%details}}', 'ARTICLE', false); $this->createIndex('IMPORT_ID_2', '{{%details}}', 'IMPORT_ID', 'timestamp', false); // PRIMARY KEY ('ARTICLE','BRAND','IMPORT_ID'), // UNIQUE KEY 'ID_delete' ('ID'), // KEY 'timestamp' ('timestamp'), // KEY 'ARTICLE' ('ARTICLE','BRAND','BOX'), // KEY 'BRAND' ('BRAND','ARTICLE'), // KEY 'ARTICLE_2' ('ARTICLE','BRAND','ADD_BOX'), // KEY 'IMPORT_ID' ('IMPORT_ID','ARTICLE'), // KEY 'IMPORT_ID_2' ('IMPORT_ID','timestamp } public function down() { $this->dropTable('{{%details}}'); } /* // Use safeUp/safeDown to run migration code within a transaction public function safeUp() { } public function safeDown() { } */ }