From 7fa3b699c1d6f28ee6a141329f82a469c4b67133 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 27 Nov 2013 23:44:49 +0400 Subject: [PATCH] Adjusted advanced app migration so it is now OK for non-mysql --- .../console/migrations/m130524_201442_init.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/advanced/console/migrations/m130524_201442_init.php b/apps/advanced/console/migrations/m130524_201442_init.php index 1315d8d..a5935be 100644 --- a/apps/advanced/console/migrations/m130524_201442_init.php +++ b/apps/advanced/console/migrations/m130524_201442_init.php @@ -6,19 +6,21 @@ class m130524_201442_init extends \yii\db\Migration { public function up() { - // MySQL-specific table options. Adjust if you plan working with another DBMS - $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; + $tableOptions = null; + if ($this->db->driverName === 'mysql') { + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; + } $this->createTable('tbl_user', [ 'id' => Schema::TYPE_PK, - 'username' => Schema::TYPE_STRING.' NOT NULL', - 'auth_key' => Schema::TYPE_STRING.'(32) NOT NULL', - 'password_hash' => Schema::TYPE_STRING.' NOT NULL', - 'password_reset_token' => Schema::TYPE_STRING.'(32)', - 'email' => Schema::TYPE_STRING.' NOT NULL', - 'role' => 'tinyint NOT NULL DEFAULT 10', + 'username' => Schema::TYPE_STRING . ' NOT NULL', + 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', + 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', + 'password_reset_token' => Schema::TYPE_STRING . '(32)', + 'email' => Schema::TYPE_STRING . ' NOT NULL', + 'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', - 'status' => 'tinyint NOT NULL DEFAULT 10', + 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 'create_time' => Schema::TYPE_INTEGER.' NOT NULL', 'update_time' => Schema::TYPE_INTEGER.' NOT NULL', ], $tableOptions);