CC-3174 : showbuilder
changing playlist table to remove unused columns, adding foreign key to user, adding aggregate length column.
This commit is contained in:
parent
38f3d6bfb0
commit
e8f2506474
18 changed files with 416 additions and 459 deletions
|
@ -288,14 +288,12 @@ CREATE TABLE "cc_playlist"
|
|||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) default '' NOT NULL,
|
||||
"state" VARCHAR(128) default 'empty' NOT NULL,
|
||||
"currentlyaccessing" INTEGER default 0 NOT NULL,
|
||||
"editedby" INTEGER,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"lptime" TIMESTAMP(6),
|
||||
"creator" VARCHAR(32),
|
||||
"creator_id" INTEGER,
|
||||
"description" VARCHAR(512),
|
||||
"length" interval default '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
@ -575,7 +573,7 @@ ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey" FOREIGN KEY ("sho
|
|||
|
||||
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey" FOREIGN KEY ("subjs_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id");
|
||||
ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id");
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
|
||||
|
||||
|
|
|
@ -3,26 +3,5 @@
|
|||
----------------------------------------------------------------------------------
|
||||
DROP FUNCTION calculate_position() CASCADE;
|
||||
|
||||
/* remove this trigger for group adds/delete */
|
||||
|
||||
/*
|
||||
CREATE FUNCTION calculate_position() RETURNS trigger AS
|
||||
'
|
||||
BEGIN
|
||||
IF(TG_OP=''INSERT'') THEN
|
||||
UPDATE cc_playlistcontents SET position = (position + 1)
|
||||
WHERE (playlist_id = new.playlist_id AND position >= new.position AND id != new.id);
|
||||
END IF;
|
||||
IF(TG_OP=''DELETE'') THEN
|
||||
UPDATE cc_playlistcontents SET position = (position - 1)
|
||||
WHERE (playlist_id = old.playlist_id AND position > old.position);
|
||||
END IF;
|
||||
RETURN NULL;
|
||||
END;
|
||||
'
|
||||
LANGUAGE 'plpgsql';
|
||||
|
||||
CREATE TRIGGER calculate_position AFTER INSERT OR DELETE ON cc_playlistcontents
|
||||
FOR EACH ROW EXECUTE PROCEDURE calculate_position();
|
||||
*/
|
||||
--remove this trigger for group adds/delete
|
||||
|
||||
|
|
|
@ -2,10 +2,4 @@
|
|||
---cc_playlisttimes
|
||||
-------------------------------------------------------
|
||||
|
||||
CREATE VIEW cc_playlisttimes AS
|
||||
SELECT pl.id, COALESCE(t.length, '00:00:00'::time without time zone) AS length
|
||||
FROM cc_playlist pl
|
||||
LEFT JOIN ( SELECT cc_playlistcontents.playlist_id AS id,
|
||||
sum(cc_playlistcontents.cliplength::interval)::time without time zone AS length
|
||||
FROM cc_playlistcontents
|
||||
GROUP BY cc_playlistcontents.playlist_id) t ON pl.id = t.id;
|
||||
DROP VIEW cc_playlisttimes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue