Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Interface suggestions

by dhosek (Beadle)
on Apr 23, 2008 at 01:16 UTC ( [id://682310]=perlquestion: print w/replies, xml ) Need Help??

dhosek has asked for the wisdom of the Perl Monks concerning the following question:

Having taken a closer look at DBIx::Migrations::Directories, I've decided that I want to write my own migration tool for Perl/ORM (likely tied to Rose::DB::Object, but not necessarily). Any thoughts on how the interface should look? I'm modeling functionality at least partially on ActiveRecord from Rails.

I'm leaning towards something along the lines of having a standard migrations directory in the application with numbered migrations in the format

001.create_user_table.m 001.create_data_table.m 002.add_permissions_to_users.m ...

Within a migration you'll have something along the lines of:

sub UP { create_table( name => 'users', key => 'id', fields => { id => 'integer', username => 'string(40)', password => 'string(20)', displayname => 'string(60)', }, ); } sub DOWN { drop_table('users'); }
Although the specifics are still up in the air. I'd appreciate everyone's feedback on this.

Donald Hosek, Tech Lead at oversee.net
L.A. perl people, we're hiring.

Replies are listed 'Best First'.
Re: Interface suggestions
by tachyon-II (Chaplain) on Apr 23, 2008 at 03:08 UTC

    Seems to me the fields key should point to an array ref, rather than a hash ref. Then the create_table function will get them in the ORDER in which they are written, not some random one. Of course as far as the DB is concerned the field order does not really matter, but when it comes to a person looking at the raw table data, or if you are doing the lazy SELECT *.....

      Good point. Apparently no one else is concerned about how to do this.

      Donald Hosek, Tech Lead at oversee.net
      L.A. perl people, we're hiring.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://682310]
Approved by grep
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-18 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found