# Rollback post migrations

**URL:** https://meta.discourse.org/t/rollback-post-migrations/271245
**Category:** Development
**Created:** [July 11, 2023, 2:49pm UTC](https://meta.discourse.org/t/rollback-post-migrations/271245 "2023-07-11T14:49:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fabiendv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fabiendv/32/279928_2.png) [@fabiendv](https://meta.discourse.org/u/fabiendv)
#### Post date: [July 11, 2023, 2:49pm UTC](https://meta.discourse.org/t/rollback-post-migrations/271245/1 "2023-07-11T14:49:37Z")

</div>

I recently implemented your post migration system, after having a look at your two configuration files [post\_migration\_generator.rb](https://github.com/discourse/discourse/blob/main/lib/generators/rails/post_migration_generator.rb) and [000-post\_migration.rb](https://github.com/discourse/discourse/blob/main/config/initializers/000-post_migration.rb).

However, I have some concerns regarding the potential risks associated with a destructive operation. In the case of removing a column from a table, I would like to explore the best practices for reverting this migration and ensuring data integrity if everything does not go as planned.

What would be the recommended approach for safely rolling back the changes in case something goes wrong after the post migration?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 11, 2023, 4:15pm UTC](https://meta.discourse.org/t/rollback-post-migrations/271245/2 "2023-07-11T16:15:30Z")

</div>

> [@fabiendv](#):
>
> I would like to explore the best practices for reverting this migration and ensuring data integrity if everything does not go as planned.

Run the migration on a staging or test site.
