aboutsummaryrefslogtreecommitdiffstats
path: root/schema.sql
blob: 475c46dd4d195e8f3e65a5eeb44a5979d7288233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
CREATE TABLE IF NOT EXISTS users (
	user_id SERIAL PRIMARY KEY,
	type text,
	op_id text,
	name text,
	email text,
	lfm_name text UNIQUE,
	lfm_password text,
	created timestamptz DEFAULT current_timestamp
);

CREATE TABLE IF NOT EXISTS scrobbling_sessions (
    session_key text PRIMARY KEY,
	lfm_name text REFERENCES users(lfm_name),
    client text,
	client_version text,
    protocol text,
	created timestamptz DEFAULT current_timestamp
);
CREATE TABLE IF NOT EXISTS scrobbles (
	artist text,
	albumartist text,
	trackname text,
	album text,
	tracknumber int,
	duration int,
	time timestamptz,
	chosen bool,
	mbid text,
	mbid_computed text,
	session_key text REFERENCES scrobbling_sessions,
	lfm_name text REFERENCES users(lfm_name)
);

CREATE TABLE IF NOT EXISTS user_sessions (
	id text PRIMARY KEY,
	user_id integer REFERENCES users,
	created timestamptz DEFAULT current_timestamp
);

CREATE TABLE IF NOT EXISTS songs (
	mbid text PRIMARY KEY,
	image text
);