mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-08 13:05:15 -05:00
Squash migrations
This commit is contained in:
committed by
Hammad Jutt
parent
a439bb44e1
commit
f9f5a05b6a
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."quest";
|
||||
@@ -1,2 +0,0 @@
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
CREATE TABLE "public"."quest"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" date NOT NULL DEFAULT now(), "guild_id" uuid NOT NULL, "created_by_player_id" uuid NOT NULL, "title" text NOT NULL, "description" text, "external_link" text, "cooldown" integer, PRIMARY KEY ("id") , FOREIGN KEY ("created_by_player_id") REFERENCES "public"."player"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("guild_id") REFERENCES "public"."guild"("id") ON UPDATE restrict ON DELETE restrict);
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."QuestStatus";
|
||||
@@ -1,4 +0,0 @@
|
||||
CREATE TABLE "public"."QuestStatus"("status" text NOT NULL, PRIMARY KEY ("status") );
|
||||
INSERT INTO "public"."QuestStatus" ("status") VALUES
|
||||
('OPEN'),
|
||||
('CLOSED')
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest" DROP COLUMN "status";
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest" ADD COLUMN "status" text NULL;
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest" ALTER COLUMN "status" DROP NOT NULL;
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest" ALTER COLUMN "status" SET NOT NULL;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."quest" drop constraint "quest_status_fkey";
|
||||
@@ -1,5 +0,0 @@
|
||||
alter table "public"."quest"
|
||||
add constraint "quest_status_fkey"
|
||||
foreign key ("status")
|
||||
references "public"."QuestStatus"
|
||||
("status") on update restrict on delete restrict;
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."QuestRepetition";
|
||||
@@ -1,5 +0,0 @@
|
||||
CREATE TABLE "public"."QuestRepetition"("repetition" text NOT NULL, PRIMARY KEY ("repetition") );
|
||||
INSERT INTO "public"."QuestStatus" ("status") VALUES
|
||||
('ONCE'),
|
||||
('ONCE_PER_PLAYER'),
|
||||
('RECURRING')
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest" DROP COLUMN "repetition";
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest" ADD COLUMN "repetition" text NOT NULL;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."quest" drop constraint "quest_repetition_fkey";
|
||||
@@ -1,5 +0,0 @@
|
||||
alter table "public"."quest"
|
||||
add constraint "quest_repetition_fkey"
|
||||
foreign key ("repetition")
|
||||
references "public"."QuestRepetition"
|
||||
("repetition") on update restrict on delete restrict;
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."quest_skill";
|
||||
@@ -1 +0,0 @@
|
||||
CREATE TABLE "public"."quest_skill"("quest_id" uuid NOT NULL, "skill_id" uuid NOT NULL, PRIMARY KEY ("quest_id","skill_id") , FOREIGN KEY ("quest_id") REFERENCES "public"."quest"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("skill_id") REFERENCES "public"."skill"("id") ON UPDATE restrict ON DELETE restrict);
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."quest_completion";
|
||||
@@ -1 +0,0 @@
|
||||
CREATE TABLE "public"."quest_completion"("quest_id" uuid NOT NULL, "completed_by_player_id" uuid NOT NULL, "submitted_at" date NOT NULL DEFAULT now(), "submission_text" text, "submission_link" text, PRIMARY KEY ("quest_id","completed_by_player_id") , FOREIGN KEY ("quest_id") REFERENCES "public"."quest"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("completed_by_player_id") REFERENCES "public"."player"("id") ON UPDATE restrict ON DELETE restrict);
|
||||
@@ -1 +0,0 @@
|
||||
DROP TABLE "public"."QuestCompletionStatus";
|
||||
@@ -1,5 +0,0 @@
|
||||
CREATE TABLE "public"."QuestCompletionStatus"("status" text NOT NULL, PRIMARY KEY ("status") );
|
||||
INSERT INTO "public"."QuestSQuestCompletionStatustatus" ("status") VALUES
|
||||
('PENDING'),
|
||||
('ACCEPTED'),
|
||||
('REJECTED')
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest_completion" DROP COLUMN "status";
|
||||
@@ -1 +0,0 @@
|
||||
ALTER TABLE "public"."quest_completion" ADD COLUMN "status" text NOT NULL;
|
||||
@@ -1 +0,0 @@
|
||||
alter table "public"."quest_completion" drop constraint "quest_completion_status_fkey";
|
||||
@@ -1,5 +0,0 @@
|
||||
alter table "public"."quest_completion"
|
||||
add constraint "quest_completion_status_fkey"
|
||||
foreign key ("status")
|
||||
references "public"."QuestCompletionStatus"
|
||||
("status") on update restrict on delete restrict;
|
||||
26
hasura/migrations/1612970700332_quests/down.sql
Normal file
26
hasura/migrations/1612970700332_quests/down.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
alter table "public"."quest_completion" drop constraint "quest_completion_status_fkey";
|
||||
|
||||
ALTER TABLE "public"."quest_completion" DROP COLUMN "status";
|
||||
|
||||
DROP TABLE "public"."QuestCompletionStatus";
|
||||
|
||||
DROP TABLE "public"."quest_completion";
|
||||
|
||||
DROP TABLE "public"."quest_skill";
|
||||
|
||||
alter table "public"."quest" drop constraint "quest_repetition_fkey";
|
||||
|
||||
ALTER TABLE "public"."quest" DROP COLUMN "repetition";
|
||||
|
||||
DROP TABLE "public"."QuestRepetition";
|
||||
|
||||
alter table "public"."quest" drop constraint "quest_status_fkey";
|
||||
|
||||
ALTER TABLE "public"."quest" ALTER COLUMN "status" DROP NOT NULL;
|
||||
|
||||
ALTER TABLE "public"."quest" DROP COLUMN "status";
|
||||
|
||||
DROP TABLE "public"."QuestStatus";
|
||||
|
||||
DROP TABLE "public"."quest";
|
||||
64
hasura/migrations/1612970700332_quests/up.sql
Normal file
64
hasura/migrations/1612970700332_quests/up.sql
Normal file
@@ -0,0 +1,64 @@
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
|
||||
-- Enums
|
||||
|
||||
CREATE TABLE "public"."QuestStatus"(
|
||||
"status" text NOT NULL,
|
||||
PRIMARY KEY ("status")
|
||||
);
|
||||
INSERT INTO "public"."QuestStatus" ("status") VALUES
|
||||
('OPEN'),
|
||||
('CLOSED');
|
||||
|
||||
CREATE TABLE "public"."QuestRepetition"("repetition" text NOT NULL, PRIMARY KEY ("repetition") );
|
||||
INSERT INTO "public"."QuestRepetition" ("repetition") VALUES
|
||||
('ONCE'),
|
||||
('ONCE_PER_PLAYER'),
|
||||
('RECURRING');
|
||||
|
||||
CREATE TABLE "public"."QuestCompletionStatus"("status" text NOT NULL, PRIMARY KEY ("status") );
|
||||
INSERT INTO "public"."QuestCompletionStatus" ("status") VALUES
|
||||
('PENDING'),
|
||||
('ACCEPTED'),
|
||||
('REJECTED');
|
||||
|
||||
-- Tables
|
||||
|
||||
CREATE TABLE "public"."quest" (
|
||||
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
"created_at" date NOT NULL DEFAULT now(),
|
||||
"guild_id" uuid NOT NULL,
|
||||
"created_by_player_id" uuid NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"description" text,
|
||||
"external_link" text,
|
||||
"cooldown" integer,
|
||||
"status" text NOT NULL,
|
||||
"repetition" text NOT NULL,
|
||||
PRIMARY KEY ("id") ,
|
||||
FOREIGN KEY ("created_by_player_id") REFERENCES "public"."player"("id") ON UPDATE restrict ON DELETE restrict,
|
||||
FOREIGN KEY ("guild_id") REFERENCES "public"."guild"("id") ON UPDATE restrict ON DELETE restrict,
|
||||
FOREIGN KEY ("status") REFERENCES "public"."QuestStatus"("status") ON UPDATE restrict ON DELETE restrict,
|
||||
FOREIGN KEY ("repetition") REFERENCES "public"."QuestRepetition"("repetition") ON UPDATE restrict ON DELETE restrict
|
||||
);
|
||||
|
||||
CREATE TABLE "public"."quest_skill"(
|
||||
"quest_id" uuid NOT NULL,
|
||||
"skill_id" uuid NOT NULL,
|
||||
PRIMARY KEY ("quest_id","skill_id"),
|
||||
FOREIGN KEY ("quest_id") REFERENCES "public"."quest"("id") ON UPDATE restrict ON DELETE restrict,
|
||||
FOREIGN KEY ("skill_id") REFERENCES "public"."skill"("id") ON UPDATE restrict ON DELETE restrict
|
||||
);
|
||||
|
||||
CREATE TABLE "public"."quest_completion"(
|
||||
"quest_id" uuid NOT NULL,
|
||||
"completed_by_player_id" uuid NOT NULL,
|
||||
"submitted_at" date NOT NULL DEFAULT now(),
|
||||
"submission_text" text,
|
||||
"submission_link" text,
|
||||
"status" text NOT NULL,
|
||||
PRIMARY KEY ("quest_id","completed_by_player_id") ,
|
||||
FOREIGN KEY ("quest_id") REFERENCES "public"."quest"("id") ON UPDATE restrict ON DELETE restrict,
|
||||
FOREIGN KEY ("completed_by_player_id") REFERENCES "public"."player"("id") ON UPDATE restrict ON DELETE restrict,
|
||||
FOREIGN KEY ("status") REFERENCES "public"."QuestCompletionStatus"("status") ON UPDATE restrict ON DELETE restrict
|
||||
);
|
||||
Reference in New Issue
Block a user