[Dbix-class] Local DB Mirror

Ashley apv at sedition.com
Tue Jul 21 04:15:24 GMT 2009


On Jul 20, 2009, at 8:19 PM, fREW Schmidt wrote:
> On Mon, Jul 20, 2009 at 10:10 PM, Ashley <apv at sedition.com> wrote:
> On Jul 20, 2009, at 7:52 PM, fREW Schmidt wrote:
> Very interesting!  How did you generate the table structure for the  
> SQLite database?
> Still, I think deploy is a really hot feature and I'm so glad it's  
> become more mature/stable lately along with the pieces it relies on  
> like SQL::Translator; the folks who work on those rule. Check out  
> DBIx::Class::Fixtures too. Chocolate and peanut-butter.
>
> Interesting.  I assumed that might be how you pull it off.  Our  
> models don't have any column type information, but I doubt that  
> will be an issue since everything in SQLite is just TEXT or BLOB or  
> whatever.  One last question.  Did you dump the SQL statements with  
> perl or MySQL?

I think that's a trick to answer. You don't need to dump any SQL at  
all. I happen to do so because I use the Loader stuff to create my  
schemata but I'm dumping definitions (because SQLite has no FK  
support yet). Your DBIC classes create the DB and from there you  
could--never tried it but it should work fine--use the original DB  
via a connected schema to populate the new DB via its own connected  
schema. Then just iterate through the DB that has data copying it to  
the one that doesn't.

If your original DB has the FKs and such you could recreate your  
schema dynamically from a connection to it. See http:// 
search.cpan.org/dist/DBIx-Class-Schema-Loader/lib/DBIx/Class/Schema/ 
Loader.pm#make_schema_at

The data transfer would be (possibly extremely) slow on a big DB and  
dumping SQL in some standard format and reloading would be faster and  
maybe easier if you can find the right docs and flags; which I  
couldn't help with off-hand.

-Ashley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090720/bf36e4d5/attachment-0001.htm


More information about the DBIx-Class mailing list