# Multisite upgrade failed due to missing database columns

**URL:** <https://meta.discourse.org/t/multisite-upgrade-failed-due-to-missing-database-columns/54239>\
**Category:** Bug\
**Created:** [14 ديسمبر 2016، 2:41م UTC](https://meta.discourse.org/t/multisite-upgrade-failed-due-to-missing-database-columns/54239 "2016-12-14T14:41:35Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![fuerst](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fuerst/32/120729_2.png) [@fuerst](https://meta.discourse.org/u/fuerst)\
**Post date:** [15 ديسمبر 2016، 9:14ص UTC](https://meta.discourse.org/t/multisite-upgrade-failed-due-to-missing-database-columns/54239/10 "2016-12-15T09:14:14Z")

</div>

You are right - precompiling assets started before database migration. Adding your code above to the `before_bundle_exec` hook worked. Thanks a lot for your help!

I had to modify it slightly to get it executed properly. My hook for multi site looks like this now:

```plaintext
  before_bundle_exec:
    - file:
        path: $home/config/multisite.yml
        contents: |
         # (your multisite.yml config here)
    - exec: cd /var/www/discourse && sudo -E -u discourse bundle install --deployment --verbose --without test --without development
    - exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate

```

Should I consider this as a one time workaround or can this two `exec` stay forever in my template file?

---

_[View the full topic](https://meta.discourse.org/t/multisite-upgrade-failed-due-to-missing-database-columns/54239)._
