Please sign in to comment.
Add triggers to prevent desk asset drift.
There are two disconnected places in the databases where the assets on desks are tracked. One is the `desk__id` column in the `story`, `media`, and `template` tables. The other is "asset groups." These are kind of nasty, but necessary in order for permissions to work properly. Unfortunately, these two sources can drift from one another. So this commit adds a migration that corrects any existing drift, and then adds triggers to prevent it in the future. This required a few other changes: * The installer now installs PL/pgSQL, which is required for the trigger functions. If the database is created in advance, it must include PL/pgSQL or the installation will fail. * Bric::Biz::Workflow::Parts::Desk now has to save its corresponding asset group before it saves the assets in that group with new IDs. This won't usually be necessary, since the trigger executes at transaction commmit time, but tests run under autocommit, and so generated quite a lot of errors. By making the order of execution a little saner, the errors go away and all tests pass. For now, there are no corresponding triggers for MySQL. I *think* MySQL 5 can do the same thing (or close to it), but I don't have the energy to figure out how just now. [#272 state:resolved]
- Loading branch information...
Showing with 746 additions and 5 deletions.
- +16 −0 inst/dbload_Pg.pl
- +425 −0 inst/upgrade/2.1.0/add_desk_triggers.pl
- +2 −2 lib/Bric/Admin.pod
- +3 −3 lib/Bric/Biz/Workflow/Parts/Desk.pm
- +10 −0 lib/Bric/Changes.pod
- +96 −0 sql/Pg/Bric/Biz/Asset/Business/Media.con
- +98 −0 sql/Pg/Bric/Biz/Asset/Business/Story.con
- +96 −0 sql/Pg/Bric/Biz/Asset/Template.con
Oops, something went wrong.