CREATE TABLE IF NOT EXISTS scrobbling_sessions (
	lfm_name text,
    key text PRIMARY KEY,
    client 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,
	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
);
