加载第三方扩展,
composer require dmstr/yii2-adminlte-asset "2.*" composer require mdmsoft/yii2-admin "~2.0"
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT "自增ID",
`username` varchar(255) NOT NULL COMMENT "用户名",
`auth_key` varchar(32) NOT NULL COMMENT "自动登录key",
`password_hash` varchar(255) NOT NULL COMMENT "加密密码",
`password_reset_token` varchar(255) DEFAULT NULL COMMENT "重置密码token",
`email` varchar(255) NOT NULL COMMENT "邮箱",
`role` smallint(6) NOT NULL DEFAULT "10" COMMENT "角色等级",
`status` smallint(6) NOT NULL DEFAULT "10" COMMENT "状态",
`created_at` int(11) NOT NULL COMMENT "创建时间",
`updated_at` int(11) NOT NULL COMMENT "更新时间",
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT="用户表";
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;
drop table if exists `auth_assignment`;
drop table if exists `auth_item_child`;
drop table if exists `auth_item`;
drop table if exists `auth_rule`;
create table `auth_rule`
(
`name` varchar(64) not null,
`data` text,
`created_at` integer,
`updated_at` integer,
primary key (`name`)
) engine InnoDB;
create table `auth_item`
(
`name` varchar(64) not null,
`type` integer not null,
`description` text,
`rule_name` varchar(64),
`data` text,
`created_at` integer,
`updated_at` integer,
primary key (`name`),
foreign key (`rule_name`) references `auth_rule` (`name`) on delete set null on update cascade,
key `type` (`type`)
) engine InnoDB;
create table `auth_item_child`
(
`parent` varchar(64) not null,
`child` varchar(64) not null,
primary key (`parent`, `child`),
foreign key (`parent`) references `auth_item` (`name`) on delete cascade on update cascade,
foreign key (`child`) references `auth_item` (`name`) on delete cascade on update cascade
) engine InnoDB;
create table `auth_assignment`
(
`item_name` varchar(64) not null,
`user_id` varchar(64) not null,
`created_at` integer,
primary key (`item_name`, `user_id`),
foreign key (`item_name`) references `auth_item` (`name`) on delete cascade on update cascade
) engine InnoDB;
原文:https://www.cnblogs.com/huay/p/10504390.html