feat(db): add stream_sessions model for phase4 on-demand live flow
This commit is contained in:
18
Backend/drizzle/0007_live_stream_sessions.sql
Normal file
18
Backend/drizzle/0007_live_stream_sessions.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE "stream_sessions" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"owner_user_id" uuid NOT NULL,
|
||||
"camera_device_id" uuid NOT NULL,
|
||||
"requester_device_id" uuid NOT NULL,
|
||||
"status" varchar(32) DEFAULT 'requested' NOT NULL,
|
||||
"reason" varchar(32) DEFAULT 'on_demand' NOT NULL,
|
||||
"stream_key" varchar(255),
|
||||
"started_at" timestamp with time zone,
|
||||
"ended_at" timestamp with time zone,
|
||||
"metadata" jsonb DEFAULT 'null'::jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "stream_sessions" ADD CONSTRAINT "stream_sessions_owner_user_id_users_id_fk" FOREIGN KEY ("owner_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "stream_sessions" ADD CONSTRAINT "stream_sessions_camera_device_id_devices_id_fk" FOREIGN KEY ("camera_device_id") REFERENCES "public"."devices"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "stream_sessions" ADD CONSTRAINT "stream_sessions_requester_device_id_devices_id_fk" FOREIGN KEY ("requester_device_id") REFERENCES "public"."devices"("id") ON DELETE no action ON UPDATE no action;
|
||||
@@ -50,6 +50,13 @@
|
||||
"when": 1770413956419,
|
||||
"tag": "0006_steady_control_plane",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 7,
|
||||
"version": "7",
|
||||
"when": 1770414956419,
|
||||
"tag": "0007_live_stream_sessions",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user