so://phie

verbal

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 ########## */

2CREATE 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 true

9);

10

11/* ########## device ########## */

12CREATE 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 integer

18);

19

20ALTER TABLE device

21 ADD CONSTRAINT device_account_id

22 FOREIGN KEY (account_id)

23 REFERENCES account(id);

24

25/* ########## station ########## */

26CREATE 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" text

40);

41

42/* ########## like ########## */

43CREATE 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 NULL

49);

50

51ALTER TABLE "like"

52 ADD CONSTRAINT like_account_id

53 FOREIGN KEY (account_id)

54 REFERENCES account(id);

55

56/* ########## code ########## */

57CREATE 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 NULL

63);

64

65ALTER TABLE code

66 ADD CONSTRAINT code_account_id

67 FOREIGN KEY (account_id)

68 REFERENCES account(id);