tests for source links

This commit is contained in:
Dylan Knutson
2025-02-22 04:48:14 +00:00
parent 091b0ef02d
commit 00d90312dc
9 changed files with 225 additions and 27 deletions

View 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