README.md in sql_migrations-2.2.1 vs README.md in sql_migrations-2.4.0
- old
+ new
@@ -3,11 +3,11 @@
[![Gem Version](https://badge.fury.io/rb/sql_migrations.svg)](http://badge.fury.io/rb/sql_migrations)
[![Build Status](https://travis-ci.org/grzesiek/sql_migrations.svg?branch=master)](https://travis-ci.org/grzesiek/sql_migrations)
Simple standalone migrations you can use with plain SQL.
-This gives you possibility to execute migrations, seed datebase (on production and in test environment with fixtures) in non-Ruby projects.
+This gives you possibility to execute migrations, seed datebase (on production and in test environment) in non-Ruby projects.
`sql-migrations` can work with multiple different databases, and support many db adapters.
## Why ?
This is particularly useful in old projects that don't have migration support, and you really want to use Continuous Delivery strategy.
@@ -103,18 +103,18 @@
`default` database configuration is optional, nonetheless if supplied it will not be necessary to create additional subdirectory to store migrations (look below).
If you have multi-statement migrations you should provide `separator` configuration variable in `options` block. `options` key is optional in YAML.
-4. Migrations/seeds/fixtures can be executed using rake tasks. So you will need to create `Rakefile`:
+4. Migrations/seeds can be executed using rake tasks. So you will need to create `Rakefile`:
```ruby
require 'bundler'
Bundler.require
SqlMigrations::Config.load!('db/config/databases.yml')
- SqlMigrations.load_tasks
+ SqlMigrations.load_tasks!
```
You can also create Rake tasks by yourself:
```ruby
@@ -145,43 +145,37 @@
5. It's ready !
## Usage
-1. Valid migration/seeds/fixture file names match against regexp `/(\d{8})_(\d{6})_(.*)?\.sql/`. So valid filenames would be:
+1. Valid migration/seeds file names match against regexp `/(\d{8})_(\d{6})_(.*)?\.sql/`. So valid filenames would be:
20150303_180100_test_migration.sql
20150303_180100_whatever_description_of_seed.sql
- 20150303_180100_fixture1.sql
You can put plain SQL into that files.
-2. It is possible to create migration files, seed files and fixtures inside following directory structure:
+2. It is possible to create migration files and seed files inside following directory structure:
db/
migrations/
20150303_180100_test_migration.sql
- fixtures/
- 20150303_180100_fixture1.sql
seeds/
20150303_180100_whatever_description_of_seed.sql
If you want to use multiple databases, create also database directories:
db/
migrations/
default/
second_db/
- fixtures/
- default/
- second_db/
seeds/
default/
second_db/
- `default/` directory is optional, you can put migrations/seed data/fixtures for default database in base directories:
+ `default/` directory is optional, you can put migrations/seed data for default database in base directories:
db/
migrations/
20150303_180100_test_migration_for_default_database.sql
second_db/
@@ -195,12 +189,11 @@
This should give output
rake sqlmigrations:db:migrate # Run migrations
rake sqlmigrations:db:seed # Seed database
- rake sqlmigrations:db:test:seed # Seed test database with fixtures
- rake sqlmigrations:files:list # List found migration and seed files
+ rake sqlmigrations:db:scripts # List all scripts found
5. Then, run tasks:
@@ -208,18 +201,18 @@
rake sqlmigrations:db:migrate
# this will seed database with initial data
rake sqlmigrations:db:seed
- # this will list all migrations/seed files/fixtures that where found
- rake sqlmigration:files:list
+ # this will list all migrations/seed files that where found
+ rake sqlmigration:db:scripts
6. Environment variables
If you want to run migration on different database (for example test) specify ENV:
ENV=test rake sqlmigrations:db:migrate
- ENV=test rake sqlmigrations:db:test:seed
+ ENV=test rake sqlmigrations:db:seed
or in production:
ENV=production rake sqlmigrations:db:migrate
ENV=production rake sqlmigrations:db:seed