yii2-test-1/console/migrations/m230503_111312_create_news_table.php

31 lines
563 B
PHP
Raw Permalink Normal View History

2023-05-06 20:40:02 +03:00
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%news}}`.
*/
class m230503_111312_create_news_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%news}}', [
'id' => $this->primaryKey(),
'title' => $this->string(),
'text' => $this->text(),
'slug' => $this->string()->unique()
]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('{{%news}}');
}
}