A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: e75b1f6d67b46b84979e2fe1e4438695fd349ee1 (1976 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 TEXT16
);18
/* ### station status ### */20
CREATE TABLE station_status (21
id SERIAL PRIMARY KEY,22
station_id INTEGER UNIQUE,23
is_restricted BOOLEAN DEFAULT false,24
is_broken BOOLEAN DEFAULT false,25
is_no_track_info BOOLEAN DEFAULT false,26
is_hidden BOOLEAN DEFAULT false,27
is_icon BOOLEAN DEFAULT false28
);30
ALTER TABLE station_status31
ADD CONSTRAINT station_status_station_id32
FOREIGN KEY (station_id)33
REFERENCES station(id);35
/* ### account ### */37
CREATE TABLE account (38
id SERIAL PRIMARY KEY,39
name TEXT,40
language TEXT DEFAULT 'en'41
);43
/* ### device ### */45
CREATE TABLE device (46
id SERIAL PRIMARY KEY,47
uid TEXT UNIQUE NOT NULL,48
name TEXT,49
account_id INTEGER50
);52
ALTER TABLE device53
ADD CONSTRAINT device_account_id54
FOREIGN KEY (account_id)55
REFERENCES account(id);57
/* ### favorite ### */59
CREATE TABLE favorite (60
id SERIAL PRIMARY KEY,61
account_id INTEGER,62
station_id INTEGER63
);65
ALTER TABLE favorite66
ADD CONSTRAINT favorite_account_id67
FOREIGN KEY (account_id)68
REFERENCES account(id);70
ALTER TABLE favorite71
ADD CONSTRAINT favorite_station_id72
FOREIGN KEY (station_id)73
REFERENCES station(id);75
CREATE TABLE station_stats (76
id SERIAL PRIMARY KEY,77
account_id INTEGER,78
station_id INTEGER,79
playtime INTEGER DEFAULT 080
);82
ALTER TABLE station_stats83
ADD CONSTRAINT station_stats_unique84
UNIQUE(account_id, station_id);86
ALTER TABLE station_stats87
ADD CONSTRAINT station_stats_account_id88
FOREIGN KEY (account_id)89
REFERENCES account(id);91
ALTER TABLE station_stats92
ADD CONSTRAINT station_stats_station_id93
FOREIGN KEY (station_id)94
REFERENCES station(id);