-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from windhoney/develop
Develop
- Loading branch information
Showing
9 changed files
with
261 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
use wind\rest\components\Configs; | ||
|
||
/** | ||
* Migration table of table_menu | ||
* | ||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | ||
* @since 1.0 | ||
*/ | ||
class m140602_111327_create_menu_table extends \yii\db\Migration | ||
{ | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function up() | ||
{ | ||
$menuTable = Configs::instance()->menuTable; | ||
$tableOptions = null; | ||
if ($this->db->driverName === 'mysql') { | ||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; | ||
} | ||
|
||
$this->createTable($menuTable, [ | ||
'id' => $this->primaryKey(), | ||
'name' => $this->string(128)->notNull(), | ||
'parent' => $this->integer(), | ||
'route' => $this->string(), | ||
'order' => $this->integer(), | ||
'data' => $this->binary(), | ||
"FOREIGN KEY ([[parent]]) REFERENCES {$menuTable}([[id]]) ON DELETE SET NULL ON UPDATE CASCADE", | ||
], $tableOptions); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function down() | ||
{ | ||
$this->dropTable(Configs::instance()->menuTable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
use yii\db\Migration; | ||
use wind\rest\components\Configs; | ||
|
||
class m160312_050000_create_user extends Migration | ||
{ | ||
|
||
public function up() | ||
{ | ||
$tableOptions = null; | ||
if ($this->db->driverName === 'mysql') { | ||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci | ||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; | ||
} | ||
|
||
$userTable = Configs::instance()->userTable; | ||
|
||
// Check if the table exists | ||
if ($this->db->schema->getTableSchema($userTable, true) === null) { | ||
$this->createTable($userTable, [ | ||
'id' => $this->primaryKey(), | ||
'username' => $this->string(32)->notNull(), | ||
'auth_key' => $this->string(32)->notNull(), | ||
'password_hash' => $this->string()->notNull(), | ||
'password_reset_token' => $this->string(), | ||
'email' => $this->string()->notNull(), | ||
'status' => $this->smallInteger()->notNull()->defaultValue(10), | ||
'created_at' => $this->integer()->notNull(), | ||
'updated_at' => $this->integer()->notNull(), | ||
], $tableOptions); | ||
} | ||
} | ||
|
||
public function down() | ||
{ | ||
$userTable = Configs::instance()->userTable; | ||
if ($this->db->schema->getTableSchema($userTable, true) !== null) { | ||
$this->dropTable($userTable); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Database schema required by yii2-admin. | ||
* | ||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | ||
* @since 2.5 | ||
*/ | ||
|
||
drop table if exists [menu]; | ||
drop table if exists [user]; | ||
|
||
create table [menu] | ||
( | ||
[id] int IDENTITY PRIMARY KEY, | ||
[name] varchar(128), | ||
[parent] int(11), | ||
[route] varchar(256), | ||
[order] int(11), | ||
[data] text, | ||
foreign key (parent) references [menu]([id]) ON DELETE SET NULL ON UPDATE CASCADE | ||
); | ||
|
||
create table [user] | ||
( | ||
[id] int IDENTITY PRIMARY KEY, | ||
[username] varchar(32) NOT NULL, | ||
[auth_key] varchar(32) NOT NULL, | ||
[password_hash] varchar(256) NOT NULL, | ||
[password_reset_token] varchar(256), | ||
[email] varchar(256) NOT NULL, | ||
[status] integer not null default 10, | ||
[created_at] integer not null, | ||
[updated_at] integer not null | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Database schema required by yii2-admin. | ||
* | ||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | ||
* @since 2.5 | ||
*/ | ||
|
||
drop table if exists `menu`; | ||
drop table if exists `user` cascade; | ||
|
||
create table `menu` | ||
( | ||
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
`name` varchar(128), | ||
`parent` int(11), | ||
`route` varchar(256), | ||
`order` int(11), | ||
`data` blob, | ||
foreign key (`parent`) references `menu`(`id`) ON DELETE SET NULL ON UPDATE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
||
create table `user` | ||
( | ||
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
`username` varchar(32) NOT NULL, | ||
`auth_key` varchar(32) NOT NULL, | ||
`password_hash` varchar(256) NOT NULL, | ||
`password_reset_token` varchar(256), | ||
`email` varchar(256) NOT NULL, | ||
`status` integer not null default 10, | ||
`created_at` integer not null, | ||
`updated_at` integer not null | ||
)ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Database schema required by yii2-admin. | ||
* | ||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | ||
* @since 2.5 | ||
*/ | ||
|
||
drop table if exists "menu"; | ||
drop table if exists "user"; | ||
|
||
create table "menu" | ||
( | ||
"id" NUMBER(10) NOT NULL PRIMARY KEY, | ||
"name" varchar(128), | ||
"parent" number(10), | ||
"route" varchar(256), | ||
"order" number(10), | ||
"data" BYTEA, | ||
foreign key (parent) references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE | ||
); | ||
|
||
create table "user" | ||
( | ||
"id" NUMBER(10) NOT NULL PRIMARY KEY, | ||
"username" varchar(32) NOT NULL, | ||
"auth_key" varchar(32) NOT NULL, | ||
"password_hash" varchar(256) NOT NULL, | ||
"password_reset_token" varchar(256), | ||
"email" varchar(256) NOT NULL, | ||
"status" integer not null default 10, | ||
"created_at" number(10) not null, | ||
"updated_at" number(10) not null | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Database schema required by yii2-admin. | ||
* | ||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | ||
* @since 2.5 | ||
*/ | ||
|
||
drop table if exists "menu"; | ||
drop table if exists "user"; | ||
|
||
create table "menu" | ||
( | ||
"id" serial NOT NULL PRIMARY KEY, | ||
"name" varchar(128), | ||
"parent" integer, | ||
"route" varchar(256), | ||
"order" integer, | ||
"data" bytea, | ||
foreign key ("parent") references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE | ||
); | ||
|
||
create table "user" | ||
( | ||
"id" serial NOT NULL PRIMARY KEY, | ||
"username" varchar(32) NOT NULL, | ||
"auth_key" varchar(32) NOT NULL, | ||
"password_hash" varchar(256) NOT NULL, | ||
"password_reset_token" varchar(256), | ||
"email" varchar(256) NOT NULL, | ||
"status" integer not null default 10, | ||
"created_at" integer not null, | ||
"updated_at" integer not null | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Database schema required by yii2-admin. | ||
* | ||
* @author Misbahul D Munir <misbahuldmunir@gmail.com> | ||
* @since 2.5 | ||
*/ | ||
|
||
drop table if exists "menu"; | ||
drop table if exists "user"; | ||
|
||
create table "menu" | ||
( | ||
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
"name" varchar(128), | ||
"parent" int(11), | ||
"route" varchar(256), | ||
"order" int(11), | ||
"data" LONGBLOB, | ||
foreign key ("parent") references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE | ||
); | ||
|
||
create table "user" | ||
( | ||
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
"username" varchar(32) NOT NULL, | ||
"auth_key" varchar(32) NOT NULL, | ||
"password_hash" varchar(256) NOT NULL, | ||
"password_reset_token" varchar(256), | ||
"email" varchar(256) NOT NULL, | ||
"status" integer not null default 10, | ||
"created_at" integer not null, | ||
"updated_at" integer not null | ||
); |