rake-db 2.37.18 → 2.37.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5032,15 +5032,16 @@ const constraintsSql = `SELECT
5032
5032
  WHEN false THEN
5033
5033
  json_build_object(
5034
5034
  'columns',
5035
- json_agg(ccu.column_name),
5035
+ json_agg(a.attname ORDER BY k.ordinality),
5036
5036
  'expression',
5037
5037
  pg_get_expr(conbin, conrelid)
5038
5038
  )
5039
5039
  END
5040
- FROM information_schema.constraint_column_usage ccu
5040
+ FROM unnest(c.conkey) WITH ORDINALITY AS k(attnum, ordinality)
5041
+ JOIN pg_catalog.pg_attribute a
5042
+ ON a.attrelid = c.conrelid
5043
+ AND a.attnum = k.attnum
5041
5044
  WHERE conbin IS NOT NULL
5042
- AND ccu.constraint_name = c.conname
5043
- AND ccu.table_schema = s.nspname
5044
5045
  ) AS "check"
5045
5046
  FROM pg_catalog.pg_constraint c
5046
5047
  JOIN pg_class t ON t.oid = conrelid