Skip to content

Commit 5eb9456

Browse files
th-212: Shift service (#221)
* th-212: + create shift logic * th-212: + close shift logic * th-212: + getShifts logic * th-212: * correct authstrategy * th-212: * linter * th-212: * correct access logic * th-212: * rename driverId * th-212: * change checking access, naming * th-212: * change path, add swagger * th-212: * correct map func * th-212: * correct diagram
1 parent 85f8c68 commit 5eb9456

34 files changed

+1635
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CREATE TABLE IF NOT EXISTS
2+
"shifts" (
3+
"id" serial PRIMARY KEY NOT NULL,
4+
"start_date" timestamp NOT NULL,
5+
"end_date" timestamp,
6+
"driver_id" integer NOT NULL,
7+
"truck_id" integer NOT NULL,
8+
"created_at" timestamp DEFAULT now() NOT NULL,
9+
"updated_at" timestamp DEFAULT now() NOT NULL,
10+
"deleted_at" timestamp
11+
);
12+
13+
--> statement-breakpoint
14+
DO $$ BEGIN
15+
ALTER TABLE "shifts" ADD CONSTRAINT "shifts_driver_id_users_id_fk" FOREIGN KEY ("driver_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action;
16+
EXCEPTION
17+
WHEN duplicate_object THEN null;
18+
END $$;
19+
20+
--> statement-breakpoint
21+
DO $$ BEGIN
22+
ALTER TABLE "shifts" ADD CONSTRAINT "shifts_truck_id_trucks_id_fk" FOREIGN KEY ("truck_id") REFERENCES "trucks"("id") ON DELETE no action ON UPDATE no action;
23+
EXCEPTION
24+
WHEN duplicate_object THEN null;
25+
END $$;

0 commit comments

Comments
 (0)