Stay Hungry , Stay Foolish

君子生非异也,善假于物也

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
DROP DATABASE IF EXISTS flaskweb;

CREATE DATABASE flaskweb;

USE flaskweb;

GRANT ALL PRIVILEGES ON flaskweb.* TO 'flaskweb'@'localhost' IDENTIFIED BY 'flaskweb';

CREATE TABLE `roles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(64) DEFAULT NULL,
  `role_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ix_users_username` (`username`),
  KEY `role_id` (`role_id`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
posted on 2017-08-14 12:26  octocat  阅读(783)  评论(0编辑  收藏  举报