A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 12021dd5c9cdc986605fb791798fa62dbfbc8a74 (2009 bytes)[doc][blame][raw]
1
/* ########## account ########## */2
CREATE TABLE account (3
id serial PRIMARY KEY,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 true9
);11
/* ########## device ########## */12
CREATE TABLE device (13
id serial PRIMARY KEY,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
);20
ALTER TABLE device21
ADD CONSTRAINT device_account_id22
FOREIGN KEY (account_id)23
REFERENCES account(id);25
/* ########## station ########## */26
CREATE TABLE station (27
id serial PRIMARY KEY,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,34
favicon text,35
homepage text,36
tags text[],37
country text,38
languages text[],39
"state" text40
);42
/* ########## like ########## */43
CREATE TABLE "like" (44
id serial PRIMARY KEY,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
);51
ALTER TABLE "like"52
ADD CONSTRAINT like_account_id53
FOREIGN KEY (account_id)54
REFERENCES account(id);56
/* ########## code ########## */57
CREATE TABLE code (58
id serial PRIMARY KEY,59
code text UNIQUE NOT NULL,60
"timestamp" timestamp without time zone NOT NULL,61
used boolean DEFAULT false NOT NULL,62
account_id integer UNIQUE NOT NULL63
);65
ALTER TABLE code66
ADD CONSTRAINT code_account_id67
FOREIGN KEY (account_id)68
REFERENCES account(id);