d55d2fe0
Yarik
Multilanguage
|
1
2
3
4
5
|
<?php
use yii\db\Migration;
/**
|
f202ab2b
Yarik
Article table ref...
|
6
|
* Handles the creation for table `article_lang`.
|
d55d2fe0
Yarik
Multilanguage
|
7
|
*/
|
f202ab2b
Yarik
Article table ref...
|
8
|
class m160926_122456_create_article_lang_table extends Migration
|
d55d2fe0
Yarik
Multilanguage
|
9
10
11
12
13
14
15
|
{
/**
* @inheritdoc
*/
public function up()
{
|
f202ab2b
Yarik
Article table ref...
|
16
17
|
$this->createTable('article_lang', [
'article_id' => $this->integer()
|
d55d2fe0
Yarik
Multilanguage
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
->notNull(),
'language_id' => $this->integer()
->notNull(),
'title' => $this->string()
->notNull(),
'body' => $this->text()
->notNull(),
'meta_title' => $this->string(),
'meta_keywords' => $this->string(),
'meta_description' => $this->string(),
'seo_text' => $this->text(),
'h1' => $this->string(),
'body_preview' => $this->text(),
]);
|
f202ab2b
Yarik
Article table ref...
|
33
34
|
$this->createIndex('article_lang_article_language_key', 'article_lang', [
'article_id',
|
d55d2fe0
Yarik
Multilanguage
|
35
36
37
|
'language_id',
], true);
|
f202ab2b
Yarik
Article table ref...
|
38
|
$this->addForeignKey('article_fk', 'article_lang', 'article_id', 'article', 'id', 'CASCADE', 'CASCADE');
|
8af13427
Yarik
For leha commit.
|
39
|
$this->addForeignKey('language_fk', 'articles_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE');
|
d55d2fe0
Yarik
Multilanguage
|
40
41
42
43
44
45
46
|
}
/**
* @inheritdoc
*/
public function down()
{
|
f202ab2b
Yarik
Article table ref...
|
47
|
$this->dropTable('article_lang');
|
d55d2fe0
Yarik
Multilanguage
|
48
49
|
}
}
|