Skip to content

Commit

Permalink
Fix migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
fumimowdan committed Oct 18, 2023
1 parent 16570be commit cbecf29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
class AddDefaultValuesToBooleanFields < ActiveRecord::Migration[7.0]
def up
ApplicationProgress.where.not(visa_investigation_required: true)
.update(visa_investigation_required: false)
execute('UPDATE application_progresses
SET visa_investigation_required = false
WHERE visa_investigation_required != true')

change_column :application_progresses, :visa_investigation_required, :boolean, default: false, null: false
execute('UPDATE application_progresses
SET school_investigation_required = false
WHERE school_investigation_required != true')

ApplicationProgress.where.not(school_investigation_required: true)
.update(school_investigation_required: false)
change_column :application_progresses, :school_investigation_required, :boolean, default: false, null: false
end
end
2 changes: 1 addition & 1 deletion db/migrate/20231009110217_add_application_indexes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddApplicationIndexes < ActiveRecord::Migration[7.0]
def change
drop_table :urns # rubocop:disable Rails/ReversibleMigration
execute("DROP TABLE IF EXISTS urns") # rubocop:disable Rails/ReversibleMigration
add_index :applications, :urn, unique: true
add_index :applications, :application_route
end
Expand Down

0 comments on commit cbecf29

Please sign in to comment.