Run sqldef on Rails.
gem 'sqldef-rails'
Just configure config/database.yml
normally.
default: &default
adapter: postgresql
username: postgres
password:
host: 127.0.0.1
development:
<<: *default
database: sqldef_development
test:
<<: *default
database: sqldef_test
Dump the current schema to db/schema.sql
.
bundle exec rake db:schema:dump
You may use bin/rails
instead of bundle exec rake
too.
You can show DDLs to be executed to match db/schema.sql
.
bundle exec rake db:migrate:status
You can run DDLs to match db/schema.sql
.
bundle exec rake db:migrate
The gem is available as open source under the terms of the MIT License.