https://github.com/simplificator/flatten_migrations
Flatten migrations into one
https://github.com/simplificator/flatten_migrations
Last synced: about 1 year ago
JSON representation
Flatten migrations into one
- Host: GitHub
- URL: https://github.com/simplificator/flatten_migrations
- Owner: simplificator
- Created: 2011-07-27T13:57:00.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2023-05-22T18:48:41.000Z (about 3 years ago)
- Last Synced: 2024-10-31T13:46:04.504Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 5.86 KB
- Stars: 12
- Watchers: 21
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
Flatten migrations
===================
A gem that adds `rake db:flatten_migrations` to rake tasks in your rails project.
Requirements
------------
You have to ensure that your **schema format is set to :ruby** in configuration of
your project.
So in your *project*/config/environments/*.rb you should have a line:
```
config.active_record.schema_format = :ruby
```
Installation
------------
Just add
```
gem 'flatten_migrations'
```
to development group in your Gemfile.
How does it work
----------------
The task steps are as follows:
1. run pending migrations (rake db:migrate)
2. wipe out *project*/db/migrate direcotry
3. generate initial migration from existing database schema file
initial migration is assumed to be the one which was last executed
4. create auxiliary migration which adjusts the schema_migrations table
5. run the new migration
**Both new migrations (*initial* and *auxiliary*) are irreversible.**
Your database is safe and it should not erase any data except the schema_migrations table.