<p>The main reason down migrations aren't officially supported is because of the additional support overhead they would incur.</p>

<p>Just one simple example: a down migration would have to "undo" what the up migration did.  If that happened to be something destructive, like removing a database column that was storing content on your site, and you waited long enough for users to enter content that used that column, now you've lost the content they've entered.</p>

<p>It gets more complicated if you take into account dependencies. Plugin A depends on Craft schema version B to be in place to work, but if you down migrate  Craft to schema version A, plugin A will break despite any schema version checks they might have done on installation.</p>

<p>Same goes for dependencies between plugin A and plugin B as well.</p>

<p>If you really want to support this in your plugin, your migration is probably already extending <a href="https://craftcms.com/classreference/etc/db/BaseMigration" rel="nofollow">BaseMigration</a> and you can extend the <a href="https://craftcms.com/classreference/etc/db/BaseMigration#safeDown-detail" rel="nofollow">safeDown</a> method.</p>

<p>Just note that there's no way to trigger this through the Craft CP natively. You'd have to write a plugin that exposed a controller action to trigger it or if you wanted it from the <a href="https://craftcms.com/docs/plugins/migrations" rel="nofollow">command line</a>, you'd have to create a custom console command that exposed it.</p>

CC BY-SA 3.0
2016-08-22T18:00:55.630Z
2016-08-22T18:00:55.630Z
Brad Bell
<p>Currently in the source down migrations are not supported by Craft CMS. </p>

<pre><code>public function safeDown()
{
    Craft::log('Down migrations are not supported.', LogLevel::Warning);
}
</code></pre>

<p>Why are they not supported? Also, how can I implement this for my own plugins? </p>

<plugin-development><migration>
Down Migrations
# Down Migrations

(Asked by: username_0 on 2016-08-22)

Currently in the source down migrations are not supported by Craft CMS. 
public function safeDown()
{
    Craft::log('Down migrations are not supported.', LogLevel::Warning);
}

Why are they not supported? Also, how can I implement this for my own plugins?

**Tags:** plugin-development, migration

---

## 1 answers

### Answer by username_1 on 2016-08-22. Score: 4 | Accepted answer

The main reason down migrations aren't officially supported is because of the additional support overhead they would incur.

Just one simple example: a down migration would have to "undo" what the up migration did. If that happened to be something destructive, like removing a database column that was storing content on your site, and you waited long enough for users to enter content that used that column, now you've lost the content they've entered.

It gets more complicated if you take into account dependencies. Plugin A depends on Craft schema version B to be in place to work, but if you down migrate Craft to schema version A, plugin A will break despite any schema version checks they might have done on installation.

Same goes for dependencies between plugin A and plugin B as well.

If you really want to support this in your plugin, your migration is probably already extending [BaseMigration](https://craftcms.com/classreference/etc/db/BaseMigration) and you can extend the [safeDown](https://craftcms.com/classreference/etc/db/BaseMigration#safeDown-detail) method.

Just note that there's no way to trigger this through the Craft CP natively. You'd have to write a plugin that exposed a controller action to trigger it or if you wanted it from the [command line](https://craftcms.com/docs/plugins/migrations), you'd have to create a custom console command that exposed it.


---

