Commit 9aad5ec4 authored by rpereira2's avatar rpereira2

Add info to migration style guide on reversibility

Even if a migration is not reversible, it should still have a down
method.
parent 117e2614
......@@ -89,6 +89,21 @@ be possible to downgrade in case of a vulnerability or bugs.
In your migration, add a comment describing how the reversibility of the
migration was tested.
Some migrations cannot be reversed. For example, some data migrations can't be
reversed because we lose information about the state of the database before the migration.
You should still create a `down` method with a comment, explaining why
the changes performed by the `up` method can't be reversed, so that the
migration itself can be reversed, even if the changes performed during the migration
can't be reversed:
```ruby
def down
# no-op
# comment explaining why changes performed by `up` cannot be reversed.
end
```
## Atomicity
By default, migrations are single transaction. That is, a transaction is opened
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment