fix(migration): apply what strong migration recommends
This commit is contained in:
parent
59cddcbfe6
commit
f84c7ac5e4
3 changed files with 13 additions and 4 deletions
|
@ -3,9 +3,8 @@ class AddProcedurePresentationAndStateToExports < ActiveRecord::Migration[6.1]
|
||||||
|
|
||||||
def change
|
def change
|
||||||
add_reference :exports, :procedure_presentation, null: true, index: { algorithm: :concurrently }
|
add_reference :exports, :procedure_presentation, null: true, index: { algorithm: :concurrently }
|
||||||
StrongMigrations.disable_check(:add_column)
|
add_column :exports, :statut, :string
|
||||||
add_column :exports, :statut, :string, default: 'tous'
|
change_column_default :exports, :statut, "tous"
|
||||||
StrongMigrations.enable_check(:add_column)
|
|
||||||
remove_index :exports, [:format, :time_span_type, :key]
|
remove_index :exports, [:format, :time_span_type, :key]
|
||||||
add_index :exports, [:format, :time_span_type, :statut, :key], unique: true, algorithm: :concurrently
|
add_index :exports, [:format, :time_span_type, :statut, :key], unique: true, algorithm: :concurrently
|
||||||
end
|
end
|
||||||
|
|
10
db/migrate/20220407081538_backfill_export_status.rb
Normal file
10
db/migrate/20220407081538_backfill_export_status.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
class BackfillExportStatus < ActiveRecord::Migration[6.1]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def change
|
||||||
|
Export.in_batches do |relation|
|
||||||
|
relation.update_all statut: "tous"
|
||||||
|
sleep(0.01)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2022_04_05_163206) do
|
ActiveRecord::Schema.define(version: 2022_04_07_081538) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
Loading…
Reference in a new issue