portal.mkgtu.ru/common/migrations/db/m140703_123104_page.php

31 lines
884 B
PHP
Raw Permalink Normal View History

2024-03-28 09:51:45 +03:00
<?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}}');
}
}