DEV: Introduce theme-owned color palettes (#30915)

Related to https://github.com/discourse/discourse/pull/30893

As part of the theme overhauling project, we're making each theme fully
own/control its color palette which can be edited directly on the theme
page. To make this possible, we need to introduce a special type of
color palettes that are marked as "owned by a theme" in the database
which aren't displayed in the admin color palettes page and can't be
edited from it. This commit is the first step of this change; it adds a new
join table to associate a color palette with a theme. For now, we're
keeping the relationship one-to-one (hence the `UNIQUE` indexes), but we
may later change it to one-to-many.

Internal topic: t/141648.
This commit is contained in:
Osama Sayegh
2025-01-22 12:03:37 +03:00
committed by GitHub
parent f7904d82b7
commit a793f4843b
6 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
class CreateThemeColorScheme < ActiveRecord::Migration[7.2]
def change
create_table :theme_color_schemes do |t|
t.integer :theme_id, null: false
t.integer :color_scheme_id, null: false
t.timestamps null: false
end
add_index :theme_color_schemes, :theme_id, unique: true
add_index :theme_color_schemes, :color_scheme_id, unique: true
end
end