Skip to content

Commit edb1f00

Browse files
authored
Fixing schema for roles and seniorities (#109)
1 parent e670092 commit edb1f00

21 files changed

+2132
-80
lines changed

.go-tetris.log

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2024/01/02 02:00:06 engine.go:57: Engine Start start
2+
2024/01/02 02:00:06 engine.go:29: Engine Run start
3+
2024/01/02 02:00:06 engine.go:123: Engine NewGame start
4+
2024/01/02 02:00:06 engine.go:143: Engine NewGame end
5+
2024/01/02 02:00:09 engine.go:52: Engine Run end
6+
2024/01/02 02:00:09 engine.go:86: Engine Start end
7+
2024/01/02 02:00:09 view.go:31: View Stop start
8+
2024/01/02 02:00:09 view.go:35: View Stop end
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
CREATE TABLE IF NOT EXISTS "work_seniority" (
2+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"name" text NOT NULL,
4+
"description" text NOT NULL,
5+
"created_at" timestamp DEFAULT now() NOT NULL,
6+
"updated_at" timestamp,
7+
"deleted_at" timestamp,
8+
CONSTRAINT "work_seniority_id_unique" UNIQUE("id")
9+
);
10+
--> statement-breakpoint
11+
CREATE TABLE IF NOT EXISTS "work_seniority_and_role" (
12+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
13+
"work_role_id" uuid,
14+
"work_seniority_id" uuid,
15+
"description" text,
16+
"created_at" timestamp DEFAULT now() NOT NULL,
17+
"updated_at" timestamp,
18+
"deleted_at" timestamp,
19+
CONSTRAINT "work_seniority_and_role_id_unique" UNIQUE("id")
20+
);
21+
--> statement-breakpoint
22+
ALTER TABLE "salaries" DROP CONSTRAINT "salaries_work_role_id_work_role_id_fk";
23+
--> statement-breakpoint
24+
ALTER TABLE "work_role" ALTER COLUMN "description" DROP NOT NULL;--> statement-breakpoint
25+
ALTER TABLE "salaries" ADD COLUMN "work_seniority_and_role_id" uuid;--> statement-breakpoint
26+
DO $$ BEGIN
27+
ALTER TABLE "salaries" ADD CONSTRAINT "salaries_work_seniority_and_role_id_work_seniority_and_role_id_fk" FOREIGN KEY ("work_seniority_and_role_id") REFERENCES "work_seniority_and_role"("id") ON DELETE no action ON UPDATE no action;
28+
EXCEPTION
29+
WHEN duplicate_object THEN null;
30+
END $$;
31+
--> statement-breakpoint
32+
ALTER TABLE "salaries" DROP COLUMN IF EXISTS "work_role_id";--> statement-breakpoint
33+
ALTER TABLE "work_role" DROP COLUMN IF EXISTS "seniority";--> statement-breakpoint
34+
DO $$ BEGIN
35+
ALTER TABLE "work_seniority_and_role" ADD CONSTRAINT "work_seniority_and_role_work_role_id_work_role_id_fk" FOREIGN KEY ("work_role_id") REFERENCES "work_role"("id") ON DELETE no action ON UPDATE no action;
36+
EXCEPTION
37+
WHEN duplicate_object THEN null;
38+
END $$;
39+
--> statement-breakpoint
40+
DO $$ BEGIN
41+
ALTER TABLE "work_seniority_and_role" ADD CONSTRAINT "work_seniority_and_role_work_seniority_id_work_seniority_id_fk" FOREIGN KEY ("work_seniority_id") REFERENCES "work_seniority"("id") ON DELETE no action ON UPDATE no action;
42+
EXCEPTION
43+
WHEN duplicate_object THEN null;
44+
END $$;

0 commit comments

Comments
 (0)