aboutsummaryrefslogtreecommitdiffstats
path: root/schema.sql
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2017-06-03 18:00:51 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2017-06-03 18:00:51 -0400
commitf154ae1ec88146017abf3de9d14d119facb5fc4c (patch)
treecd857864dd52b088ccc8943b64fe9bbd59c04dc8 /schema.sql
parent3f3cb7c7cede379914eed51c57e58f66ffdd1856 (diff)
downloadlastfm-api-f154ae1ec88146017abf3de9d14d119facb5fc4c.tar.gz
Basic web app
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql35
1 files changed, 25 insertions, 10 deletions
diff --git a/schema.sql b/schema.sql
index 72211ee..fb13dc7 100644
--- a/schema.sql
+++ b/schema.sql
@@ -1,25 +1,40 @@
-CREATE TABLE users (
- name text PRIMARY KEY,
- password text
-);
-
-CREATE TABLE sessions (
- user text,
+CREATE TABLE IF NOT EXISTS scrobbling_sessions (
+ lfm_name text,
key text PRIMARY KEY,
client text,
protocol text,
- created int DEFAULT (strftime('%s', 'now'))
+ created timestamptz DEFAULT current_timestamp
);
-CREATE TABLE scrobbles (
+CREATE TABLE IF NOT EXISTS scrobbles (
artist text,
albumartist text,
trackname text,
album text,
tracknumber int,
duration int,
- time 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
+);
+
+CREATE TABLE IF NOT EXISTS user_sessions (
+ id text PRIMARY KEY,
+ user_id integer REFERENCES users
+);
+
+CREATE TABLE IF NOT EXISTS songs (
+ mbid text PRIMARY KEY,
+ image text
+);