Skip to content

Commit 2629a16

Browse files
committed
创建表
1 parent f8e4d77 commit 2629a16

8 files changed

+175
-154
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
]
3838
],
3939
```
40+
* **创建所需要的表**
41+
```
42+
//用户表user和菜单表menu
43+
yii migrate --migrationPath=@vendor/windhoney/yii2-rest-rbac/migrations
44+
//rbac相关权限表
45+
yii migrate --migrationPath=@yii/rbac/migrations/
46+
//oauth2相关表
47+
yii migrate --migrationPath=@vendor/filsh/yii2-oauth2-server/migrations
48+
```
4049

4150
* **添加路由配置**
4251

migrations/m140501_075311_add_oauth2_server.php

Lines changed: 0 additions & 152 deletions
This file was deleted.

migrations/m140602_111327_create_menu_table.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
use yii\db\Migration;
43
use wind\rest\components\Configs;
54

65
/**
@@ -9,7 +8,7 @@
98
* @author Misbahul D Munir <[email protected]>
109
* @since 1.0
1110
*/
12-
class m140602_111327_create_menu_table extends Migration
11+
class m140602_111327_create_menu_table extends \yii\db\Migration
1312
{
1413

1514
/**

migrations/schema-mssql.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Database schema required by yii2-admin.
3+
*
4+
* @author Misbahul D Munir <[email protected]>
5+
* @since 2.5
6+
*/
7+
8+
drop table if exists [menu];
9+
drop table if exists [user];
10+
11+
create table [menu]
12+
(
13+
[id] int IDENTITY PRIMARY KEY,
14+
[name] varchar(128),
15+
[parent] int(11),
16+
[route] varchar(256),
17+
[order] int(11),
18+
[data] text,
19+
foreign key (parent) references [menu]([id]) ON DELETE SET NULL ON UPDATE CASCADE
20+
);
21+
22+
create table [user]
23+
(
24+
[id] int IDENTITY PRIMARY KEY,
25+
[username] varchar(32) NOT NULL,
26+
[auth_key] varchar(32) NOT NULL,
27+
[password_hash] varchar(256) NOT NULL,
28+
[password_reset_token] varchar(256),
29+
[email] varchar(256) NOT NULL,
30+
[status] integer not null default 10,
31+
[created_at] integer not null,
32+
[updated_at] integer not null
33+
);

migrations/schema-mysql.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Database schema required by yii2-admin.
3+
*
4+
* @author Misbahul D Munir <[email protected]>
5+
* @since 2.5
6+
*/
7+
8+
drop table if exists `menu`;
9+
drop table if exists `user` cascade;
10+
11+
create table `menu`
12+
(
13+
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
14+
`name` varchar(128),
15+
`parent` int(11),
16+
`route` varchar(256),
17+
`order` int(11),
18+
`data` blob,
19+
foreign key (`parent`) references `menu`(`id`) ON DELETE SET NULL ON UPDATE CASCADE
20+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21+
22+
create table `user`
23+
(
24+
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
25+
`username` varchar(32) NOT NULL,
26+
`auth_key` varchar(32) NOT NULL,
27+
`password_hash` varchar(256) NOT NULL,
28+
`password_reset_token` varchar(256),
29+
`email` varchar(256) NOT NULL,
30+
`status` integer not null default 10,
31+
`created_at` integer not null,
32+
`updated_at` integer not null
33+
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

migrations/schema-oci.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Database schema required by yii2-admin.
3+
*
4+
* @author Misbahul D Munir <[email protected]>
5+
* @since 2.5
6+
*/
7+
8+
drop table if exists "menu";
9+
drop table if exists "user";
10+
11+
create table "menu"
12+
(
13+
"id" NUMBER(10) NOT NULL PRIMARY KEY,
14+
"name" varchar(128),
15+
"parent" number(10),
16+
"route" varchar(256),
17+
"order" number(10),
18+
"data" BYTEA,
19+
foreign key (parent) references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE
20+
);
21+
22+
create table "user"
23+
(
24+
"id" NUMBER(10) NOT NULL PRIMARY KEY,
25+
"username" varchar(32) NOT NULL,
26+
"auth_key" varchar(32) NOT NULL,
27+
"password_hash" varchar(256) NOT NULL,
28+
"password_reset_token" varchar(256),
29+
"email" varchar(256) NOT NULL,
30+
"status" integer not null default 10,
31+
"created_at" number(10) not null,
32+
"updated_at" number(10) not null
33+
);

migrations/schema-pgsql.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Database schema required by yii2-admin.
3+
*
4+
* @author Misbahul D Munir <[email protected]>
5+
* @since 2.5
6+
*/
7+
8+
drop table if exists "menu";
9+
drop table if exists "user";
10+
11+
create table "menu"
12+
(
13+
"id" serial NOT NULL PRIMARY KEY,
14+
"name" varchar(128),
15+
"parent" integer,
16+
"route" varchar(256),
17+
"order" integer,
18+
"data" bytea,
19+
foreign key ("parent") references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE
20+
);
21+
22+
create table "user"
23+
(
24+
"id" serial NOT NULL PRIMARY KEY,
25+
"username" varchar(32) NOT NULL,
26+
"auth_key" varchar(32) NOT NULL,
27+
"password_hash" varchar(256) NOT NULL,
28+
"password_reset_token" varchar(256),
29+
"email" varchar(256) NOT NULL,
30+
"status" integer not null default 10,
31+
"created_at" integer not null,
32+
"updated_at" integer not null
33+
);

migrations/schema-sqlite.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Database schema required by yii2-admin.
3+
*
4+
* @author Misbahul D Munir <[email protected]>
5+
* @since 2.5
6+
*/
7+
8+
drop table if exists "menu";
9+
drop table if exists "user";
10+
11+
create table "menu"
12+
(
13+
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
14+
"name" varchar(128),
15+
"parent" int(11),
16+
"route" varchar(256),
17+
"order" int(11),
18+
"data" LONGBLOB,
19+
foreign key ("parent") references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE
20+
);
21+
22+
create table "user"
23+
(
24+
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
25+
"username" varchar(32) NOT NULL,
26+
"auth_key" varchar(32) NOT NULL,
27+
"password_hash" varchar(256) NOT NULL,
28+
"password_reset_token" varchar(256),
29+
"email" varchar(256) NOT NULL,
30+
"status" integer not null default 10,
31+
"created_at" integer not null,
32+
"updated_at" integer not null
33+
);

0 commit comments

Comments
 (0)