Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Thanks for the plug ;)

If you're using Alzabo to manage your schema structure then using it as part of an install/update process is trivial. Here's some sample code from a Module::Build subclass I wrote:

sub ACTION_update_db { $_[0]->_update_db; } sub _update_db { my $self = shift; $self->depends_on('install'); require Alzabo::Create::Schema; my $schema_svn_dir = File::Spec->catdir ( $self->base_dir, 'alzabo-schema-files', 'NameOfSchema' ); my $to_dir = File::Spec->catdir ( Alzabo::Config::schema_dir(), 'NameOfSchema' ); my $copied; foreach my $file ( glob File::Spec->catfile ( $schema_svn_dir, 'NameOfSchema.*' ) ) { my $file = $self->copy_if_modified( from => $file, to_dir => $to_dir, flatten => 1, ); $copied = $file if defined $file; } return unless $copied; require Alzabo::Create::Schema; my $s = Alzabo::Create::Schema->load_from_file ( name => 'NameOfSchema' ); my %connect = ( user => 'username', password => 'password', ); if ( grep { /NameOfSchema/ } $s->driver->schemas(%connect) ) { # This makes the live schema in the database look # like the schema stored in the Alzabo data files. $s->sync_backend(%connect); } else { $s->set_instantiated(0); $s->create(%connect); } }

This code can be run as its own action (./Build update_db), and it's also run when the install action is run. It's pretty darn convenient.


In reply to Re: Re: OT: Ways of managing changes to a database's structure during a project. by autarch
in thread OT: Ways of managing changes to a database's structure during a project. by EvdB

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2014-10-25 21:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (149 votes), past polls