forked from dundercard/dundercard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Festival Playlist Schema_postgres_create.sql
91 lines (65 loc) · 2 KB
/
Festival Playlist Schema_postgres_create.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
81
82
83
84
85
86
87
88
89
90
91
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;
-- Insert sample data from SongPick Api
-- Test the successful saving of a user's cookies/session values into SQL
CREATE TABLE public.users (
"id" bigint NOT NULL,
"name" varchar,
"spotify_id" varchar,
"auth_token" varchar,
"access_token" varchar,
"refresh_token" varchar,
"festivals" TEXT
) WITH (
OIDS=FALSE
);
CREATE TABLE public.artists (
"id" serial NOT NULL,
"name" varchar,
"spotify_id" varchar NOT NULL,
CONSTRAINT "Artists_pk" PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
-- CREATE TABLE public.people (
-- "id" serial NOT NULL,
-- "name" varchar NOT NULL,
-- "artists_id" bigint,
-- "festivals_id" bigint,
-- CONSTRAINT "people_pk" PRIMARY KEY ("id")
-- ) WITH (
-- OIDS=FALSE
-- );
-- CREATE TABLE public.festivals (
-- "_id" serial NOT NULL,
-- "name" varchar NOT NULL,
-- CONSTRAINT "festivals_pk" PRIMARY KEY ("_id")
-- ) WITH (
-- OIDS=FALSE
-- );
-- CREATE TABLE public.artists (
-- "id" serial NOT NULL,
-- "name" varchar NOT NULL,
-- CONSTRAINT "artists_pk" PRIMARY KEY ("id")
-- ) WITH (
-- OIDS=FALSE
-- );
-- CREATE TABLE public.songs (
-- "_id" serial NOT NULL,
-- "name" varchar NOT NULL,
-- CONSTRAINT "songs_pk" PRIMARY KEY ("_id")
-- ) WITH (
-- OIDS=FALSE
-- );
-- ALTER TABLE public.people ADD CONSTRAINT "people_fk0" FOREIGN KEY ("artists_id") REFERENCES public.artists("id");
-- ALTER TABLE public.people ADD CONSTRAINT "people_fk1" FOREIGN KEY ("festivals_id") REFERENCES public.festivals("_id");
-- ALTER TABLE public.festivals ADD CONSTRAINT "festivals_fk0" FOREIGN KEY ("_id") REFERENCES public.artists("id");
-- ALTER TABLE public.artists ADD CONSTRAINT "artists_fk0" FOREIGN KEY ("id") REFERENCES public.songs("_id");