Skip to content

Instantly share code, notes, and snippets.

@ggdio
Created September 17, 2013 20:01
Show Gist options
  • Save ggdio/6599790 to your computer and use it in GitHub Desktop.
Save ggdio/6599790 to your computer and use it in GitHub Desktop.
Spring Security DDL Commands for MySQL
create table users (
username varchar(50) not null primary key,
password varchar(50) not null,
enabled boolean not null
) engine = InnoDb;
create table authorities (
username varchar(50) not null,
authority varchar(50) not null,
foreign key (username) references users (username),
unique index authorities_idx_1 (username, authority)
) engine = InnoDb;
create table persistent_logins (
username varchar(64) not null,
series varchar(64) primary key,
token varchar(64) not null,
last_used timestamp not null
) engine = InnoDb;
create table groups (
id bigint unsigned not null auto_increment primary key,
group_name varchar(50) not null
) engine = InnoDb;
create table group_authorities (
group_id bigint unsigned not null,
authority varchar(50) not null,
foreign key (group_id) references groups (id)
) engine = InnoDb;
create table group_members (
id bigint unsigned not null auto_increment primary key,
username varchar(50) not null,
group_id bigint unsigned not null,
foreign key (group_id) references groups (id)
) engine = InnoDb;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment