diff --git a/db/migrate/20240207080515_change_flipper_gates_value_to_text.rb b/db/migrate/20240207080515_change_flipper_gates_value_to_text.rb new file mode 100644 index 0000000..cfa1eb6 --- /dev/null +++ b/db/migrate/20240207080515_change_flipper_gates_value_to_text.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.1] + def up + # Ensure this incremental update migration is idempotent + return unless connection.column_exists? :flipper_gates, :value, :string + + if index_exists? :flipper_gates, [:feature_key, :key, :value] + remove_index :flipper_gates, [:feature_key, :key, :value] + end + change_column :flipper_gates, :value, :text + add_index :flipper_gates, [:feature_key, :key, :value], unique: true, length: { value: 255 } + end + + def down + change_column :flipper_gates, :value, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index f830293..e558da8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,12 +10,12 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_10_24_104909) do +ActiveRecord::Schema[7.1].define(version: 2024_02_07_080515) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false - t.bigint "record_id", null: false - t.bigint "blob_id", null: false + t.integer "record_id", null: false + t.integer "blob_id", null: false t.datetime "created_at", null: false t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true @@ -34,7 +34,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_24_104909) do end create_table "active_storage_variant_records", force: :cascade do |t| - t.bigint "blob_id", null: false + t.integer "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end @@ -69,7 +69,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_24_104909) do create_table "flipper_gates", force: :cascade do |t| t.string "feature_key", null: false t.string "key", null: false - t.string "value" + t.text "value" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true