Added initial flyway migration
This commit is contained in:
parent
9357299fcd
commit
62b0a1ae0d
@ -1,5 +1,3 @@
|
||||
spring.flyway.enabled=false
|
||||
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
|
||||
spring.datasource.initialization-mode=always
|
||||
|
102
src/main/resources/db/migration/V1_0__Database_Init.sql
Normal file
102
src/main/resources/db/migration/V1_0__Database_Init.sql
Normal file
@ -0,0 +1,102 @@
|
||||
create schema if not exists projectplanner;
|
||||
|
||||
create table if not exists projectplanner."user"
|
||||
(
|
||||
id bigserial not null
|
||||
constraint user_pk
|
||||
primary key,
|
||||
username varchar(50) not null,
|
||||
email varchar(255) not null,
|
||||
password varchar(255) not null
|
||||
);
|
||||
|
||||
create unique index if not exists user_id_uindex
|
||||
on projectplanner."user" (id);
|
||||
|
||||
create table if not exists projectplanner.project
|
||||
(
|
||||
id bigserial not null
|
||||
constraint project_pk
|
||||
primary key,
|
||||
title text not null
|
||||
);
|
||||
|
||||
create unique index if not exists project_id_uindex
|
||||
on projectplanner.project (id);
|
||||
|
||||
create table if not exists projectplanner.team
|
||||
(
|
||||
user_id bigserial not null
|
||||
constraint team_user_fk
|
||||
references projectplanner."user",
|
||||
project_id bigserial not null
|
||||
constraint team_project_fk
|
||||
references projectplanner.project
|
||||
);
|
||||
|
||||
create table if not exists projectplanner.event
|
||||
(
|
||||
id bigserial not null
|
||||
constraint event_pk
|
||||
primary key
|
||||
constraint event_project_fk
|
||||
references projectplanner.project,
|
||||
title varchar(255) not null,
|
||||
description text,
|
||||
project_id bigserial not null,
|
||||
start_time timestamp not null,
|
||||
end_time timestamp not null
|
||||
);
|
||||
|
||||
create unique index if not exists event_id_uindex
|
||||
on projectplanner.event (id);
|
||||
|
||||
create table if not exists projectplanner.comment
|
||||
(
|
||||
id bigserial not null
|
||||
constraint comment_pk
|
||||
primary key
|
||||
constraint comment_event_fk
|
||||
references projectplanner.event
|
||||
constraint comment_user_fk
|
||||
references projectplanner."user",
|
||||
event_id bigserial not null,
|
||||
user_id bigserial not null,
|
||||
created timestamp not null,
|
||||
comment text not null
|
||||
);
|
||||
|
||||
create unique index if not exists comment_id_uindex
|
||||
on projectplanner.comment (id);
|
||||
|
||||
create table if not exists projectplanner.tag
|
||||
(
|
||||
id bigserial not null
|
||||
constraint tag_pk
|
||||
primary key,
|
||||
tag varchar(100) not null
|
||||
);
|
||||
|
||||
create unique index if not exists tag_id_uindex
|
||||
on projectplanner.tag (id);
|
||||
|
||||
create table if not exists projectplanner.event_tags
|
||||
(
|
||||
event_id bigserial not null
|
||||
constraint event_tags_event_id_fk
|
||||
references projectplanner.event,
|
||||
tag_id bigserial not null
|
||||
constraint event_tags_tag_id_fk
|
||||
references projectplanner.tag
|
||||
);
|
||||
|
||||
create table if not exists projectplanner.comment_tags
|
||||
(
|
||||
comment_id bigserial not null
|
||||
constraint comment_tags_comment_id_fk
|
||||
references projectplanner.comment,
|
||||
tag_id bigserial not null
|
||||
constraint comment_tags_tag_id_fk
|
||||
references projectplanner.tag
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user