-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path0001_userHistoryItems_init.sql
81 lines (57 loc) · 2.44 KB
/
0001_userHistoryItems_init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.5 (Debian 11.5-3.pgdg90+1)
-- Dumped by pg_dump version 12.4
-- SET statement_timeout = 0;
-- SET lock_timeout = 0;
-- SET idle_in_transaction_session_timeout = 0;
-- SET client_encoding = 'UTF8';
-- SET standard_conforming_strings = on;
-- SELECT pg_catalog.set_config('search_path', '', false);
-- SET check_function_bodies = false;
-- SET xmloption = content;
-- SET client_min_messages = warning;
-- SET row_security = off;
-- SET default_tablespace = '';
--
-- Name: userHistoryItems; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public."userHistoryItems" (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
"orderChangedDate" timestamp without time zone DEFAULT now() NOT NULL,
"userPlaybackPosition" integer DEFAULT 0 NOT NULL,
"createdAt" timestamp without time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp without time zone DEFAULT now() NOT NULL,
"episodeId" character varying(14),
"mediaRefId" character varying(14),
"ownerId" character varying(14) NOT NULL
);
ALTER TABLE public."userHistoryItems" OWNER TO postgres;
--
-- Name: userHistoryItems PK_1e5be3f925a1a9b2b81f47b26a8; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."userHistoryItems"
ADD CONSTRAINT "PK_1e5be3f925a1a9b2b81f47b26a8" PRIMARY KEY (id);
--
-- Name: IDX_e43c5eb439402e4f0622673661; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX "IDX_e43c5eb439402e4f0622673661" ON public."userHistoryItems" USING btree ("ownerId");
--
-- Name: userHistoryItems FK_acfcaa8bcf9c198372a9b90207b; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."userHistoryItems"
ADD CONSTRAINT "FK_acfcaa8bcf9c198372a9b90207b" FOREIGN KEY ("episodeId") REFERENCES public.episodes(id) ON DELETE CASCADE;
--
-- Name: userHistoryItems FK_e43c5eb439402e4f06226736619; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."userHistoryItems"
ADD CONSTRAINT "FK_e43c5eb439402e4f06226736619" FOREIGN KEY ("ownerId") REFERENCES public.users(id) ON DELETE CASCADE;
--
-- Name: userHistoryItems FK_e87e78a873e585bbd2f544ee2ae; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."userHistoryItems"
ADD CONSTRAINT "FK_e87e78a873e585bbd2f544ee2ae" FOREIGN KEY ("mediaRefId") REFERENCES public."mediaRefs"(id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--