Test Setup Failed
Push — master ( 98c27d...1630af )
by Wilmer
02:51
created

m130524_201442_init::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view the LICENSE.md
5
 * file that was distributed with this source code.
6
 *
7
 *        @link: https://github.com/terabytesoft/app-basic
8
 *      @author: Wilmer Arámbula <[email protected]>
9
 *   @copyright: (c) TERABYTE SOFTWARE SA
10
 *  @migrations: [m130524_201442_init]
11
 *       @since: 0.0.1
12
 *         @yii: 3.0
13
 **/
14
15
namespace app\basic\commands\migrations;
16
17
use yii\db\Migration;
18
19
class m130524_201442_init extends Migration
20
{
21
	public function up()
22
	{
23
		$tableOptions = null;
24
25
		if ($this->db->driverName === 'mysql') {
26
			// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
27
			$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
28
		}
29
30
		$this->createTable('{{%user}}', [
31
			'id' => $this->primaryKey(),
32
			'username' => $this->string()->notNull()->unique(),
33
			'auth_key' => $this->string(32)->notNull(),
34
			'password_hash' => $this->string()->notNull(),
35
			'password_reset_token' => $this->string()->unique(),
36
			'email' => $this->string()->notNull()->unique(),
37
			'status' => $this->smallInteger()->notNull()->defaultValue(10),
38
			'created_at' => $this->integer()->notNull(),
39
			'updated_at' => $this->integer()->notNull(),
40
		], $tableOptions);
41
	}
42
43
	public function down()
44
	{
45
		$this->dropTable('{{%user}}');
46
	}
47
}
48