-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
66 lines (66 loc) · 5.4 KB
/
schema.sql
File metadata and controls
66 lines (66 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
alter table Cemetery drop constraint FKCE89E51279E16DEC
alter table Grave drop constraint FK41DD1E5B0ABD199
alter table Grave drop constraint FK41DD1E5AA7CB23A
alter table Person drop constraint FK8E48877570B4C7A4
alter table Person drop constraint FK8E488775ABCEE677
alter table Person drop constraint FK8E488775EF7942C
alter table Person drop constraint FK8E48877570F3F3DA
alter table Person drop constraint FK8E4887757DF6B27A
alter table Person drop constraint FK8E4887758A840FFA
alter table Person drop constraint FK8E48877580E8A6BA
alter table Person drop constraint FK8E4887759894923A
alter table Person drop constraint FK8E488775918DBD79
alter table Person_CauseOfDeath drop constraint FK485AEADE4FAFE35A
alter table Person_CauseOfDeath drop constraint FK485AEADE7808DA3B
alter table Person_Grave drop constraint FKF4FA909B7A4E4C31
alter table Person_Grave drop constraint FKF4FA909B4FAFE35A
drop table Camp
drop table Category
drop table CauseOfDeath
drop table Cemetery
drop table FlexibleDate
drop table Grave
drop table InfoPage
drop table KgUser
drop table Nationality
drop table Person
drop table PersonDetails
drop table Person_CauseOfDeath
drop table Person_Grave
drop table PostalDistrict
drop table Rank
drop table Stalag
drop sequence hibernate_sequence
create table Camp (id int8 not null, description text, latitude float8, longitude float8, name varchar(255) not null unique, primary key (id))
create table Category (id int8 not null, description text, name varchar(255) not null unique, primary key (id))
create table CauseOfDeath (id int8 not null, causeGroup varchar(255), description varchar(255), name varchar(255) not null unique, primary key (id))
create table Cemetery (id int8 not null, address varchar(255), latitude float8, longitude float8, name varchar(255) not null unique, postalDistrict_postcode int4, primary key (id))
create table FlexibleDate (id int8 not null, approximate bool not null, day int4, month int4, year int4, primary key (id))
create table Grave (id int8 not null, graveField varchar(255), graveNumber varchar(255), graveRow varchar(255), latitude float8, longitude float8, massGrave bool not null, moved bool not null, reference text, cemetery_id int8, dateOfBurial_id int8, primary key (id))
create table InfoPage (id int8 not null, html text, language varchar(255), pageName varchar(255) not null, primary key (id))
create table KgUser (id int8 not null, credentialsNonExpired bool not null, enabled bool not null, name varchar(255), password varchar(255), role varchar(255), username varchar(255) unique, primary key (id))
create table Nationality (id int8 not null, name varchar(255) unique, primary key (id))
create table Person (id int8 not null, causeOfDeathDescription varchar(255), createdDate timestamp default current_timestamp not null, obdNumber int8, placeOfDeath varchar(255), prisonerNumber int4, remarks text, camp_id int8, category_id int8, cyrillicDetails_id int8, dateOfBirth_id int8, dateOfDeath_id int8, nationality_id int8, rank_id int8, stalag_id int8, westernDetails_id int8, primary key (id))
create table PersonDetails (id int8 not null, firstName varchar(255), lastName varchar(255), nameOfFather varchar(255), placeOfBirth varchar(255), primary key (id))
create table Person_CauseOfDeath (Person_id int8 not null, causesOfDeath_id int8 not null, primary key (Person_id, causesOfDeath_id))
create table Person_Grave (Person_id int8 not null, graves_id int8 not null, unique (graves_id))
create table PostalDistrict (postcode int4 not null unique, countyId int4 not null, name varchar(255) not null, primary key (postcode))
create table Rank (id int8 not null, name varchar(255) unique, primary key (id))
create table Stalag (id int8 not null, description text, latitude float8, longitude float8, name varchar(255) not null unique, primary key (id))
alter table Cemetery add constraint FKCE89E51279E16DEC foreign key (postalDistrict_postcode) references PostalDistrict
alter table Grave add constraint FK41DD1E5B0ABD199 foreign key (dateOfBurial_id) references FlexibleDate
alter table Grave add constraint FK41DD1E5AA7CB23A foreign key (cemetery_id) references Cemetery
alter table Person add constraint FK8E48877570B4C7A4 foreign key (dateOfDeath_id) references FlexibleDate
alter table Person add constraint FK8E488775ABCEE677 foreign key (westernDetails_id) references PersonDetails
alter table Person add constraint FK8E488775EF7942C foreign key (cyrillicDetails_id) references PersonDetails
alter table Person add constraint FK8E48877570F3F3DA foreign key (camp_id) references Camp
alter table Person add constraint FK8E4887757DF6B27A foreign key (nationality_id) references Nationality
alter table Person add constraint FK8E4887758A840FFA foreign key (rank_id) references Rank
alter table Person add constraint FK8E48877580E8A6BA foreign key (category_id) references Category
alter table Person add constraint FK8E4887759894923A foreign key (stalag_id) references Stalag
alter table Person add constraint FK8E488775918DBD79 foreign key (dateOfBirth_id) references FlexibleDate
alter table Person_CauseOfDeath add constraint FK485AEADE4FAFE35A foreign key (Person_id) references Person
alter table Person_CauseOfDeath add constraint FK485AEADE7808DA3B foreign key (causesOfDeath_id) references CauseOfDeath
alter table Person_Grave add constraint FKF4FA909B7A4E4C31 foreign key (graves_id) references Grave
alter table Person_Grave add constraint FKF4FA909B4FAFE35A foreign key (Person_id) references Person
create sequence hibernate_sequence