== Installation
sudo apt-get install ruby1.9.1-full ruby1.9.1-dev postgresql libpq-dev
sudo gem install pg activerecord-pg-adapter
sudo gem install db_version_manager
== Configuration
Configure DB settings in config/database.yml
, if needed, change config/initializer.rb
== Usage
Available tasks are:
rake db:migrate[version] # Migrates DB to specified version (if no argument given, updates to latest migration).
rake db:version # Show current DB version.
rake help # Help
rake migration:applied # Show migrations that are applied.
rake migration:generate[description] # Generate new migration.
rake migration:unapplied # Show migrations that are not applied.
rake migration:version # Show current latest migration version.
== Example scenario
TODO-s:
- If you have Gems bin in your path, you can also just run ./db_version_manager
- Without cloning but with just Gem installation (see first)
=== Obtain db_version-manager
git clone https://github.com/tione/db_version_manager.git
cd db_version_manager
=== Configure database
config/database.yml
=== Generate migration template what to edit
rake migration:generate["This is my migration description"]
=== Edit your template in ./app/migrate/date_name.rb
- For up() define for example "CREATE TABLE .."
- For down() define for example "DROP TABLE .."
=== Migrate changes to DB
rake db:migrate # if no version given, to last is migrated. you can also downgrade so.