 ALTER TABLE cc_blockcriteria
 	ADD CONSTRAINT cc_blockcontents_block_id_fkey FOREIGN KEY (block_id) REFERENCES cc_block(id) ON DELETE CASCADE;
 
+ALTER TABLE cc_playlist
+        ADD CONSTRAINT cc_playlist_createdby_fkey FOREIGN KEY (creator_id) REFERENCES cc_subjs(id) ON DELETE CASCADE;
+
 ALTER TABLE cc_playlistcontents
 	ADD CONSTRAINT cc_playlistcontents_block_id_fkey FOREIGN KEY (block_id) REFERENCES cc_block(id) ON DELETE CASCADE;
 

INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_channels', 'stereo', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_channels', 'stereo', 'string');


--clean up database of scheduled items that weren't properly deleted in 2.1.x
--due to a bug

ALTER TABLE cc_files
	DROP CONSTRAINT cc_files_gunid_idx;

DROP INDEX cc_files_file_exists_idx;

DROP TABLE cc_access;

CREATE SEQUENCE cc_block_id_seq
	START WITH 1
