Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@calcio
Created March 24, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calcio/aa1a284de5e2c5dd84c181d91d4c4ec7 to your computer and use it in GitHub Desktop.
Save calcio/aa1a284de5e2c5dd84c181d91d4c4ec7 to your computer and use it in GitHub Desktop.
<?php
use yii\db\Migration;
/**
* Handles the creation of table `category`.
*/
class m170203_135455_create_categories_table extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
$this->createTable('categories', [
'id' => $this->primaryKey(),
'name' => $this->string(80)->notNull()->unique(),
'status' => $this->boolean()->notNull(),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
]);
}
/**
* @inheritdoc
*/
public function down()
{
$this->dropTable('categories');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment