m160930_100954_create_seo_lang_table.php
3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
use yii\db\Migration;
/**
* Handles the creation for table `seo_lang`.
*/
class m160930_100954_create_seo_lang_table extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
$this->createTable('seo_lang', [
'seo_id' => $this->integer()
->notNull(),
'language_id' => $this->integer()
->notNull(),
'title' => $this->string(),
'description' => $this->text(),
'h1' => $this->string(),
'meta' => $this->string(),
'seo_text' => $this->text(),
]);
$this->createIndex('seo_lang_seo_language_key', 'seo_lang', [
'seo_id',
'language_id',
], true);
$this->addForeignKey('seo_fk', 'seo_lang', 'seo_id', 'seo', 'seo_id', 'CASCADE', 'CASCADE');
$this->addForeignKey('language_fk', 'seo_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE');
$this->createTable('seo_category_lang', [
'seo_category_id' => $this->integer()
->notNull(),
'language_id' => $this->integer()
->notNull(),
'name' => $this->string(),
]);
$this->createIndex('seo_category_lang_seo_category_language_key', 'seo_category_lang', [
'seo_category_id',
'language_id',
], true);
$this->addForeignKey('seo_category_fk', 'seo_category_lang', 'seo_category_id', 'seo_category', 'seo_category_id', 'CASCADE', 'CASCADE');
$this->addForeignKey('language_fk', 'seo_category_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE');
$this->createTable('seo_dynamic_lang', [
'seo_dynamic_id' => $this->integer()
->notNull(),
'language_id' => $this->integer()
->notNull(),
'name' => $this->string(),
'title' => $this->text(),
'h1' => $this->string(),
'key' => $this->string(),
'meta' => $this->string(),
'description' => $this->text(),
'seo_text' => $this->text(),
]);
$this->createIndex('seo_dynamic_lang_seo_dynamic_language_key', 'seo_dynamic_lang', [
'seo_dynamic_id',
'language_id',
], true);
$this->addForeignKey('seo_dynamic_fk', 'seo_dynamic_lang', 'seo_dynamic_id', 'seo_dynamic', 'seo_dynamic_id', 'CASCADE', 'CASCADE');
$this->addForeignKey('language_fk', 'seo_dynamic_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE');
}
/**
* @inheritdoc
*/
public function down()
{
$this->dropTable('seo_lang');
$this->dropTable('seo_category_lang');
$this->dropTable('seo_dynamic_lang');
}
}