Ruby interface to call sqldef.
gem 'sqldef'
You can download mysqldef
, psqldef
, or sqlite3def
.
Sqldef.bin = './bin'
Sqldef.download(:psqldef)
download
is automatically executed by the following methods too.
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',
)
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',
)
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',
)
The gem is available as open source under the terms of the MIT License.