DROP TABLE songs;
DROP TABLE config;

CREATE TABLE songs (
	id		INTEGER PRIMARY KEY NOT NULL,
	path		VARCHAR(4096) NOT NULL,
	fname		VARCHAR(255) NOT NULL,
        title		VARCHAR(1024) DEFAULT NULL,
	artist 		VARCHAR(1024) DEFAULT NULL,
	album		VARCHAR(1024) DEFAULT NULL,
	genre		VARCHAR(255) DEFAULT NULL,
	comment 	VARCHAR(4096) DEFAULT NULL,
	type		VARCHAR(255) DEFAULT NULL,
	composer	VARCHAR(1024) DEFAULT NULL,
	orchestra	VARCHAR(1024) DEFAULT NULL,
	conductor	VARCHAR(1024) DEFAULT NULL,
	grouping	VARCHAR(1024) DEFAULT NULL,
	url		VARCHAR(1024) DEFAULT NULL,
	bitrate		INTEGER DEFAULT NULL,
	samplerate	INTEGER DEFAULT NULL,
	song_length	INTEGER DEFAULT NULL,
	file_size	INTEGER DEFAULT NULL,
	year		INTEGER DEFAULT NULL,
	track		INTEGER DEFAULT NULL,
	total_tracks	INTEGER DEFAULT NULL,
	disc		INTEGER DEFAULT NULL,
	total_discs	INTEGER DEFAULT NULL,
	time_added	INTEGER DEFAULT NULL,
	time_modified	INTEGER DEFAULT NULL,
	time_played	INTEGER	DEFAULT NULL,
	db_timestamp	INTEGER DEFAULT NULL,
	bpm		INTEGER DEFAULT NULL,
	compilation	INTEGER DEFAULT NULL
);	

CREATE TABLE config (
	term		VARCHAR(255)	NOT NULL,
	value		VARCHAR(1024)	NOT NULL
);

#CREATE INDEX idx_id ON songs(id);
#CREATE INDEX idx_path on songs(path);

INSERT INTO config (term, value) VALUES ('version','8');
