A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
1
/* ########## account ########## */2
CREATE TABLE account (3
id serial PRIMARY KEY,4
created_at timestamp without time zone NOT NULL,5
updated_at timestamp without time zone NOT NULL,4
created_at timestamp without time zone NOT NULL DEFAULT current_timestamp,5
updated_at timestamp without time zone NOT NULL DEFAULT current_timestamp,6
username text,7
language character(2) DEFAULT 'en',8
is_playback_history boolean DEFAULT true
11
/* ########## device ########## */12
CREATE TABLE device (13
id serial PRIMARY KEY,14
created_at timestamp without time zone NOT NULL,15
updated_at timestamp without time zone NOT NULL,14
created_at timestamp without time zone NOT NULL DEFAULT current_timestamp,15
updated_at timestamp without time zone NOT NULL DEFAULT current_timestamp,16
token text UNIQUE NOT NULL,17
account_id integer18
);
25
/* ########## station ########## */26
CREATE TABLE station (27
id serial PRIMARY KEY,28
created_at timestamp without time zone NOT NULL,29
updated_at timestamp without time zone NOT NULL,28
uuid TEXT UNIQUE,29
created_at timestamp without time zone NOT NULL DEFAULT current_timestamp,30
updated_at timestamp without time zone NOT NULL DEFAULT current_timestamp,31
"name" text NOT NULL,32
stream_url text NOT NULL,33
votes integer DEFAULT 0,
39
"state" text40
);41
/* ########## favorite ########## */42
CREATE TABLE favorite (42
/* ########## like ########## */43
CREATE TABLE "like" (44
id serial PRIMARY KEY,44
created_at timestamp without time zone NOT NULL,45
updated_at timestamp without time zone NOT NULL,45
created_at timestamp without time zone NOT NULL DEFAULT current_timestamp,46
updated_at timestamp without time zone NOT NULL DEFAULT current_timestamp,47
station_id text NOT NULL,48
account_id integer NOT NULL49
);50
ALTER TABLE favorite51
ADD CONSTRAINT favorite_account_id51
ALTER TABLE "like"52
ADD CONSTRAINT like_account_id53
FOREIGN KEY (account_id)54
REFERENCES account(id);55
ALTER TABLE favorite56
ADD CONSTRAINT favorite_station_id57
FOREIGN KEY (station_id)58
REFERENCES station(id);56
/* ########## code ########## */57
CREATE TABLE code (58
id serial PRIMARY KEY,