# Allow asset compilation without \`color\_schemes\` table

**URL:** https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297
**Category:** Feature
**Created:** [6 Junho , 2014 17:37 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297 "2014-06-06T17:37:40Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![hstove](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hstove/32/114343_2.png) [@hstove](https://meta.discourse.org/u/hstove)
#### Post date: [6 Junho , 2014 17:37 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/1 "2014-06-06T17:37:40Z")

</div>

Heroku setup with Discourse has been simplified a lot over the development of Discourse (from what I can tell), but at the moment there is a hangup during asset compilation when the database has not been set up.

Is it possible to allow asset compilation when the DB hasn’t been created at all? I see that other assets fail ‘smoothly’, but compilation fails and exits when the `color_schemes` table hasn’t been created. Is there an easy workaround for this?

Otherwise, it seems like I can temporarily disable color schemes, but I’m not sure how. For now, I’ve been able to get past this by manually changing a few lines in `discourse_sass_importer.rb` (and now `discourse_stylesheets.rb`), which is definitely a hack.

Thanks!

---

<div class="post-metadata">

### Author: ![stephan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephan/32/103320_2.png) [@stephan](https://meta.discourse.org/u/stephan)
#### Post date: [11 Junho , 2014 18:39 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/2 "2014-06-11T18:39:30Z")

</div>

Anyone? I have the same problem.

In fact this is a bug, not a feature.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [11 Junho , 2014 20:00 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/3 "2014-06-11T20:00:06Z")

</div>

Heroku is precompiling assets before the database has been migrated?? Why is it doing that? I don’t understand this scenario.

---

<div class="post-metadata">

### Author: ![hstove](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hstove/32/114343_2.png) [@hstove](https://meta.discourse.org/u/hstove)
#### Post date: [11 Junho , 2014 20:20 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/4 "2014-06-11T20:20:56Z")

</div>

Heroku doesn’t run migrations for you, so you have to push to Heroku first and then run migrations. However, Heroku will reject your deployment if asset compilation fails, so you get ‘stuck’.

For others in this situation, I was able to get around it with a few changes. In line 51 of `discourse_sass_importer` I skip the `ColorScheme.enabled` check:

```
    # OVERRIDE FOR HEROKU COMPILATION
    if color_scheme = false#ColorScheme.enabled
      ColorScheme.base_colors.each do |name, base_hex|
        override = color_scheme.colors_by_name[name]
        contents << "$#{name}: ##{override ? override.hex : base_hex} !default;\n"
      end
    else
      special_imports[name].each do |css_file|
        contents << File.read(css_file)
      end
    end

```

And then in 106 of `discourse_stylesheets.rb`:

```
  # theme = (cs = ColorScheme.enabled) ? "#{cs.id}-#{cs.version}" : 0
  theme = (cs = false) ? "#{cs.id}-#{cs.version}" : 0

```

I would love to have a `SiteSetting` to disable ColorScheme without checking the DB. That would still feel hacky, as I don’t really want to disable `ColorScheme`, I just want it to fail silently.

I’d be enthusiastic about contributing code for this solution if it’s agreed that it is a good idea.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [11 Junho , 2014 20:28 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/5 "2014-06-11T20:28:19Z")

</div>

I’ll look into making a less hacky fix.

---

<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: [12 Junho , 2014 01:40 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/6 "2014-06-12T01:40:20Z")

</div>

Thing is, for Discourse to work correctly we need access to the DB when compiling assets, a lot of CSS can be customised based on data in the database.

We really need a way to communicate this to Heroku deployment system.

cc @rwdaigle

---

<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: [12 Junho , 2014 01:53 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/7 "2014-06-12T01:53:22Z")

</div>

FYI

> <https://twitter.com/hone02/status/476904380168294401>

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [12 Junho , 2014 20:33 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/8 "2014-06-12T20:33:52Z")

</div>

For the css at least, I made a change that skips the precompile if the table doesn’t exist. It can be compiled at runtime during the first request, so it’s safe enough. If there are future dependencies on tables, it will probably break again. Let’s hope that Heroku can change the way this is done.

---

<div class="post-metadata">

### Author: ![hone](https://avatars.discourse-cdn.com/v4/letter/h/65b543/32.png) [@hone](https://meta.discourse.org/u/hone)
#### Post date: [17 Junho , 2014 12:33 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/9 "2014-06-17T12:33:58Z")

</div>

@sam[ensure the db migration is run before trying to compile assets · hone/discourse@ce7b081 · GitHub](https://github.com/hone/discourse/commit/ce7b081dc1ad17c9395f9149358a9cdb5aa72a4a) worked for me on first push once you add a redis and database addon.

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [4 Dezembro , 2025 11:14 UTC](https://meta.discourse.org/t/allow-asset-compilation-without-color-schemes-table/16297/10 "2025-12-04T11:14:26Z")

</div>


