Commit e8db28d9946037ade1ac023b973afd705dfbbbfc

Authored by Mihail
1 parent 5c2732df

migration files for importer_files and importer_prefix tables

console/migrations/m150831_130250_addImporters.php
@@ -9,43 +9,9 @@ class m150831_130250_addImporters extends Migration @@ -9,43 +9,9 @@ class m150831_130250_addImporters extends Migration
9 { 9 {
10 $tableOptions = null; 10 $tableOptions = null;
11 if ($this->db->driverName === 'mysql') { 11 if ($this->db->driverName === 'mysql') {
12 - // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci  
13 $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; 12 $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
14 } 13 }
15 14
16 -// 'userid' => Schema::TYPE_PK . ' AUTO_INCREMENT',  
17 -// 'email' => Schema::TYPE_STRING . '(45) NOT NULL',  
18 -// 'name' => Schema::TYPE_STRING . '(100) NOT NULL',  
19 -//  
20 -// CREATE TABLE 'w_importers' (  
21 -// 'id' int(6) unsigned NOT NULL AUTO_INCREMENT,  
22 -// 'code' varchar(254) NOT NULL,  
23 -// 'name' varchar(254) NOT NULL,  
24 -// 'name_price' varchar(254) NOT NULL,  
25 -// 'currency_id' int(3) unsigned NOT NULL,  
26 -// 'delivery' varchar(254) NOT NULL,  
27 -// 'email' varchar(254) NOT NULL,  
28 -// 'info' text NOT NULL,  
29 -// 'active' tinyint(1) unsigned NOT NULL DEFAULT '1',  
30 -// 'PARSER_IS_ACTIVE' tinyint(1) unsigned NOT NULL DEFAULT '0',  
31 -// 'PARSER_COLUMN_COUNT' int(6) unsigned DEFAULT NULL,  
32 -// 'PARSER_FIELD_BRAND' int(3) unsigned DEFAULT NULL,  
33 -// 'PARSER_FIELD_ARTICLE' int(3) unsigned DEFAULT NULL,  
34 -// 'PARSER_FIELD_ARTICLE_PREFIX' tinyint(1) unsigned NOT NULL DEFAULT '0',  
35 -// 'PARSER_FIELD_PRICE' int(3) unsigned DEFAULT NULL,  
36 -// 'PARSER_FIELD_DESCR' int(3) unsigned DEFAULT NULL,  
37 -// 'PARSER_FIELD_BOX' int(3) unsigned DEFAULT NULL,  
38 -// 'PARSER_FIELD_ADD_BOX' int(3) unsigned DEFAULT NULL,  
39 -// 'PARSER_FIELD_GROUP_RG' int(3) unsigned DEFAULT NULL,  
40 -// 'PARSER_FIELD_SIGN' varchar(1) NOT NULL DEFAULT '',  
41 -// 'PARSER_FIELD_MULTIPLIER' float(8,2) unsigned DEFAULT NULL,  
42 -// 'price_date_update' varchar(15) NOT NULL,  
43 -// PRIMARY KEY ('id'),  
44 -// UNIQUE KEY 'code' ('code'),  
45 -// UNIQUE KEY 'name' ('name'),  
46 -// KEY 'active' ('active')  
47 -// ) ENGINE=InnoDB DEFAULT CHARSET=utf8  
48 -  
49 $this->createTable('{{%importer}}', [ 15 $this->createTable('{{%importer}}', [
50 'id' => $this->primaryKey(6)->notNull() . ' AUTO_INCREMENT', 16 'id' => $this->primaryKey(6)->notNull() . ' AUTO_INCREMENT',
51 'code' =>'varchar(254) NOT NULL', 17 'code' =>'varchar(254) NOT NULL',
@@ -81,7 +47,6 @@ class m150831_130250_addImporters extends Migration @@ -81,7 +47,6 @@ class m150831_130250_addImporters extends Migration
81 { 47 {
82 $this->dropTable('{{%importer}}'); 48 $this->dropTable('{{%importer}}');
83 49
84 - return false;  
85 } 50 }
86 51
87 /* 52 /*
console/migrations/m150901_135806_addImportersFiles.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Schema;
  4 +use yii\db\Migration;
  5 +
  6 +class m150901_135806_addImportersFiles extends Migration
  7 +{
  8 + public function up()
  9 + {
  10 + $tableOptions = null;
  11 + if ($this->db->driverName === 'mysql') {
  12 + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
  13 + }
  14 +
  15 + $this->createTable('{{%importer_files}}', [
  16 + 'id' => $this->primaryKey(10)->notNull() . ' AUTO_INCREMENT',
  17 + 'importer_id' => 'int(6) unsigned NOT NULL',
  18 + 'upload_time' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',
  19 + 'time_start' => 'timestamp NULL DEFAULT NULL',
  20 + 'time_end' => 'timestamp NULL DEFAULT NULL',
  21 + ], $tableOptions);
  22 +
  23 +
  24 + $this->createIndex('importer_id', '{{%importer_files}}', 'importer_id, time_start', false);
  25 + }
  26 +
  27 + public function down()
  28 + {
  29 + $this->dropTable('{{%importer_files}}');
  30 + }
  31 +
  32 + /*
  33 + // Use safeUp/safeDown to run migration code within a transaction
  34 + public function safeUp()
  35 + {
  36 + }
  37 +
  38 + public function safeDown()
  39 + {
  40 + }
  41 + */
  42 +}
console/migrations/m150901_141850_addImportersPrefix.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Schema;
  4 +use yii\db\Migration;
  5 +
  6 +class m150901_141850_addImportersPrefix extends Migration
  7 +{
  8 + public function up()
  9 + {
  10 + $tableOptions = null;
  11 + if ($this->db->driverName === 'mysql') {
  12 + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
  13 + }
  14 +
  15 + $this->createTable('{{%importer_prefix}}', [
  16 + 'id' => $this->primaryKey(10)->notNull() . ' AUTO_INCREMENT',
  17 + 'importer_id' => 'int(6) unsigned NOT NULL',
  18 + 'brand' => 'varchar(100) NOT NULL',
  19 + 'prefix' => 'varchar(50) NOT NULL',
  20 + 'timestamp' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',
  21 + ], $tableOptions);
  22 +
  23 + $this->createIndex('importer_id', '{{%importer_prefix}}', 'importer_id, brand, prefix', true);
  24 + }
  25 +
  26 + public function down()
  27 + {
  28 + $this->dropTable('{{%importer_prefix}}');
  29 + }
  30 +
  31 + /*
  32 + // Use safeUp/safeDown to run migration code within a transaction
  33 + public function safeUp()
  34 + {
  35 + }
  36 +
  37 + public function safeDown()
  38 + {
  39 + }
  40 + */
  41 +}