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
|
@ -1,6 +1,6 @@
|
|||
#Note: project.home is automatically generated by the propel-install script.
|
||||
#Any manual changes to this value will be overwritten.
|
||||
project.home = /home/james/src/airtime/airtime_mvc
|
||||
project.home = /home/naomiaro/airtime/airtime_mvc
|
||||
project.build = ${project.home}/build
|
||||
|
||||
#Database driver
|
||||
|
|
|
@ -216,16 +216,19 @@
|
|||
<table name="cc_playlist" phpName="CcPlaylist">
|
||||
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
||||
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
||||
<column name="state" phpName="DbState" type="VARCHAR" size="128" required="true" defaultValue="empty"/>
|
||||
<column name="currentlyaccessing" phpName="DbCurrentlyaccessing" type="INTEGER" required="true" defaultValue="0"/>
|
||||
<column name="editedby" phpName="DbEditedby" type="INTEGER" required="false"/>
|
||||
<column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="false"/>
|
||||
<column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="false"/>
|
||||
<column name="lptime" phpName="DbLPtime" type="TIMESTAMP" size="6" required="false"/>
|
||||
<column name="creator" phpName="DbCreator" type="VARCHAR" size="32" required="false"/>
|
||||
<column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="false"/>
|
||||
<column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/>
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_playlist_editedby_fkey">
|
||||
<reference local="editedby" foreign="id"/>
|
||||
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00"/>
|
||||
<behavior name="aggregate_column">
|
||||
<parameter name="name" value="length" />
|
||||
<parameter name="foreign_table" value="cc_playlistcontents" />
|
||||
<parameter name="expression" value="SUM(cliplength)" />
|
||||
</behavior>
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_playlist_createdby_fkey">
|
||||
<reference local="creator_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
<table name="cc_playlistcontents" phpName="CcPlaylistcontents">
|
||||
|
|
|
@ -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