idz: Add initial team tables

This commit is contained in:
Tau 2019-05-26 20:05:13 -04:00
parent f874f56816
commit d1c3051a5e
3 changed files with 94 additions and 1 deletions

View File

@ -190,3 +190,54 @@ create table "idz"."unlocks" (
"music" integer not null,
"last_mileage_reward" integer not null
);
create table "idz"."team" (
"id" bigint primary key not null,
"ext_id" integer not null,
"name" text not null,
"name_bg" smallint not null,
"name_fx" smallint not null,
"register_time" timestamp not null,
constraint "team_uq" unique ("ext_id")
);
create table "idz"."team" (
"id" bigint primary key not null,
"ext_id" integer not null,
"name" text not null,
"name_bg" smallint not null,
"name_fx" smallint not null,
"register_time" timestamp not null,
constraint "team_uq" unique ("ext_id")
);
create table "idz"."team_auto" (
"id" bigint primary key not null
references "idz"."team"("id")
on delete cascade,
"serial_no" smallint not null,
"name_idx" smallint not null,
constraint "team_auto_uq" unique ("serial_no", "name_idx")
);
create table "idz"."team_member" (
"id" bigint primary key not null
references "idz"."profile"("id")
on delete cascade,
"team_id" bigint not null
references "idz"."team"("id")
on delete cascade,
"join_time" timestamp not null,
"leader" boolean not null
);
create table "idz"."team_reservation" (
"id" bigint primary key not null
references "aime"."player"("id")
on delete cascade,
"team_id" bigint not null
references "idz"."team"("id")
on delete cascade,
"join_time" timestamp not null,
"leader" boolean not null
);

View File

@ -1,2 +1,2 @@
create table "meta" ("schemaver" integer not null);
insert into "meta" values (2);
insert into "meta" values (3);

View File

@ -0,0 +1,42 @@
create table "idz"."team" (
"id" bigint primary key not null,
"ext_id" integer not null,
"name" text not null,
"name_bg" smallint not null,
"name_fx" smallint not null,
"register_time" timestamp not null,
constraint "team_uq" unique ("ext_id")
);
create table "idz"."team_auto" (
"id" bigint primary key not null
references "idz"."team"("id")
on delete cascade,
"serial_no" smallint not null,
"name_idx" smallint not null,
constraint "team_auto_uq" unique ("serial_no", "name_idx")
);
create table "idz"."team_member" (
"id" bigint primary key not null
references "idz"."profile"("id")
on delete cascade,
"team_id" bigint not null
references "idz"."team"("id")
on delete cascade,
"join_time" timestamp not null,
"leader" boolean not null
);
create table "idz"."team_reservation" (
"id" bigint primary key not null
references "aime"."player"("id")
on delete cascade,
"team_id" bigint not null
references "idz"."team"("id")
on delete cascade,
"join_time" timestamp not null,
"leader" boolean not null
);
update "meta" set "schemaver" = 2;