# Delayed columndropper issues

**URL:** https://meta.discourse.org/t/delayed-columndropper-issues/98339
**Category:** Support
**Created:** [September 29, 2018, 11:40am UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339 "2018-09-29T11:40:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [September 29, 2018, 11:40am UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/1 "2018-09-29T11:40:03Z")

</div>

We’ve ran into a few fights with the delayed column dropping mechanism lately. These are rare issues but they cause a lot of pain, relatively speaking.

The question is : is there any way to manually force the columndropper to run?

Details of the issues in case anyone is interested:

- run migrations, then within an hour export the database and try to import it elsewhere. The import will fail because the required triggers in the `discourse_functions` schema will not exist on the new host.
- import or attach a new database into a multisite. The migrations will run but the columns will not drop, causing `PG::UndefinedColumn` errors and causing Discourse to step in and clear the activerecord cache. This keeps on happening for one hour until the delayed drops are executed.

Being able to force the delayed drops to run would ~~solve~~ work around all those issues.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [September 29, 2018, 3:29pm UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/2 "2018-09-29T15:29:40Z")

</div>

You could trick the system into believing that the first migration ran more than one hour ago.

> <https://github.com/discourse/discourse/blob/dd810b8b05aa5baa3e1cfe3e6e35c42dab7716bd/spec/components/migration/column_dropper_spec.rb#L19-L22>

BTW: This is going to change soon: [FEATURE: Post deployment migrations. by tgxworld · Pull Request #6406 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/6406)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 29, 2018, 6:33pm UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/3 "2018-09-29T18:33:42Z")

</div>

Maybe @tgxworld or @sam could comment, as they have time.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [September 29, 2018, 11:38pm UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/4 "2018-09-29T23:38:35Z")

</div>

Our plan is to introduce a new system that is not subject to these issues in the next few weeks, we will announce it on meta when ready

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 14, 2021, 5:21am UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/5 "2021-06-14T05:21:32Z")

</div>



---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [June 14, 2021, 8:48am UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/6 "2021-06-14T08:48:18Z")

</div>

> [@Introducing Post Deployment Migration](https://meta.discourse.org/t/introducing-post-deployment-migration/98974):
>
> As of [FEATURE: Post deployment migrations. (#6406) · discourse/discourse@40fa967 · GitHub](https://github.com/discourse/discourse/commit/40fa96777ddad4698df20d6b8a61afcf87743ed7), we’re moving away from [our delayed drop pattern](https://github.com/discourse/discourse/blob/9bbc1ae7b2ed9bd7e73f3ec9de6cf12e09178612/db/fixtures/000_delayed_drops.rb) to remove a column from a table in the database. Inspired by [Gitlab’s pattern of post deployment migration](https://docs.gitlab.com/ee/development/post_deployment_migrations.html), we’ve added the ability to generate and run migrations that can be run after a deployment. SKIP\_POST\_DEPLOYMENT\_MIGRATIONS=1 rake db:migrate -\> deploy app servers SKIP\_POST\_DEPLOYMENT\_MIGRATIONS=0 rake db:migrate To generate a post deployment migratio…

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [June 14, 2021, 8:48am UTC](https://meta.discourse.org/t/delayed-columndropper-issues/98339/7 "2021-06-14T08:48:23Z")

</div>


