my %config = ( user=>'root', password=>undef, server=>[ {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', type=>'master', migration=>'migration::default'}, {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', type=>'slave'}, {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', id=>1, type=>'master', migration=>'migration::default1'}, {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', id=>1, type=>'slave'}, {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', id=>2, type=>'master', migration=>'migration::default2'}, {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', id=>2, type=>'slave'}, ] ); Usage: APPLICATION sql [ACTION] [ID] ./myapp.pl sql create # first create ./myapp.pl sql update # update sql ./myapp.pl sql delete # delete all table ./myapp.pl sql update 1 # update sql id 1
package migration::default; 1; __DATA__ @@ 1 CREATE TABLE IF NOT EXISTS `test1` ( `test_id` int unsigned NOT NULL AUTO_INCREMENT, `text` varchar(200) NOT NULL, PRIMARY KEY (`test_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ 2 CREATE TABLE IF NOT EXISTS `test2` ( `test_id` int unsigned NOT NULL AUTO_INCREMENT, `text` varchar(200) NOT NULL, PRIMARY KEY (`test_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
To install MojoX::Mysql, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MojoX::Mysql
CPAN shell
perl -MCPAN -e shell install MojoX::Mysql
For more information on module installation, please visit the detailed CPAN module installation guide.