Last active
May 19, 2017 09:19
-
-
Save martins-giberts/ec5c194c99de488a43945208ce03ad5d to your computer and use it in GitHub Desktop.
Migration file for SeoText localization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use yii\db\Migration; | |
use yii\db\Schema; | |
use app\modules\admin\models\SeoText; | |
class add_seo_localization extends Migration | |
{ | |
public $engine = 'ENGINE=MyISAM DEFAULT CHARSET=utf8'; | |
public $table_name = 'easyii_seotext_lang'; | |
public function up() { | |
$this->createTable($this->table_name, [ | |
'id' => 'pk', | |
'parent_id' => Schema::TYPE_INTEGER, | |
'language' => Schema::TYPE_STRING . '(6) NOT NULL', | |
'h1' => Schema::TYPE_STRING . '(255) NOT NULL', | |
'title' => Schema::TYPE_STRING . '(255) NOT NULL', | |
'keywords' => Schema::TYPE_STRING . '(255) NOT NULL', | |
'description' => Schema::TYPE_TEXT . ' DEFAULT NULL', | |
], $this->engine); | |
$this->createIndex('parent_id', $this->table_name, 'parent_id'); | |
$this->createIndex('language', $this->table_name, 'language'); | |
$this->dropColumn(SeoText::tableName(), 'h1'); | |
$this->dropColumn(SeoText::tableName(), 'title'); | |
$this->dropColumn(SeoText::tableName(), 'keywords'); | |
$this->dropColumn(SeoText::tableName(), 'description'); | |
} | |
public function down() { | |
$this->dropTable($this->table_name); | |
$this->addColumn(SeoText::tableName(), 'h1', Schema::TYPE_STRING . '(255) NOT NULL'); | |
$this->addColumn(SeoText::tableName(), 'title', Schema::TYPE_STRING . '(255) NOT NULL'); | |
$this->addColumn(SeoText::tableName(), 'keywords', Schema::TYPE_STRING . '(255) NOT NULL'); | |
$this->addColumn(SeoText::tableName(), 'description', Schema::TYPE_TEXT . ' DEFAULT NULL'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#noumo/easyii#102