Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord adapter: Fix migration error for MySQL #790

Merged
merged 17 commits into from
Dec 12, 2023
Merged

Conversation

bkeepers
Copy link
Collaborator

@bkeepers bkeepers commented Dec 11, 2023

Fixes #789

@bkeepers bkeepers changed the title Fix migration error against ActiveRecord adapter: Fix migration error for MySQL Dec 11, 2023
* origin/main:
  Update changelog
  Let's get more generic
  Switch to higher up error to catch more issues
  Add fix for AR adapter when table doesn't exist
  Add spec to demonstrate failure of AR adapter when table missing
@bkeepers
Copy link
Collaborator Author

[x] Verify that index length does not adversely effect postgres or other databases

@jnunemaker I tested against Flipper Cloud that the length: {value: 255} argument is ignored by postgres by running the migration below.

class ChangeFlipperGatesIndex < ActiveRecord::Migration[7.1]
  disable_ddl_transaction!

  def change
    remove_index :flipper_gates, [:feature_key, :key, :value], unique: true
    add_index :flipper_gates, [:feature_key, :key, :value], unique: true, length: {value: 255}, algorithm: :concurrently
  end
end

And there is no changes to the schema

$ git diff
diff --git a/db/structure.sql b/db/structure.sql
index 70c58e57..4782732b 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -2771,6 +2771,7 @@ ALTER TABLE ONLY public.features
 SET search_path TO "$user", public;

 INSERT INTO "schema_migrations" (version) VALUES
+('20231211220438'),
 ('20231126182713'),
 ('20231126182525'),
 ('20231126182250'),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mysql - BLOB/TEXT column 'value' used in key specification without a key length
1 participant