Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

create table role (
  id int not null auto_increment,
  authority varchar(255) not null,
  unique(authority),
  primary key(id)
) Engine=InnoDB;

insert into role (authority) values ("ROLE_ADMIN");
insert into role (authority) values ("ROLE_USER");

create table user_role (
  
  
  
  role_id int not null,
  user_id int not null,
  primary key(role_id, user_id),
  FOREIGN KEY (role_id) REFERENCES role(id) ON DELETE CASCADE,
  FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE
) Engine=InnoDB;