[Dbix-class] Local DB Mirror
Ashley
apv at sedition.com
Tue Jul 21 02:26:54 GMT 2009
On Jul 20, 2009, at 7:07 PM, fREW Schmidt wrote:
> I was thinking it would be cool to do more local development, and
> the only thing tethering me to the VPN is our database server (SQL
> Server,) fortunately for this plan the only really special thing I
> do in the database is FK constraints and maybe a few non-standard
> defaults (now() etc.) But I think for the most part that stuff
> will be fine to ignore for non-local development. Anyway, does
> anyone have any idea how I could use DBIC to mirror a server into
> an sqlite database? Thanks!
You should be able to mirror the data into SQLite pretty easily with
SQL tools. SQLite doesn't care about column contents so it would
happily load anything, I think. WRT the DBIC compatibility, I was
playing with code for a shim for this between MySQL last week. I
didn't have much time to do anything fancy but I did have some
success; don't have it in front of me though.
The thrust of it is you can define functions in SQLite via the
wonderful DBD::SQLite engine so you just go through and define the
compatibility level functions like "NOW()" which was the one I did to
see if it would work. I was toying with releasing it to the CPAN as a
skeleton with the hopes of getting contributions from everyone to
build it out so that you could use schema->deploy( SQLite ) with code
that does functions etc from PostgreSQL or MySQL or...
http://search.cpan.org/dist/DBD-SQLite/lib/DBD/SQLite.pm
Look at these:
# $dbh->sqlite_create_function( $name, $argc, $code_ref )
# $dbh->sqlite_create_collation( $name, $code_ref )
# $dbh->sqlite_create_aggregate( $name, $argc, $pkg )
-Ashley
More information about the DBIx-Class
mailing list