In the last few years, version control for database became best practice. There are several implementations/ways for ruby, however, most of them are focused/dependent on particular frameworks that restrict the migration outside the framework. vcs4sql allows organizing version control for the database(s) in a simple, elegant and lightweight way without any dependencies on existing frameworks.
The main idea is to keep changes as simple as possible and be able to have full control of the database structure without hidden frameworks "magic". Initial PoC is designed for sqlite.
$ gem install vcs4sql
# Define the database migration scripts
$ tree
.
├── bin
├── Gemfile
├── Guardfile
├── Rakefile
├── ...
│ ├── ...
├── sqlite.db
├── ...
└── upgrades
└── sqlite
├── 001-install-main-tables.sql
├── 002-add-missing-indexes.sql
├── 003-add-missing-foreigh-keys.sql
├── ...
└── 999.testdata.sql
require "vcs4sql"
Vcs4sql::Sqlite::Migration.new "sqlite.db"
.upgrade "upgrades/sqlite"
The scripts will be executed in a natural order based on name, so far.
If you want to report a bug, or have ideas, feedback or questions about the gem, let me know via GitHub issues and I will do my best to provide a helpful answer. Happy hacking!
The gem is available as open source under the terms of the MIT License.
Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Pull requests are welcome!