@@ -822,3 +822,209 @@ create index IDXs2yi8bobx8dd4ee6t63dufs6d on association_value_entry (saga_id, a
822822 add constraint FK2o0jvgh89lemvvo17cbqvdxaa
823823 foreign key (user_id)
824824 references users;
825+
826+ alter table jwt_tokens
827+ drop constraint FKhy6n4wirmw0ryw2wdmy9cx2mn;
828+
829+ alter table roles_permissions
830+ drop constraint FK570wuy6sacdnrw8wdqjfh7j0q;
831+
832+ alter table roles_permissions
833+ drop constraint FKqi9odri6c1o81vjox54eedwyh;
834+
835+ alter table users_roles
836+ drop constraint FKa62j07k5mhgifpp955h37ponj;
837+
838+ alter table users_roles
839+ drop constraint FK2o0jvgh89lemvvo17cbqvdxaa;
840+
841+ drop table if exists association_value_entry cascade;
842+
843+ drop table if exists domain_event_entry cascade;
844+
845+ drop table if exists jwt_tokens cascade;
846+
847+ drop table if exists permissions cascade;
848+
849+ drop table if exists roles cascade;
850+
851+ drop table if exists roles_permissions cascade;
852+
853+ drop table if exists saga_entry cascade;
854+
855+ drop table if exists snapshot_event_entry cascade;
856+
857+ drop table if exists token_entry cascade;
858+
859+ drop table if exists users cascade;
860+
861+ drop table if exists users_roles cascade;
862+
863+ drop sequence if exists hibernate_sequence;
864+
865+ drop sequence if exists sequence_jwt_tokens;
866+
867+ drop sequence if exists sequence_permissions;
868+
869+ drop sequence if exists sequence_roles;
870+
871+ drop sequence if exists sequence_users;
872+ create sequence hibernate_sequence start 1 increment 1 ;
873+ create sequence sequence_jwt_tokens start 1 increment 1 ;
874+ create sequence sequence_permissions start 1 increment 1 ;
875+ create sequence sequence_roles start 1 increment 1 ;
876+ create sequence sequence_users start 1 increment 1 ;
877+
878+ create table association_value_entry (
879+ id int8 not null ,
880+ association_key varchar (255 ) not null ,
881+ association_value varchar (255 ),
882+ saga_id varchar (255 ) not null ,
883+ saga_type varchar (255 ),
884+ primary key (id)
885+ );
886+
887+ create table domain_event_entry (
888+ global_index int8 not null ,
889+ event_identifier varchar (255 ) not null ,
890+ meta_data oid ,
891+ payload oid not null ,
892+ payload_revision varchar (255 ),
893+ payload_type varchar (255 ) not null ,
894+ time_stamp varchar (255 ) not null ,
895+ aggregate_identifier varchar (255 ) not null ,
896+ sequence_number int8 not null ,
897+ type varchar (255 ),
898+ primary key (global_index)
899+ );
900+
901+ create table jwt_tokens (
902+ id int8 not null ,
903+ uuid varchar (255 ) not null ,
904+ version int8,
905+ active boolean not null ,
906+ expiration_date timestamp not null ,
907+ invalidated boolean not null ,
908+ invalidation_date timestamp ,
909+ ip_adress varchar (39 ) not null ,
910+ user_id int8,
911+ primary key (id)
912+ );
913+
914+ create table permissions (
915+ id int8 not null ,
916+ uuid varchar (255 ) not null ,
917+ version int8,
918+ name varchar (64 ) not null ,
919+ primary key (id)
920+ );
921+
922+ create table roles (
923+ id int8 not null ,
924+ uuid varchar (255 ) not null ,
925+ version int8,
926+ name varchar (64 ) not null ,
927+ primary key (id)
928+ );
929+
930+ create table roles_permissions (
931+ role_id int8 not null ,
932+ permissions_id int8 not null ,
933+ primary key (role_id, permissions_id)
934+ );
935+
936+ create table saga_entry (
937+ saga_id varchar (255 ) not null ,
938+ revision varchar (255 ),
939+ saga_type varchar (255 ),
940+ serialized_saga oid ,
941+ primary key (saga_id)
942+ );
943+
944+ create table snapshot_event_entry (
945+ aggregate_identifier varchar (255 ) not null ,
946+ sequence_number int8 not null ,
947+ type varchar (255 ) not null ,
948+ event_identifier varchar (255 ) not null ,
949+ meta_data oid ,
950+ payload oid not null ,
951+ payload_revision varchar (255 ),
952+ payload_type varchar (255 ) not null ,
953+ time_stamp varchar (255 ) not null ,
954+ primary key (aggregate_identifier, sequence_number, type)
955+ );
956+
957+ create table token_entry (
958+ processor_name varchar (255 ) not null ,
959+ segment int4 not null ,
960+ owner varchar (255 ),
961+ timestamp varchar (255 ) not null ,
962+ token oid ,
963+ token_type varchar (255 ),
964+ primary key (processor_name, segment)
965+ );
966+
967+ create table users (
968+ id int8 not null ,
969+ uuid varchar (255 ) not null ,
970+ version int8,
971+ email varchar (250 ) not null ,
972+ enabled boolean not null ,
973+ expired boolean not null ,
974+ first_name varchar (120 ) not null ,
975+ last_name varchar (120 ) not null ,
976+ locked boolean not null ,
977+ password varchar (120 ) not null ,
978+ username varchar (250 ) not null ,
979+ primary key (id)
980+ );
981+
982+ create table users_roles (
983+ user_id int8 not null ,
984+ roles_id int8 not null ,
985+ primary key (user_id, roles_id)
986+ );
987+ create index IDXs2yi8bobx8dd4ee6t63dufs6d on association_value_entry (saga_id, association_key);
988+
989+ alter table domain_event_entry
990+ add constraint UK8s1f994p4la2ipb13me2xqm1w unique (aggregate_identifier, sequence_number);
991+
992+ alter table domain_event_entry
993+ add constraint UK_fwe6lsa8bfo6hyas6ud3m8c7x unique (event_identifier);
994+
995+ alter table permissions
996+ add constraint UK_pnvtwliis6p05pn6i3ndjrqt2 unique (name);
997+
998+ alter table roles
999+ add constraint UK_ofx66keruapi6vyqpv6f2or37 unique (name);
1000+
1001+ alter table snapshot_event_entry
1002+ add constraint UK_e1uucjseo68gopmnd0vgdl44h unique (event_identifier);
1003+
1004+ alter table users
1005+ add constraint UK_r43af9ap4edm43mmtq01oddj6 unique (username);
1006+
1007+ alter table jwt_tokens
1008+ add constraint FKhy6n4wirmw0ryw2wdmy9cx2mn
1009+ foreign key (user_id)
1010+ references users;
1011+
1012+ alter table roles_permissions
1013+ add constraint FK570wuy6sacdnrw8wdqjfh7j0q
1014+ foreign key (permissions_id)
1015+ references permissions;
1016+
1017+ alter table roles_permissions
1018+ add constraint FKqi9odri6c1o81vjox54eedwyh
1019+ foreign key (role_id)
1020+ references roles;
1021+
1022+ alter table users_roles
1023+ add constraint FKa62j07k5mhgifpp955h37ponj
1024+ foreign key (roles_id)
1025+ references roles;
1026+
1027+ alter table users_roles
1028+ add constraint FK2o0jvgh89lemvvo17cbqvdxaa
1029+ foreign key (user_id)
1030+ references users;
0 commit comments