-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDATABASE_INIT.sql
More file actions
136 lines (103 loc) · 3.18 KB
/
DATABASE_INIT.sql
File metadata and controls
136 lines (103 loc) · 3.18 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
--
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.messages (
id integer NOT NULL,
type character varying DEFAULT 'chat'::character varying NOT NULL,
content text NOT NULL,
"timestamp" timestamp without time zone DEFAULT now() NOT NULL,
room_id integer,
user_id integer
);
ALTER TABLE public.messages OWNER TO postgres;
--
-- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.messages ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.messages_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: rooms; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.rooms (
id integer NOT NULL,
owner_id integer NOT NULL,
name character varying DEFAULT 'New Room'::character varying NOT NULL,
"isPublic" boolean DEFAULT true NOT NULL,
slug character varying NOT NULL
);
ALTER TABLE public.rooms OWNER TO postgres;
--
-- Name: rooms_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.rooms ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.rooms_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: songs; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.songs (
id integer NOT NULL,
"spotifyUri" character varying,
progress bigint DEFAULT '0'::bigint NOT NULL,
"isPaused" boolean DEFAULT true NOT NULL,
"updatedAt" timestamp without time zone DEFAULT now() NOT NULL,
"addedAt" timestamp without time zone DEFAULT now() NOT NULL,
room_id integer,
youtube_video_id character varying,
duration_ms bigint NOT NULL
);
ALTER TABLE ONLY public.songs REPLICA IDENTITY FULL;
ALTER TABLE public.songs OWNER TO postgres;
--
-- Name: COLUMN songs.youtube_video_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.songs.youtube_video_id IS 'If this is a YouTube video, this is the unique video ID.';
--
-- Name: COLUMN songs.duration_ms; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.songs.duration_ms IS 'The duration of the song in milliseconds.';
--
-- Name: songs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.songs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.songs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
id integer NOT NULL,
service character varying DEFAULT 'spotify'::character varying NOT NULL,
online boolean DEFAULT false NOT NULL,
name character varying NOT NULL,
"imageSrc" character varying,
"serviceId" character varying NOT NULL
);
ALTER TABLE public.users OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.users ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);