-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from tumugin/migrate-to-postgres
Migrated to Postgres
- Loading branch information
Showing
20 changed files
with
167 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
107 changes: 107 additions & 0 deletions
107
src/main/resources/db/migration/V1__initial_create_postgres.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
create table "users" | ||
( | ||
"id" bigserial primary key not null, | ||
"name" varchar(255) not null, | ||
"email" varchar(255) unique, | ||
"password" varchar(255), | ||
"email_verified_at" timestamptz, | ||
"force_logout_generation" integer default 0, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null | ||
); | ||
|
||
create table "groups" | ||
( | ||
"id" bigserial primary key not null, | ||
"user_id" bigint, | ||
"name" varchar(255) not null, | ||
"status" varchar(255) not null, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_user_id foreign key ("user_id") references "users" ("id") on delete set null | ||
); | ||
|
||
create table "idols" | ||
( | ||
"id" bigserial primary key not null, | ||
"user_id" bigint, | ||
"name" varchar(255) not null, | ||
"status" varchar(255) not null, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_user_id foreign key ("user_id") references "users" ("id") on delete set null | ||
); | ||
|
||
create table "regulations" | ||
( | ||
"id" bigserial primary key not null, | ||
"group_id" bigint not null, | ||
"user_id" bigint, | ||
"name" varchar(255) not null, | ||
"comment" text not null, | ||
"unit_price" integer not null, | ||
"status" varchar(255) not null, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_group_id foreign key ("group_id") references "groups" ("id") on delete cascade, | ||
constraint fk_user_id foreign key ("user_id") references "users" ("id") on delete set null | ||
); | ||
|
||
create table "chekis" | ||
( | ||
"id" bigserial primary key not null, | ||
"user_id" bigint not null, | ||
"idol_id" bigint, | ||
"regulation_id" bigint, | ||
"quantity" integer not null, | ||
"shot_at" timestamptz not null, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_user_id foreign key ("user_id") references "users" ("id") on delete cascade, | ||
constraint fk_idol_id foreign key ("idol_id") references "idols" ("id") on delete set null, | ||
constraint fk_regulation_id foreign key ("regulation_id") references "regulations" ("id") on delete set null | ||
); | ||
|
||
create table "favorite_groups" | ||
( | ||
"id" bigserial primary key not null, | ||
"user_id" bigint not null, | ||
"group_id" bigint not null, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_user_id foreign key ("user_id") references "users" ("id") on delete cascade, | ||
constraint fk_group_id foreign key ("group_id") references "groups" ("id") on delete cascade | ||
); | ||
|
||
create table "group_idols" | ||
( | ||
"id" bigserial primary key not null, | ||
"group_id" bigint not null, | ||
"idol_id" bigint not null, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_group_id foreign key ("group_id") references "groups" ("id") on delete cascade, | ||
constraint fk_idol_id foreign key ("idol_id") references "idols" ("id") on delete cascade, | ||
unique ("group_id", "idol_id") | ||
); | ||
|
||
create table "admin_users" | ||
( | ||
"id" bigserial primary key not null, | ||
"name" varchar(255) not null, | ||
"email" varchar(255) unique, | ||
"password" varchar(255), | ||
"force_logout_generation" integer default 0, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null | ||
); | ||
|
||
create table "auth0_users" | ||
( | ||
"id" bigserial primary key not null, | ||
"user_id" bigint not null unique, | ||
"auth0_user_id" varchar(255) not null unique, | ||
"created_at" timestamptz not null, | ||
"updated_at" timestamptz not null, | ||
constraint fk_user_id foreign key ("user_id") references "users" ("id") on delete cascade | ||
); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/resources/db/migration/V4__create_regulations.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/resources/db/migration/V7__create_group_idols.sql
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/main/resources/db/migration/V8__create_admin_users.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.