Comments (6)
@gs-deliverists-io Thanks, I was just experimenting with the same thing.
I just ran the flipper-active_record test suite against mysql after making the change below and everything passes.
@fer9305 @BrandonHicks-msr @gs-deliverists-io can you all test this out and confirm that it works for you as well?
class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.1]
def up
remove_index :flipper_gates, [:feature_key, :key, :value], unique: true
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
from flipper.
@bkeepers thank you for looking into that!
below migration fixed the issue
class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.1]
def up
remove_index :flipper_gates, %i[feature_key key value]
change_column :flipper_gates, :value, :text
add_index :flipper_gates, [:feature_key, :key, :value], unique: true, length: {feature_key: 50, key: 50, value: 50}
end
def down
change_column :flipper_gates, :value, :string
end
end
I'm not any mysql expert, its just an experimentation
from flipper.
The latest snippet you provided above worked for me. The only issue I had was related to the index (and maybe related to something I was previously missing). But changing it to the following resolved it:
remove_index(:flipper_gates, [:feature_key, :key, :value], unique: true) if index_exists?(:flipper_gates, [:feature_key, :key, :value], unique: true)
from flipper.
The issue is with this index:
add_index :flipper_gates, [:feature_key, :key, :value], unique: true
Now that value
is a text column, MySQL want's a prefix size that should be used in the index, per these docs
And here are the Rails docs for #add_index with prefix size:
Creating an index with specific key lengths for multiple keys
add_index(:accounts, [:name, :surname], name: 'by_name_surname', length: {name: 10, surname: 15})
from flipper.
@bkeepers it works for me!
from flipper.
Thank you @bkeepers ! Lovely work. Works fine now.
❤️
from flipper.
Related Issues (20)
- cannot load such file -- flipper/model/active_record (LoadError) HOT 13
- KeyError: key not found: true in strict mode HOT 2
- Sync error with flipper cloud HOT 9
- Error when running migrations with Flipper and Strong Migrations HOT 1
- Inconsistency - custom description, banner_text uses `Sanitize` but actor names is fully escaped HOT 2
- How to handle strict adapter with test? HOT 1
- (1.2) uninitialized constant Flipper::CLI::IRB (NameError) HOT 5
- (1.2) `Flipper::TestHelp` initializer raises an error if enabled HOT 3
- RSpec/Rails Issues with 1.2.1 HOT 1
- Feature flag not being enabled in RSpec specs on 1.2.1 HOT 7
- Flipper 1.2.2 breaks my CI HOT 7
- Loading all actor identifiers into memory isn't scalable HOT 8
- Flipper::Adapters::Strict::NotFound raised when checking non-existant feature flag during rspec test HOT 9
- How to design a request-scoped per-actor flag state table? HOT 5
- Flipper Redis Adapter ignoring configuration block sometimes HOT 5
- Rails credentials read prevents Flipper from working on Rails < 5.2 HOT 2
- Flipper-active_record breaks in 0.26.2+ with Rails 4.2 HOT 2
- missing a template for this request format and variant. request.formats: ["text/css"] request.variant: [] HOT 2
- ActiveRecord adapter: unexpected error when running in a transaction HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flipper.