...
create table shiro_role
(
id bigint generated by default as identity,
version bigint not null,
name varchar(255) not null,
primary key (id)
);
create table shiro_role_permissions
(
shiro_role_id bigint not null,
permissions_string varchar(255)
);
create table shiro_user
(
id bigint generated by default as identity,
version bigint not null,
password_hash varchar(255) not null,
username varchar(255) not null,
primary key (id)
);
create table shiro_user_permissions
(
shiro_user_id bigint not null,
permissions_string varchar(255)
);
create table shiro_user_roles
(
shiro_user_id bigint not null,
shiro_role_id bigint not null,
primary key (shiro_user_id, shiro_role_id)
);
alter table shiro_role
add constraint UK_lw6fmfwdi0t4yj2lhitnqwg7b unique (name);
alter table shiro_user
add constraint UK_36q32iu69w58sanmqioxbf2g1 unique (username);
alter table shiro_role_permissions
add constraint FK61ryfys5gb5404ddi4daoh0u4 foreign key (shiro_role_id) references shiro_role;
alter table shiro_user_permissions
add constraint FK7pcseg2cff0ap8j438va1h3kq foreign key (shiro_user_id) references shiro_user;
alter table shiro_user_roles
add constraint FKhgfeccfx4974oqrtj9krqmx7d foreign key (shiro_role_id) references shiro_role;
alter table shiro_user_roles
add constraint FK24x73ttu3pwsq9f3pr0qcptn9 foreign key (shiro_user_id) references shiro_user;