A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 4b8d96c344c3a3928af945daf5a1e34a1118badf (1992 bytes)[doc][blame][raw]
1
/* ### station ### */3
CREATE TABLE station (4
id SERIAL PRIMARY KEY,5
uid TEXT UNIQUE,6
name TEXT NOT NULL,7
url TEXT NOT NULL,8
icon TEXT,9
homepage TEXT,10
tags TEXT[],11
country TEXT,12
state TEXT,13
languages TEXT[],14
score INTEGER,15
description TEXT,16
color TEXT17
);19
/* ### station status ### */21
CREATE TABLE station_status (22
id SERIAL PRIMARY KEY,23
station_id INTEGER UNIQUE,24
is_restricted BOOLEAN DEFAULT false,25
is_broken BOOLEAN DEFAULT false,26
is_no_track_info BOOLEAN DEFAULT false,27
is_hidden BOOLEAN DEFAULT false,28
is_icon BOOLEAN DEFAULT false29
);31
ALTER TABLE station_status32
ADD CONSTRAINT station_status_station_id33
FOREIGN KEY (station_id)34
REFERENCES station(id);36
/* ### account ### */38
CREATE TABLE account (39
id SERIAL PRIMARY KEY,40
name TEXT,41
language TEXT DEFAULT 'en'42
);44
/* ### device ### */46
CREATE TABLE device (47
id SERIAL PRIMARY KEY,48
uid TEXT UNIQUE NOT NULL,49
name TEXT,50
account_id INTEGER51
);53
ALTER TABLE device54
ADD CONSTRAINT device_account_id55
FOREIGN KEY (account_id)56
REFERENCES account(id);58
/* ### favorite ### */60
CREATE TABLE favorite (61
id SERIAL PRIMARY KEY,62
account_id INTEGER,63
station_id INTEGER64
);66
ALTER TABLE favorite67
ADD CONSTRAINT favorite_account_id68
FOREIGN KEY (account_id)69
REFERENCES account(id);71
ALTER TABLE favorite72
ADD CONSTRAINT favorite_station_id73
FOREIGN KEY (station_id)74
REFERENCES station(id);76
CREATE TABLE station_stats (77
id SERIAL PRIMARY KEY,78
account_id INTEGER,79
station_id INTEGER,80
playtime INTEGER DEFAULT 081
);83
ALTER TABLE station_stats84
ADD CONSTRAINT station_stats_unique85
UNIQUE(account_id, station_id);87
ALTER TABLE station_stats88
ADD CONSTRAINT station_stats_account_id89
FOREIGN KEY (account_id)90
REFERENCES account(id);92
ALTER TABLE station_stats93
ADD CONSTRAINT station_stats_station_id94
FOREIGN KEY (station_id)95
REFERENCES station(id);