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.js CHANGED
@@ -5055,15 +5055,16 @@ const constraintsSql = `SELECT
5055
5055
  WHEN false THEN
5056
5056
  json_build_object(
5057
5057
  'columns',
5058
- json_agg(ccu.column_name),
5058
+ json_agg(a.attname ORDER BY k.ordinality),
5059
5059
  'expression',
5060
5060
  pg_get_expr(conbin, conrelid)
5061
5061
  )
5062
5062
  END
5063
- FROM information_schema.constraint_column_usage ccu
5063
+ FROM unnest(c.conkey) WITH ORDINALITY AS k(attnum, ordinality)
5064
+ JOIN pg_catalog.pg_attribute a
5065
+ ON a.attrelid = c.conrelid
5066
+ AND a.attnum = k.attnum
5064
5067
  WHERE conbin IS NOT NULL
5065
- AND ccu.constraint_name = c.conname
5066
- AND ccu.table_schema = s.nspname
5067
5068
  ) AS "check"
5068
5069
  FROM pg_catalog.pg_constraint c
5069
5070
  JOIN pg_class t ON t.oid = conrelid