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

Use strong_migrations gem #8730

Merged
merged 3 commits into from Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -58,12 +58,12 @@ gem "sentry-raven"
gem "shoryuken", "3.1.11"
gem "sqlite3", platforms: [:ruby, :mswin, :mingw, :mswin, :x64_mingw]
gem "stringex", require: false
# catch problematic migrations at development/test time
gem "strong_migrations"
# execjs runtime
gem "therubyracer", platforms: :ruby
# Use Uglifier as compressor for JavaScript assets
gem "uglifier", ">= 1.3.0"
# catch problematic migrations at development/test time
gem "zero_downtime_migrations"

group :production, :staging, :ssh_forwarding, :development, :test do
# Oracle DB
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Expand Up @@ -464,6 +464,8 @@ GEM
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
stringex (2.8.5)
strong_migrations (0.3.1)
activerecord (>= 3.2.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
therubyracer (0.12.3)
Expand Down Expand Up @@ -496,8 +498,6 @@ GEM
nokogiri (~> 1.5)
xpath (3.0.0)
nokogiri (~> 1.8)
zero_downtime_migrations (0.0.7)
activerecord

PLATFORMS
ruby
Expand Down Expand Up @@ -567,11 +567,11 @@ DEPENDENCIES
sniffybara!
sqlite3
stringex
strong_migrations
therubyracer
timecop
tzinfo-data
uglifier (>= 1.3.0)
zero_downtime_migrations

BUNDLED WITH
1.17.2
2 changes: 2 additions & 0 deletions Rakefile
Expand Up @@ -7,3 +7,5 @@ require File.expand_path("config/application", __dir__)
Dir[Rails.root.join("lib/tasks/support/**/*.rb")].each { |f| require f }

Rails.application.load_tasks

task "db:schema:dump": "strong_migrations:alphabetize_columns"
1 change: 1 addition & 0 deletions config/initializers/strong_migrations.rb
@@ -0,0 +1 @@
StrongMigrations.start_after = 20190111000717
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

14 changes: 7 additions & 7 deletions db/migrate/20190110220936_make_hearing_views_polymorphic.rb
@@ -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