Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 890 Bytes

README.pod

File metadata and controls

53 lines (42 loc) · 890 Bytes

rex-sql is a (R)?ex module to manage database schemas.

Usage

In your Rexfile use the following commands.

use Rex::SQL;

sql_user "root";
sql_password "";
sql_database "test";
sql_type "mysql";

desc "Prepare Database";
task "prepare", sub {
  sql yaml => "schema.yml";
};

And the schema.yml:

---
User:
   columns:
      id:
         type: integer(4)
         primary: true
         autoincrement: true
         null: false
      contact_id:
         type: integer(4)
      username:
         type: string(255)
         default: blub
      role:
         type: enum
         values: [eins, zwei, drei]

Contact:
   columns:
      id:
         type: integer(4)
         primary: true
         autoincrement: true
      name:
         type: string(255)
   options:
      type: INNODB
      collate: utf8_unicode_ci
      charset: utf8