Skip to content

Commit

Permalink
feat: add achievements
Browse files Browse the repository at this point in the history
  • Loading branch information
nehalist committed Feb 11, 2024
1 parent 5be56a4 commit 9699d23
Show file tree
Hide file tree
Showing 22 changed files with 5,725 additions and 1,017 deletions.
11 changes: 11 additions & 0 deletions drizzle/0014_polite_luminals.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ALTER TABLE "team" DROP CONSTRAINT "team_userId_user_id_fk";
--> statement-breakpoint
ALTER TABLE "team" ALTER COLUMN "userId" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "matches" ADD COLUMN "comment" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "team" ADD CONSTRAINT "team_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE set null ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TABLE "league" DROP COLUMN IF EXISTS "maxScorePerMatch";
20 changes: 20 additions & 0 deletions drizzle/0015_illegal_sabretooth.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE IF NOT EXISTS "achievement" (
"id" text PRIMARY KEY NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"teamId" text NOT NULL,
"matchId" text NOT NULL,
"achievement" text NOT NULL,
CONSTRAINT "achievement_achievement_teamId_unique" UNIQUE("achievement","teamId")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "achievement" ADD CONSTRAINT "achievement_teamId_team_id_fk" FOREIGN KEY ("teamId") REFERENCES "team"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "achievement" ADD CONSTRAINT "achievement_matchId_matches_id_fk" FOREIGN KEY ("matchId") REFERENCES "matches"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
1 change: 1 addition & 0 deletions drizzle/0016_organic_molecule_man.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "team" ADD COLUMN "updatedAt" timestamp DEFAULT now() NOT NULL;
1 change: 1 addition & 0 deletions drizzle/0017_far_justice.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "team" ADD COLUMN "totalLosses" integer DEFAULT 0 NOT NULL;
3 changes: 3 additions & 0 deletions drizzle/0018_yellow_blue_shield.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "team" ALTER COLUMN "totalHighestRating" SET DEFAULT 1000;--> statement-breakpoint
ALTER TABLE "team" ALTER COLUMN "totalLowestRating" SET DEFAULT 1000;--> statement-breakpoint
ALTER TABLE "league" DROP COLUMN IF EXISTS "image";
2 changes: 1 addition & 1 deletion drizzle/meta/0013_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "9189b1d8-e768-40d0-bacc-92242b2b15f7",
"prevId": "90a44ec5-4fd2-4516-bec0-4db557129233",
"prevId": "88abe304-5db1-4028-9b57-f659ce9b57ea",
"version": "5",
"dialect": "pg",
"tables": {
Expand Down
Loading

0 comments on commit 9699d23

Please sign in to comment.