-
Notifications
You must be signed in to change notification settings - Fork 33
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
Update Flipper #4489
Open
StephenHulme
wants to merge
12
commits into
develop
Choose a base branch
from
sh51/update-flipper
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+96
−69
Open
Update Flipper #4489
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3362789
build: update flipper to v1
StephenHulme a67bfb5
docs (readme): add feature-flag details
StephenHulme fd26e4d
docs (readme): update table of contents
StephenHulme a21afed
docs (readme): update copyright footer
StephenHulme 809fbd9
fix: update db schema for flipper changes
StephenHulme 5d2e8fd
style: lint
StephenHulme 806916c
docs (readme): put each sentence on own line
StephenHulme bc06e6d
build: pin flipper to version 1.x
StephenHulme 240311f
Merge branch 'develop' into sh51/update-flipper
StephenHulme 9093312
build: hide cucumber publish message
StephenHulme b0b82ef
fix: attempt to solve pool thread blocking
StephenHulme 7ed4182
fix: use rails boolean converter to handle truthiness
StephenHulme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
db/migrate/20241106150235_change_flipper_gates_value_to_text.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
class ChangeFlipperGatesValueToText < ActiveRecord::Migration[6.1] | ||
def up | ||
# Ensure this incremental update migration is idempotent | ||
return unless connection.column_exists? :flipper_gates, :value, :string | ||
|
||
remove_index :flipper_gates, %i[feature_key key value] if index_exists? :flipper_gates, %i[feature_key key value] | ||
change_column :flipper_gates, :value, :text | ||
add_index :flipper_gates, %i[feature_key key value], unique: true, length: { value: 255 } | ||
end | ||
|
||
def down | ||
change_column :flipper_gates, :value, :string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this also need to do the index modifications to be a true reversal of the above? |
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really needed? What would happen if the column were not already containing a string value, other than spending a bit longer than strictly needed doing the migration? If you do think it's needed, should it also be used in the
down
method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both this and the comment in the
down
method are very good points.In this case the migration was automatically created by running
bundle exec rails g flipper:active_record --force
as requested by the upgraded version of the package, so I cannot take credit for this code.But since it is making changes to our codebase I think you're right that it should meet some quality standards - such as being truely reversable.
Since I haven't suceeded in getting the cucumber tests to pass due to the migration - I'll give it a good once over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another alternative is to mark it as non-reversible as we've done in some previous migrations (I think I've seen it here anyway)