[Dbix-class] copying between databases

Brandon Black blblack at gmail.com
Fri Feb 10 00:37:05 CET 2006


On 2/9/06, Alan Humphrey <alan.humphrey at comcast.net> wrote:
> OK, I'm stumped again.  I tried your technique, modified to allow more
> freedom for updates (as opposed to inserts).  That quickly led to the
> realization that many-to-many relationships meant we'd be spidering the bulk
> of the database on each "publish".  No good.
>
> So I decided to take the 80% solution and just update directly related
> records.  The result is this:
>

Just another random idea, but possible a more robust (but probably
more difficult to implement) solution would be to add some optional
support to DBIC to do transaction logging at the DBIC level. 
Essentially you'd specify a special table in the database as your
transaction log (it would have an auto-inc PK and a long text field
basically), and every time DBIx::Class issues an insert/update/delete
operation via the usual mechanisms, it first logs the statement to
that table.  Then for migration to production you can just replay the
statements in that table in-order on the production db, and delete
them the staging log table as you commit them to production.

-- Brandon



More information about the Dbix-class mailing list