0
0
Fork 0

Fix older migrations on Ruby 3 (#16174)

This commit is contained in:
Claire 2021-05-07 15:56:45 +02:00 committed by GitHub
parent 0ad240cb6b
commit a5f91a11d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 8 deletions

View file

@ -95,7 +95,7 @@ module Mastodon
allow_null: options[:null]
)
else
add_column(table_name, column_name, :datetime_with_timezone, options)
add_column(table_name, column_name, :datetime_with_timezone, **options)
end
end
end
@ -120,7 +120,7 @@ module Mastodon
options = options.merge({ algorithm: :concurrently })
disable_statement_timeout
add_index(table_name, column_name, options)
add_index(table_name, column_name, **options)
end
# Removes an existed index, concurrently when supported
@ -144,7 +144,7 @@ module Mastodon
disable_statement_timeout
end
remove_index(table_name, options.merge({ column: column_name }))
remove_index(table_name, **options.merge({ column: column_name }))
end
# Removes an existing index, concurrently when supported
@ -168,7 +168,7 @@ module Mastodon
disable_statement_timeout
end
remove_index(table_name, options.merge({ name: index_name }))
remove_index(table_name, **options.merge({ name: index_name }))
end
# Only available on Postgresql >= 9.2
@ -472,7 +472,7 @@ module Mastodon
col_opts[:limit] = old_col.limit
end
add_column(table, new, new_type, col_opts)
add_column(table, new, new_type, **col_opts)
# We set the default value _after_ adding the column so we don't end up
# updating any existing data with the default value. This isn't
@ -510,10 +510,10 @@ module Mastodon
new_pk_index_name = "index_#{table}_on_#{column}_cm"
unless indexes_for(table, column).find{|i| i.name == old_pk_index_name}
add_concurrent_index(table, [temp_column], {
add_concurrent_index(table, [temp_column],
unique: true,
name: new_pk_index_name
})
)
end
end
end
@ -763,7 +763,7 @@ module Mastodon
options[:using] = index.using if index.using
options[:where] = index.where if index.where
add_concurrent_index(table, new_columns, options)
add_concurrent_index(table, new_columns, **options)
end
end