31 lines
884 B
PHP
31 lines
884 B
PHP
|
<?php
|
||
|
|
||
|
use common\components\Migration\MigrationWithDefaultOptions;
|
||
|
|
||
|
class m140703_123104_page extends MigrationWithDefaultOptions
|
||
|
{
|
||
|
public function up()
|
||
|
{
|
||
|
$tableOptions = null;
|
||
|
if ($this->db->driverName === 'mysql') {
|
||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||
|
}
|
||
|
|
||
|
$this->createTable('{{%page}}', [
|
||
|
'id' => $this->primaryKey(),
|
||
|
'slug' => $this->string(2048)->notNull(),
|
||
|
'title' => $this->string(512)->notNull(),
|
||
|
'body' => $this->text()->notNull(),
|
||
|
'view' => $this->string(),
|
||
|
'status' => $this->smallInteger()->notNull(),
|
||
|
'created_at' => $this->integer(),
|
||
|
'updated_at' => $this->integer(),
|
||
|
], $tableOptions);
|
||
|
}
|
||
|
|
||
|
public function down()
|
||
|
{
|
||
|
$this->dropTable('{{%page}}');
|
||
|
}
|
||
|
}
|