cc-4304: fixed ticket by deleting playlists when user is deleted. also removed useless index on file_exists

-add database modifications to upgrade.sql script
This commit is contained in:
Martin Konecny 2012-10-23 13:52:11 -04:00
parent 2d6be404d4
commit 943d5f2a72

View file

@ -14,6 +14,13 @@ INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_channels', 'ste
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_channels', 'stereo', 'string');
CREATE FUNCTION airtime_to_int(chartoconvert character varying) RETURNS integer
AS
'SELECT CASE WHEN trim($1) SIMILAR TO ''[0-9]+'' THEN CAST(trim($1) AS integer) ELSE NULL END;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
--clean up database of scheduled items that weren't properly deleted in 2.1.x
--due to a bug
DELETE
@ -27,14 +34,9 @@ WHERE id IN
ALTER TABLE cc_files
DROP CONSTRAINT cc_files_gunid_idx;
DROP TABLE cc_access;
DROP INDEX cc_files_file_exists_idx;
CREATE FUNCTION airtime_to_int(chartoconvert character varying) RETURNS integer
AS
'SELECT CASE WHEN trim($1) SIMILAR TO ''[0-9]+'' THEN CAST(trim($1) AS integer) ELSE NULL END;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
DROP TABLE cc_access;
CREATE SEQUENCE cc_block_id_seq
START WITH 1
@ -176,6 +178,9 @@ ALTER TABLE cc_blockcontents
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;