File tree 8 files changed +175
-154
lines changed 8 files changed +175
-154
lines changed Original file line number Diff line number Diff line change 37
37
]
38
38
],
39
39
```
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
+ ```
40
49
41
50
* ** 添加路由配置**
42
51
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use yii \db \Migration ;
4
3
use wind \rest \components \Configs ;
5
4
6
5
/**
9
8
* @author Misbahul D Munir <[email protected] >
10
9
* @since 1.0
11
10
*/
12
- class m140602_111327_create_menu_table extends Migration
11
+ class m140602_111327_create_menu_table extends \ yii \ db \ Migration
13
12
{
14
13
15
14
/**
Original file line number Diff line number Diff line change
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
+ );
Original file line number Diff line number Diff line change
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;
Original file line number Diff line number Diff line change
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
+ );
Original file line number Diff line number Diff line change
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
+ );
Original file line number Diff line number Diff line change
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
+ );
You can’t perform that action at this time.
0 commit comments