-- ----------------------------------------------------------
-- Version: 20190915062355000
-- ----------------------------------------------------------
CREATE TABLE `service` (
`serviceid` VARCHAR(32) NOT NULL DEFAULT '',
`name` VARCHAR(100) NOT NULL DEFAULT '',
`url` VARCHAR(500) NOT NULL DEFAULT '',
`secret` VARCHAR(32) NOT NULL DEFAULT '',
`offical` TINYINT NOT NULL DEFAULT 0,
`createtime` BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (`serviceid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `user_authorize` (
`authorizeid` VARCHAR(32) NOT NULL DEFAULT '',
`serviceid` VARCHAR(32) NOT NULL DEFAULT '',
`tokenid` VARCHAR(32) NOT NULL DEFAULT '',
`code` VARCHAR(32) NOT NULL DEFAULT '',
`userid` VARCHAR(32) NOT NULL DEFAULT '',
`createtime` BIGINT NOT NULL DEFAULT 0,
`invalid` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`authorizeid`,`serviceid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `user` (
`userid` VARCHAR(32) NOT NULL DEFAULT '',
`username` VARCHAR(50) NOT NULL DEFAULT '',
`nickname` VARCHAR(50) NOT NULL DEFAULT '',
`mobile_prefix` SMALLINT NOT NULL DEFAULT 0,
`mobile` VARCHAR(11) NOT NULL DEFAULT '',
`password` VARCHAR(32) NOT NULL DEFAULT '',
`password_salt` SMALLINT NOT NULL DEFAULT 0,
`createtime` BIGINT NOT NULL DEFAULT 0,
`updatetime` BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (`userid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `verifycode` (
`id` VARCHAR(32) NOT NULL DEFAULT '',
`mobile_prefix` SMALLINT NOT NULL DEFAULT 0,
`mobile` VARCHAR(11) NOT NULL DEFAULT '',
`code` CHAR(10) NOT NULL DEFAULT '',
`createtime` BIGINT NOT NULL DEFAULT 0,
`invalid` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


-- ----------------------------------------------------------
-- Version: 20190915062509000
-- ----------------------------------------------------------

-- ----------------------------------------------------------
-- Version: 20190915155507000
-- ----------------------------------------------------------
ALTER TABLE `user` ADD COLUMN `admin` TINYINT NOT NULL DEFAULT 0;


