aboutsummaryrefslogtreecommitdiffstats
path: root/schema.sql
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2017-06-04 19:30:25 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2017-06-04 19:30:25 -0400
commit81522cbae16c6aadb1b789f3f875dc50f10cc005 (patch)
treeab95db0a843783d4cfcd328e091a01597e241ee1 /schema.sql
parentf154ae1ec88146017abf3de9d14d119facb5fc4c (diff)
downloadlastfm-api-81522cbae16c6aadb1b789f3f875dc50f10cc005.tar.gz
Clean up
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql48
1 files changed, 26 insertions, 22 deletions
diff --git a/schema.sql b/schema.sql
index fb13dc7..475c46d 100644
--- a/schema.sql
+++ b/schema.sql
@@ -1,37 +1,41 @@
+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 (
- lfm_name text,
- key text PRIMARY KEY,
+ 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,
+ artist text,
albumartist text,
- trackname text,
- album text,
+ trackname text,
+ album text,
tracknumber int,
- duration int,
- time timestamptz,
- chosen bool,
- mbid text,
- session text
-);
-
-CREATE TABLE IF NOT EXISTS users (
- user_id SERIAL PRIMARY KEY,
- type text,
- op_id text,
- name text,
- email text,
- lfm_name text,
- lfm_password text
+ 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
+ user_id integer REFERENCES users,
+ created timestamptz DEFAULT current_timestamp
);
CREATE TABLE IF NOT EXISTS songs (