|
1 | 1 |
|
2 |
| - alter table jwt_tokens |
| 2 | + alter table jwt_tokens |
3 | 3 | drop constraint FKhy6n4wirmw0ryw2wdmy9cx2mn;
|
4 | 4 |
|
5 |
| - alter table roles_permissions |
| 5 | + ALTER TABLE jwt_tokens_aud |
| 6 | + DROP CONSTRAINT FK6jp64i8dvuahfik6kui8prbjd; |
| 7 | + |
| 8 | + ALTER TABLE permissions_aud |
| 9 | + DROP CONSTRAINT FKbcjh1knyfnk51nv2cllrct4iw; |
| 10 | + |
| 11 | + ALTER TABLE roles_aud |
| 12 | + DROP CONSTRAINT FKt0mnl3rej2p0h9gxnbalf2kdd; |
| 13 | + |
| 14 | + alter table roles_permissions |
6 | 15 | drop constraint FKeqt383nibym26cjj8we4uar8h;
|
7 | 16 |
|
8 |
| - alter table roles_permissions |
| 17 | + alter table roles_permissions |
9 | 18 | drop constraint FKqi9odri6c1o81vjox54eedwyh;
|
10 | 19 |
|
11 |
| - alter table users_roles |
| 20 | + ALTER TABLE roles_permissions_aud |
| 21 | + DROP CONSTRAINT FKnofx22xg9kko3i1geh4jikive; |
| 22 | + |
| 23 | + ALTER TABLE users_aud |
| 24 | + DROP CONSTRAINT FKc4vk4tui2la36415jpgm9leoq; |
| 25 | + |
| 26 | + alter table users_roles |
12 | 27 | drop constraint FKa62j07k5mhgifpp955h37ponj;
|
13 | 28 |
|
14 |
| - alter table users_roles |
| 29 | + alter table users_roles |
15 | 30 | drop constraint FK2o0jvgh89lemvvo17cbqvdxaa;
|
16 | 31 |
|
| 32 | + ALTER TABLE users_roles_aud |
| 33 | + DROP CONSTRAINT FKktxqr55ntd0j2i228uj8sq6j9; |
| 34 | + |
17 | 35 | drop table if exists jwt_tokens cascade;
|
18 | 36 |
|
| 37 | + DROP TABLE IF EXISTS jwt_tokens_aud CASCADE; |
| 38 | + |
19 | 39 | drop table if exists permissions cascade;
|
20 | 40 |
|
| 41 | + DROP TABLE IF EXISTS permissions_aud CASCADE; |
| 42 | + |
| 43 | + DROP TABLE IF EXISTS revinfo CASCADE; |
| 44 | + |
21 | 45 | drop table if exists roles cascade;
|
22 | 46 |
|
| 47 | + DROP TABLE IF EXISTS roles_aud CASCADE; |
| 48 | + |
23 | 49 | drop table if exists roles_permissions cascade;
|
24 | 50 |
|
| 51 | + DROP TABLE IF EXISTS roles_permissions_aud CASCADE; |
| 52 | + |
25 | 53 | drop table if exists users cascade;
|
26 | 54 |
|
| 55 | + DROP TABLE IF EXISTS users_aud CASCADE; |
| 56 | + |
27 | 57 | drop table if exists users_roles cascade;
|
28 | 58 |
|
| 59 | + DROP TABLE IF EXISTS users_roles_aud CASCADE; |
| 60 | + |
| 61 | + DROP SEQUENCE hibernate_sequence; |
| 62 | + |
29 | 63 | drop sequence sequence_jwt_tokens;
|
30 | 64 |
|
31 | 65 | drop sequence sequence_permissions;
|
|
34 | 68 |
|
35 | 69 | drop sequence sequence_users;
|
36 | 70 |
|
| 71 | + CREATE SEQUENCE hibernate_sequence START 1 INCREMENT 1; |
| 72 | + |
37 | 73 | create sequence sequence_jwt_tokens start 1 increment 1;
|
38 | 74 |
|
39 | 75 | create sequence sequence_permissions start 1 increment 1;
|
|
43 | 79 | create sequence sequence_users start 1 increment 1;
|
44 | 80 |
|
45 | 81 | create table jwt_tokens (
|
46 |
| - id int8 not null, |
47 |
| - uuid varchar(255) not null, |
48 |
| - version int8, |
49 |
| - active boolean not null, |
50 |
| - expiration_date timestamp not null, |
51 |
| - invalidated boolean not null, |
52 |
| - invalidation_date timestamp, |
53 |
| - ip_adress varchar(39) not null, |
54 |
| - user_id int8, |
| 82 | + id int8 not null, |
| 83 | + uuid varchar(255) not null, |
| 84 | + version int8, |
| 85 | + created_by INT8, |
| 86 | + created_date TIMESTAMP NOT NULL, |
| 87 | + updated_by INT8, |
| 88 | + updated_date TIMESTAMP, |
| 89 | + active boolean not null, |
| 90 | + expiration_date timestamp not null, |
| 91 | + invalidated boolean not null, |
| 92 | + invalidation_date timestamp, |
| 93 | + ip_adress varchar(39) not null, |
| 94 | + user_id int8, |
55 | 95 | primary key (id)
|
56 | 96 | );
|
57 | 97 |
|
| 98 | + CREATE TABLE jwt_tokens_aud ( |
| 99 | + id INT8 NOT NULL, |
| 100 | + rev INT4 NOT NULL, |
| 101 | + revtype INT2, |
| 102 | + uuid VARCHAR(255), |
| 103 | + created_by INT8, |
| 104 | + created_date TIMESTAMP, |
| 105 | + updated_by INT8, |
| 106 | + updated_date TIMESTAMP, |
| 107 | + active BOOLEAN, |
| 108 | + expiration_date TIMESTAMP, |
| 109 | + invalidated BOOLEAN, |
| 110 | + invalidation_date TIMESTAMP, |
| 111 | + ip_adress VARCHAR(39), |
| 112 | + user_id INT8, |
| 113 | + PRIMARY KEY (id, rev) |
| 114 | + ); |
| 115 | + |
58 | 116 | create table permissions (
|
59 |
| - id int8 not null, |
60 |
| - uuid varchar(255) not null, |
61 |
| - version int8, |
62 |
| - name varchar(64) not null, |
| 117 | + id int8 not null, |
| 118 | + uuid varchar(255) not null, |
| 119 | + version int8, |
| 120 | + created_by INT8, |
| 121 | + created_date TIMESTAMP NOT NULL, |
| 122 | + updated_by INT8, |
| 123 | + updated_date TIMESTAMP, |
| 124 | + name varchar(64) not null, |
63 | 125 | primary key (id)
|
64 | 126 | );
|
65 | 127 |
|
| 128 | + CREATE TABLE permissions_aud ( |
| 129 | + id INT8 NOT NULL, |
| 130 | + rev INT4 NOT NULL, |
| 131 | + revtype INT2, |
| 132 | + uuid VARCHAR(255), |
| 133 | + created_by INT8, |
| 134 | + created_date TIMESTAMP, |
| 135 | + updated_by INT8, |
| 136 | + updated_date TIMESTAMP, |
| 137 | + name VARCHAR(64), |
| 138 | + PRIMARY KEY (id, rev) |
| 139 | + ); |
| 140 | + |
| 141 | + CREATE TABLE revinfo ( |
| 142 | + rev INT4 NOT NULL, |
| 143 | + revtstmp INT8, |
| 144 | + PRIMARY KEY (rev) |
| 145 | + ); |
| 146 | + |
66 | 147 | create table roles (
|
67 |
| - id int8 not null, |
68 |
| - uuid varchar(255) not null, |
69 |
| - version int8, |
70 |
| - name varchar(64) not null, |
| 148 | + id int8 not null, |
| 149 | + uuid varchar(255) not null, |
| 150 | + version int8, |
| 151 | + created_by INT8, |
| 152 | + created_date TIMESTAMP NOT NULL, |
| 153 | + updated_by INT8, |
| 154 | + updated_date TIMESTAMP, |
| 155 | + name varchar(64) not null, |
71 | 156 | primary key (id)
|
72 | 157 | );
|
73 | 158 |
|
| 159 | + CREATE TABLE roles_aud ( |
| 160 | + id INT8 NOT NULL, |
| 161 | + rev INT4 NOT NULL, |
| 162 | + revtype INT2, |
| 163 | + uuid VARCHAR(255), |
| 164 | + created_by INT8, |
| 165 | + created_date TIMESTAMP, |
| 166 | + updated_by INT8, |
| 167 | + updated_date TIMESTAMP, |
| 168 | + name VARCHAR(64), |
| 169 | + PRIMARY KEY (id, rev) |
| 170 | + ); |
| 171 | + |
74 | 172 | create table roles_permissions (
|
75 | 173 | role_id int8 not null,
|
76 | 174 | permissions_id int8 not null,
|
77 | 175 | primary key (role_id, permissions_id)
|
78 | 176 | );
|
79 | 177 |
|
| 178 | + CREATE TABLE roles_permissions_aud ( |
| 179 | + rev INT4 NOT NULL, |
| 180 | + role_id INT8 NOT NULL, |
| 181 | + permissions_id INT8 NOT NULL, |
| 182 | + revtype INT2, |
| 183 | + PRIMARY KEY (rev, role_id, permissions_id) |
| 184 | + ); |
| 185 | + |
80 | 186 | create table users (
|
81 |
| - id int8 not null, |
82 |
| - uuid varchar(255) not null, |
83 |
| - version int8, |
84 |
| - email varchar(250) not null, |
85 |
| - enabled boolean not null, |
86 |
| - expired boolean not null, |
87 |
| - first_name varchar(120) not null, |
88 |
| - last_name varchar(120) not null, |
89 |
| - locked boolean not null, |
90 |
| - password varchar(64) not null, |
91 |
| - username varchar(250) not null, |
| 187 | + id int8 not null, |
| 188 | + uuid varchar(255) not null, |
| 189 | + version int8, |
| 190 | + created_by INT8, |
| 191 | + created_date TIMESTAMP NOT NULL, |
| 192 | + updated_by INT8, |
| 193 | + updated_date TIMESTAMP, |
| 194 | + email varchar(250) not null, |
| 195 | + enabled boolean not null, |
| 196 | + expired boolean not null, |
| 197 | + first_name varchar(120) not null, |
| 198 | + last_name varchar(120) not null, |
| 199 | + locked boolean not null, |
| 200 | + password varchar(64) not null, |
| 201 | + username varchar(250) not null, |
92 | 202 | primary key (id)
|
93 | 203 | );
|
94 | 204 |
|
| 205 | + CREATE TABLE users_aud ( |
| 206 | + id INT8 NOT NULL, |
| 207 | + rev INT4 NOT NULL, |
| 208 | + revtype INT2, |
| 209 | + uuid VARCHAR(255), |
| 210 | + created_by INT8, |
| 211 | + created_date TIMESTAMP, |
| 212 | + updated_by INT8, |
| 213 | + updated_date TIMESTAMP, |
| 214 | + email VARCHAR(250), |
| 215 | + enabled BOOLEAN, |
| 216 | + expired BOOLEAN, |
| 217 | + first_name VARCHAR(120), |
| 218 | + last_name VARCHAR(120), |
| 219 | + locked BOOLEAN, |
| 220 | + password VARCHAR(64), |
| 221 | + username VARCHAR(250), |
| 222 | + PRIMARY KEY (id, rev) |
| 223 | + ); |
| 224 | + |
95 | 225 | create table users_roles (
|
96 | 226 | user_id int8 not null,
|
97 | 227 | roles_id int8 not null,
|
98 | 228 | primary key (user_id, roles_id)
|
99 | 229 | );
|
100 | 230 |
|
101 |
| - alter table permissions |
| 231 | + CREATE TABLE users_roles_aud ( |
| 232 | + rev INT4 NOT NULL, |
| 233 | + user_id INT8 NOT NULL, |
| 234 | + roles_id INT8 NOT NULL, |
| 235 | + revtype INT2, |
| 236 | + PRIMARY KEY (rev, user_id, roles_id) |
| 237 | + ); |
| 238 | + |
| 239 | + alter table permissions |
102 | 240 | add constraint UK_pnvtwliis6p05pn6i3ndjrqt2 unique (name);
|
103 | 241 |
|
104 |
| - alter table roles |
| 242 | + alter table roles |
105 | 243 | add constraint UK_ofx66keruapi6vyqpv6f2or37 unique (name);
|
106 | 244 |
|
107 |
| - alter table roles_permissions |
| 245 | + alter table roles_permissions |
108 | 246 | add constraint UK_oll9subcln0cdjt31bp72a3uv unique (permissions_id);
|
109 | 247 |
|
110 |
| - alter table users |
| 248 | + alter table users |
111 | 249 | add constraint UK_r43af9ap4edm43mmtq01oddj6 unique (username);
|
112 | 250 |
|
113 |
| - alter table users_roles |
| 251 | + alter table users_roles |
114 | 252 | add constraint UK_60loxav507l5mreo05v0im1lq unique (roles_id);
|
115 | 253 |
|
116 |
| - alter table jwt_tokens |
117 |
| - add constraint FKhy6n4wirmw0ryw2wdmy9cx2mn |
118 |
| - foreign key (user_id) |
| 254 | + alter table jwt_tokens |
| 255 | + add constraint FKhy6n4wirmw0ryw2wdmy9cx2mn |
| 256 | + foreign key (user_id) |
119 | 257 | references users;
|
120 | 258 |
|
121 |
| - alter table roles_permissions |
122 |
| - add constraint FKeqt383nibym26cjj8we4uar8h |
123 |
| - foreign key (permissions_id) |
| 259 | + ALTER TABLE jwt_tokens_aud |
| 260 | + ADD CONSTRAINT FK6jp64i8dvuahfik6kui8prbjd |
| 261 | + FOREIGN KEY (rev) |
| 262 | + REFERENCES revinfo; |
| 263 | + |
| 264 | + ALTER TABLE permissions_aud |
| 265 | + ADD CONSTRAINT FKbcjh1knyfnk51nv2cllrct4iw |
| 266 | + FOREIGN KEY (rev) |
| 267 | + REFERENCES revinfo; |
| 268 | + |
| 269 | + ALTER TABLE roles_aud |
| 270 | + ADD CONSTRAINT FKt0mnl3rej2p0h9gxnbalf2kdd |
| 271 | + FOREIGN KEY (rev) |
| 272 | + REFERENCES revinfo; |
| 273 | + |
| 274 | + alter table roles_permissions |
| 275 | + add constraint FKeqt383nibym26cjj8we4uar8h |
| 276 | + foreign key (permissions_id) |
124 | 277 | references roles;
|
125 | 278 |
|
126 |
| - alter table roles_permissions |
127 |
| - add constraint FKqi9odri6c1o81vjox54eedwyh |
128 |
| - foreign key (role_id) |
| 279 | + alter table roles_permissions |
| 280 | + add constraint FKqi9odri6c1o81vjox54eedwyh |
| 281 | + foreign key (role_id) |
129 | 282 | references roles;
|
130 | 283 |
|
131 |
| - alter table users_roles |
132 |
| - add constraint FKa62j07k5mhgifpp955h37ponj |
133 |
| - foreign key (roles_id) |
| 284 | + ALTER TABLE roles_permissions_aud |
| 285 | + ADD CONSTRAINT FKnofx22xg9kko3i1geh4jikive |
| 286 | + FOREIGN KEY (rev) |
| 287 | + REFERENCES revinfo; |
| 288 | + |
| 289 | + ALTER TABLE users_aud |
| 290 | + ADD CONSTRAINT FKc4vk4tui2la36415jpgm9leoq |
| 291 | + FOREIGN KEY (rev) |
| 292 | + REFERENCES revinfo; |
| 293 | + |
| 294 | + alter table users_roles |
| 295 | + add constraint FKa62j07k5mhgifpp955h37ponj |
| 296 | + foreign key (roles_id) |
134 | 297 | references roles;
|
135 | 298 |
|
136 |
| - alter table users_roles |
137 |
| - add constraint FK2o0jvgh89lemvvo17cbqvdxaa |
138 |
| - foreign key (user_id) |
| 299 | + alter table users_roles |
| 300 | + add constraint FK2o0jvgh89lemvvo17cbqvdxaa |
| 301 | + foreign key (user_id) |
139 | 302 | references users;
|
| 303 | + |
| 304 | + ALTER TABLE users_roles_aud |
| 305 | + ADD CONSTRAINT FKktxqr55ntd0j2i228uj8sq6j9 |
| 306 | + FOREIGN KEY (rev) |
| 307 | + REFERENCES revinfo; |
0 commit comments