CREATE TABLE IF NOT EXISTS track (
	filepath TEXT PRIMARY KEY,
	artist TEXT,
	albumartist TEXT,
	album TEXT,
	title TEXT,
	date TEXT,
	discnumber TEXT,
	tracknumber TEXT,
	genre TEXT,
	duration FLOAT,
	last_modified FLOAT
);

CREATE TABLE IF NOT EXISTS playlist (
	id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
	name TEXT UNIQUE
);

CREATE TABLE IF NOT EXISTS playlist_track (
	playlist_id INT REFERENCES playlist (id) ON UPDATE CASCADE ON DELETE CASCADE,
	filepath TEXT REFERENCES track (filepath) ON UPDATE CASCADE ON DELETE CASCADE,
	CONSTRAINT playlist_track_pkey PRIMARY KEY (playlist_id, filepath)
);
