sqldef-ruby

Ruby interface to call sqldef.

Installation

gem 'sqldef'

Usage

Download

You can download mysqldef, psqldef, or sqlite3def.

Sqldef.bin = './bin'
Sqldef.download(:psqldef)

download is automatically executed by the following methods too.

Export

You can export the database schema to a file.

Sqldef.export(
  command:  :psqldef,
  host:     host,
  port:     port,
  user:     user,
  password: password,
  database: database,
  path:     'db/schema.sql',
)

Dry Run

You can show DDLs to be executed.

Sqldef.dry_run(
  command:  :psqldef,
  host:     host,
  port:     port,
  user:     user,
  password: password,
  database: database,
  path:     'db/schema.sql',
)

Apply

You can run DDLs to match the schema.

Sqldef.apply(
  command:  :psqldef,
  host:     host,
  port:     port,
  user:     user,
  password: password,
  database: database,
  path:     'db/schema.sql',
)

License

The gem is available as open source under the terms of the MIT License.