tests for source links
This commit is contained in:
20
config/initializers/migration_utilities.rb
Normal file
20
config/initializers/migration_utilities.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# typed: strict
|
||||
class ActiveRecord::Migration
|
||||
extend T::Sig
|
||||
|
||||
sig do
|
||||
params(
|
||||
table_name: T.any(String, Symbol),
|
||||
column_name: T.any(String, Symbol),
|
||||
options: T::Hash[Symbol, T.untyped],
|
||||
).void
|
||||
end
|
||||
def add_json_index(table_name, column_name, options = {})
|
||||
add_index(
|
||||
table_name,
|
||||
"(json_attributes->>'#{column_name}')",
|
||||
name: "idx_#{table_name}_on_#{column_name}",
|
||||
**options,
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user