Browse Source

00063 Oauth table add index ; upgrade sql

0.4-beta
Li Shengzhao 9 years ago
parent
commit
a05ef22ebf
  1. 31
      others/database/initial_db.ddl
  2. 58
      others/database/oauth.ddl

31
others/database/initial_db.ddl

@ -13,18 +13,18 @@
-- Domain: User
-- ###############
Drop table if exists user_;
CREATE TABLE `user_` (
`id` int(11) NOT NULL auto_increment,
`guid` varchar(255) not null unique,
`create_time` datetime ,
`archived` tinyint(1) default '0',
`email` varchar(255),
`password` varchar(255) not null,
`phone` varchar(255),
`username` varchar(255) not null unique,
`default_user` tinyint(1) default '0',
`last_login_time` datetime ,
PRIMARY KEY (`id`)
CREATE TABLE user_ (
id int(11) NOT NULL auto_increment,
guid varchar(255) not null unique,
create_time datetime ,
archived tinyint(1) default '0',
email varchar(255),
password varchar(255) not null,
phone varchar(255),
username varchar(255) not null unique,
default_user tinyint(1) default '0',
last_login_time datetime ,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
@ -32,8 +32,9 @@ CREATE TABLE `user_` (
-- Domain: Privilege
-- ###############
Drop table if exists user_privilege;
CREATE TABLE `user_privilege` (
`user_id` int(11),
`privilege` varchar(255)
CREATE TABLE user_privilege (
user_id int(11),
privilege varchar(255),
KEY user_id_index (user_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

58
others/database/oauth.ddl

@ -5,58 +5,62 @@
Drop table if exists oauth_client_details;
create table oauth_client_details (
client_id VARCHAR(255) PRIMARY KEY,
resource_ids VARCHAR(256),
client_secret VARCHAR(256),
scope VARCHAR(256),
authorized_grant_types VARCHAR(256),
web_server_redirect_uri VARCHAR(256),
authorities VARCHAR(256),
resource_ids VARCHAR(255),
client_secret VARCHAR(255),
scope VARCHAR(255),
authorized_grant_types VARCHAR(255),
web_server_redirect_uri VARCHAR(255),
authorities VARCHAR(255),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
additional_information VARCHAR(4096),
additional_information TEXT,
create_time timestamp default now(),
archived tinyint(1) default '0',
trusted tinyint(1) default '0',
autoapprove VARCHAR (255) default 'false'
);
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Drop table if exists oauth_client_token;
create table oauth_client_token (
create_time timestamp default now(),
token_id VARCHAR(256),
token BLOB,
authentication_id VARCHAR(256),
user_name VARCHAR(256),
client_id VARCHAR(256)
);
Drop table if exists oauth_access_token;
create table oauth_access_token (
create_time timestamp default now(),
token_id VARCHAR(256),
token_id VARCHAR(255),
token BLOB,
authentication_id VARCHAR(256),
user_name VARCHAR(256),
client_id VARCHAR(256),
authentication_id VARCHAR(255),
user_name VARCHAR(255),
client_id VARCHAR(255),
authentication BLOB,
refresh_token VARCHAR(256)
);
refresh_token VARCHAR(255)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Drop table if exists oauth_refresh_token;
create table oauth_refresh_token (
create_time timestamp default now(),
token_id VARCHAR(256),
token_id VARCHAR(255),
token BLOB,
authentication BLOB
);
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Drop table if exists oauth_code;
create table oauth_code (
create_time timestamp default now(),
code VARCHAR(256),
code VARCHAR(255),
authentication BLOB
);
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Add indexes
create index token_id_index on oauth_access_token (token_id);
create index authentication_id_index on oauth_access_token (authentication_id);
create index user_name_index on oauth_access_token (user_name);
create index client_id_index on oauth_access_token (client_id);
create index refresh_token_index on oauth_access_token (refresh_token);
create index token_id_index on oauth_refresh_token (token_id);
create index code_index on oauth_code (code);

Loading…
Cancel
Save