Anego - The database migration utility as our elder sister.
# show status
$ anego status
RDBMS: MySQL
Database: myapp
Schema class: MyApp::DB::Schema (lib/MyApp/DB/Schema.pm)
Hash Commit message
--------------------------------------------------
e299e9f commit
1fdc91a initial commit
# migrate to latest schema
$ anego migrate
# migrate to schema of specified revision
$ anego migrate revision 1fdc91a
# show difference between current database schema and latest schema
$ anego diff
# show difference between current database schema and schema of specified revision
$ anego diff revision 1fdc91a
Anego is database migration utility.
Anego requires configuration file.
In default, Anego uses .anego.pl
as configuration file.
# .anego.pl
+{
connect_info => ['dbi:mysql:database=myapp;host=localhost', 'root'],
schema_class => 'MyApp::DB::Schema',
}
If you want to use other files for configuration, you can use -c
option: anego status -c ./config.pl
To define database schema, Anego uses DBIx::Schema::DSL:
package MyApp::DB::Schema;
use strict;
use warnings;
use DBIx::Schema::DSL;
create_table 'author' => columns {
integer 'id', primary_key, auto_increment;
varchar 'name', unique;
};
create_table 'module' => columns {
integer 'id', primary_key, auto_increment;
varchar 'name';
text 'description';
integer 'author_id';
add_index 'author_id_idx' => ['author_id'];
belongs_to 'author';
};
1;
Copyright (C) papix.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
papix [email protected]