Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Why**: `strong_migrations` is better maintained than `zero_downtime_migrations` and seems to have better advice. The author of the gem has written many other fantastic gems that are used in production at Instacart, so they should be trustworthy. The gem also comes with a handy rake task that will automatically alphabetize the columns in `schema.rb`. This will eliminate issues where after pulling the latest code and running recent migrations locally, your schema.rb will change.
- Loading branch information
Showing
6 changed files
with
406 additions
and
403 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
StrongMigrations.start_after = 20190111000717 |
14 changes: 7 additions & 7 deletions
14
db/migrate/20190110220936_make_hearing_views_polymorphic.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
class MakeHearingViewsPolymorphic < ActiveRecord::Migration[5.1] | ||
safety_assured | ||
|
||
def change | ||
add_column :hearing_views, :hearing_type, :string | ||
remove_index :hearing_views, [:hearing_id, :user_id] | ||
add_index :hearing_views, [:hearing_id, :user_id, :hearing_type], unique: true | ||
safety_assured do | ||
add_column :hearing_views, :hearing_type, :string | ||
remove_index :hearing_views, [:hearing_id, :user_id] | ||
add_index :hearing_views, [:hearing_id, :user_id, :hearing_type], unique: true | ||
|
||
HearingView.find_each do |hearing_view| | ||
hearing_view.update!(hearing_type: "LegacyHearing") | ||
HearingView.find_each do |hearing_view| | ||
hearing_view.update!(hearing_type: "LegacyHearing") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.