-
-
Notifications
You must be signed in to change notification settings - Fork 414
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
Expressions #557
Comments
What does a "Rule" do? |
@jnunemaker and co., this is beautiful. I was just thinking about how to implement features for different mobile app versions and it seems |
@jnunemaker thanks for the incredible feature. I am looking to implement a percentage of time within a set of actors, ie when a feature flag is enabled for a User, but also have the percentage of time randomness for that User only. The Expressions would be a nice solution for this. If you don't mind me asking, is there an estimate of when would this be released for open source? |
@marcogregorius Expressions are currently in the |
If you also have rubocop configured to warn about class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.0]
def up
change_column :flipper_gates, :value, :text
end
def down
change_column :flipper_gates, :value, :string
end
end |
Hi, migration cannot be executed on
any ideas? |
Can you drop the full migration file and the output of the command so we can investigate? I've used trilogy like once and had a bunch of issues. Ended up going back to mysql2. |
I'm seeing this as well, with the exact same migration as @rnestler has posted above. |
@jnunemaker I'm seeing the same behavior. Migration file: class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.0]
def up
change_column(:flipper_gates, :value, :text)
end
def down
change_column(:flipper_gates, :value, :string)
end
end output: ┃┃ == 20231211180842 ChangeFlipperGatesValueToText: migrating ====================
┃┃ -- change_column(:flipper_gates, :value, :text)
┃┃ rails aborted!
┃┃ StandardError: An error has occurred, all later migrations canceled: (StandardError)
┃┃
┃┃ Mysql2::Error: BLOB/TEXT column 'value' used in key specification without a key length
┃┃ db/migrate/20231211180842_change_flipper_gates_value_to_text.rb:4:in `up'
┃┃
┃┃ Caused by:
┃┃ ActiveRecord::StatementInvalid: Mysql2::Error: BLOB/TEXT column 'value' used in key specification without a key length
┃┃ (ActiveRecord::StatementInvalid)
┃┃ db/migrate/20231211180842_change_flipper_gates_value_to_text.rb:4:in `up'
┃┃
┃┃ Caused by:
┃┃ Mysql2::Error: BLOB/TEXT column 'value' used in key specification without a key length (Mysql2::Error)
┃┃ db/migrate/20231211180842_change_flipper_gates_value_to_text.rb:4:in `up'
┃┃ Tasks: TOP => db:migrate
┃┃ (See full trace by running task with --trace) |
@fer9305 @BrandonHicks-msr @gs-deliverists-io Does this fix the error for you? - change_column(:flipper_gates, :value, :text)
+ change_column(:flipper_gates, :value, :text, size: 65535) |
now it fails with a different error == 20231211183249 ChangeFlipperGatesValueToText: migrating ====================
-- change_column(:flipper_gates, :value, :text, {:size=>65535})
rails aborted!
StandardError: An error has occurred, all later migrations canceled: (StandardError)
65535 is invalid :size value. Only :tiny, :medium, and :long are allowed.
db/migrate/20231211183249_change_flipper_gates_value_to_text.rb:4:in `up'
Caused by:
ArgumentError: 65535 is invalid :size value. Only :tiny, :medium, and :long are allowed. (ArgumentError)
db/migrate/20231211183249_change_flipper_gates_value_to_text.rb:4:in `up'
Tasks: TOP => db:migrate however, if I pass Caused by:
ActiveRecord::StatementInvalid: Mysql2::Error: BLOB/TEXT column 'value' used in key specification without a key length (ActiveRecord::StatementInvalid) |
Ok, I'm able to duplicate locally now, so I'll work on a fix here soon. |
I opened another issue to talk specifically about this MySQL issue. Let's move conversation over there #789 |
I'll try to communicate more soon. But the tldr is @orderedlist, @bkeepers and I are working on a new feature (for www.flippercloud.io and open source) we're calling "rules" (branch). This issue is just so we can keep track of the work together on the open source side.
ActiveRecord Migration
Those using the
flipper-active_record
adapter will want to migrate the database so it can store JSON expressions:TODO
Rule
And
ruleAny
rulefrom_hash
and other case statementsFlipper
,Flipper::DSL
andFlipper::Feature
==
andeql?
Rule
,Any
, andAnd
value
column is nottext
Flipper.add_rule
andFlipper.remove_rule
for easy adding and removingvalue
fromstring
totext
After releasing beta
Someday
enabled?
so you can do stuff like feature dependenciesThe text was updated successfully, but these errors were encountered: