A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 70b819955f24e2b76fe9e321e06bc1b914a9189f (1909 bytes)[doc][blame][raw]
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,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,15
updated_at timestamp without time zone NOT NULL,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
created_at timestamp without time zone NOT NULL,29
updated_at timestamp without time zone NOT NULL,30
"name" text NOT NULL,31
stream_url text NOT NULL,32
votes integer DEFAULT 0,33
favicon text,34
homepage text,35
tags text[],36
country text,37
languages text[],38
"state" text39
);41
/* ########## favorite ########## */42
CREATE TABLE favorite (43
id serial PRIMARY KEY,44
created_at timestamp without time zone NOT NULL,45
updated_at timestamp without time zone NOT NULL,46
station_id text NOT NULL,47
account_id integer NOT NULL48
);50
ALTER TABLE favorite51
ADD CONSTRAINT favorite_account_id52
FOREIGN KEY (account_id)53
REFERENCES account(id);55
ALTER TABLE favorite56
ADD CONSTRAINT favorite_station_id57
FOREIGN KEY (station_id)58
REFERENCES station(id);60
/* ########## code ########## */61
CREATE TABLE code (62
id serial PRIMARY KEY,63
code text UNIQUE NOT NULL,64
"timestamp" timestamp without time zone NOT NULL,65
used boolean DEFAULT false NOT NULL,66
account_id integer UNIQUE NOT NULL67
);69
ALTER TABLE code70
ADD CONSTRAINT code_account_id71
FOREIGN KEY (account_id)72
REFERENCES account(id);