Commit 28c18050d1e66cfdb8193b521ac2fa331819d03a
1 parent
1755c393
Basic migrations
Showing
1 changed file
with
0 additions
and
33 deletions
Show diff stats
console/migrations/m130524_201442_init.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\db\Migration; | |
4 | - | |
5 | -class m130524_201442_init extends Migration | |
6 | -{ | |
7 | - public function up() | |
8 | - { | |
9 | - $tableOptions = null; | |
10 | - if ($this->db->driverName === 'mysql') { | |
11 | - // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci | |
12 | - $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; | |
13 | - } | |
14 | - | |
15 | - $this->createTable('{{%user}}', [ | |
16 | - 'id' => $this->primaryKey(), | |
17 | - 'username' => $this->string()->notNull()->unique(), | |
18 | - 'auth_key' => $this->string(32)->notNull(), | |
19 | - 'password_hash' => $this->string()->notNull(), | |
20 | - 'password_reset_token' => $this->string()->unique(), | |
21 | - 'email' => $this->string()->notNull()->unique(), | |
22 | - | |
23 | - 'status' => $this->smallInteger()->notNull()->defaultValue(10), | |
24 | - 'created_at' => $this->integer()->notNull(), | |
25 | - 'updated_at' => $this->integer()->notNull(), | |
26 | - ], $tableOptions); | |
27 | - } | |
28 | - | |
29 | - public function down() | |
30 | - { | |
31 | - $this->dropTable('{{%user}}'); | |
32 | - } | |
33 | -} |