diff --git a/db/migrate/20200504214933_update_theme_fields.rb b/db/migrate/20200504214933_update_theme_fields.rb new file mode 100644 index 00000000..f6855550 --- /dev/null +++ b/db/migrate/20200504214933_update_theme_fields.rb @@ -0,0 +1,75 @@ +class UpdateThemeFields < ActiveRecord::Migration[5.2] + def up + # CSS file related fields + remove_column :themes, :css_file_name + remove_column :themes, :css_content_type + remove_column :themes, :css_file_size + remove_column :themes, :css_updated_at + + # Panel color fields -> Raised fields + rename_column :themes, :panel_color, :raised_background + remove_column :themes, :panel_text + add_column :themes, :raised_accent, :integer, default: 0xF7F7F7 + + # Default color -> Dark color + rename_column :themes, :default_color, :dark_color + rename_column :themes, :default_text, :dark_text + + # Light color fields + add_column :themes, :light_color, :integer, default: 0xF8F9FA + add_column :themes, :light_text, :integer, default: 0x000000 + + # Rename some background_ fields + rename_column :themes, :background_text, :body_text + rename_column :themes, :background_muted, :muted_text + + # Remove obsolete fields + remove_column :themes, :link_color + remove_column :themes, :outline_color + + change_column_default :themes, :raised_background, 0xFFFFFF + change_column_default :themes, :dark_color, 0x343A40 + change_column_default :themes, :body_text, 0x000000 + change_column_default :themes, :muted_text, 0x6C757D + change_column_default :themes, :background_color, 0xF0EDF4 + change_column_default :themes, :danger_color, 0xDC3545 + change_column_default :themes, :warning_color, 0xFFC107 + change_column_default :themes, :info_color, 0x17A2B8 + change_column_default :themes, :success_color, 0x28A745 + change_column_default :themes, :input_color, 0xF0EDF4 + end + + def down + add_column :themes, :css_file_name, :string + add_column :themes, :css_content_type, :string + add_column :themes, :css_file_size, :integer + add_column :themes, :css_updated_at, :datetime + + rename_column :themes, :raised_background, :panel_color + add_column :themes, :panel_text, :integer + remove_column :themes, :raised_accent + + rename_column :themes, :dark_color, :default_color + rename_column :themes, :dark_text, :default_text + + remove_column :themes, :light_color + remove_column :themes, :light_text + + rename_column :themes, :body_text, :background_text + rename_column :themes, :muted_text, :background_muted + + add_column :themes, :link_color, :integer + add_column :themes, :outline_color, :integer + + change_column_default :themes, :panel_color, 0xF9F9F9 + change_column_default :themes, :default_color, 0x222222 + change_column_default :themes, :background_text, 0x222222 + change_column_default :themes, :background_muted, 0xBBBBBB + change_column_default :themes, :background_color, 0xFFFFFF + change_column_default :themes, :danger_color, 0xFF0039 + change_column_default :themes, :warning_color, 0xFF7518 + change_column_default :themes, :info_color, 0x9954BB + change_column_default :themes, :success_color, 0x3FB618 + change_column_default :themes, :input_color, 0xFFFFFF + end +end diff --git a/db/schema.rb b/db/schema.rb index 91feb5b1..b0275eb9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_04_25_194536) do +ActiveRecord::Schema.define(version: 2020_05_04_214933) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -192,31 +192,27 @@ ActiveRecord::Schema.define(version: 2020_04_25_194536) do t.integer "user_id", null: false t.integer "primary_color", default: 6174129 t.integer "primary_text", default: 16777215 - t.integer "danger_color", default: 16711737 + t.integer "danger_color", default: 14431557 t.integer "danger_text", default: 16777215 - t.integer "success_color", default: 4175384 + t.integer "success_color", default: 2664261 t.integer "success_text", default: 16777215 - t.integer "warning_color", default: 16741656 + t.integer "warning_color", default: 16761095 t.integer "warning_text", default: 16777215 - t.integer "info_color", default: 10048699 + t.integer "info_color", default: 1548984 t.integer "info_text", default: 16777215 - t.integer "default_color", default: 2236962 - t.integer "default_text", default: 15658734 - t.integer "panel_color", default: 16382457 - t.integer "panel_text", default: 1381653 - t.integer "link_color", default: 6174129 - t.integer "background_color", default: 16777215 - t.integer "background_text", default: 2236962 - t.integer "background_muted", default: 12303291 - t.string "css_file_name" - t.string "css_content_type" - t.integer "css_file_size" - t.datetime "css_updated_at" + t.integer "dark_color", default: 3422784 + t.integer "dark_text", default: 15658734 + t.integer "raised_background", default: 16777215 + t.integer "background_color", default: 15789556 + t.integer "body_text", default: 0 + t.integer "muted_text", default: 7107965 t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.integer "input_color", default: 16777215, null: false + t.integer "input_color", default: 15789556, null: false t.integer "input_text", default: 0, null: false - t.integer "outline_color", default: 6174129, null: false + t.integer "raised_accent", default: 16250871 + t.integer "light_color", default: 16316922 + t.integer "light_text", default: 0 t.index ["user_id", "created_at"], name: "index_themes_on_user_id_and_created_at" end