rake-db 2.37.17 → 2.37.19

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
@@ -4985,14 +4985,12 @@ const constraintsSql = `SELECT
4985
4985
  t.relname AS "tableName",
4986
4986
  c.conname AS "name",
4987
4987
  (
4988
- SELECT json_agg(ccu.column_name ORDER BY a.attnum)
4989
- FROM information_schema.constraint_column_usage ccu
4988
+ SELECT json_agg(a.attname ORDER BY k.ordinality)
4989
+ FROM unnest(c.conkey) WITH ORDINALITY AS k(attnum, ordinality)
4990
4990
  JOIN pg_catalog.pg_attribute a
4991
4991
  ON a.attrelid = c.conrelid
4992
- AND a.attname = ccu.column_name
4992
+ AND a.attnum = k.attnum
4993
4993
  WHERE contype = 'p'
4994
- AND ccu.constraint_name = c.conname
4995
- AND ccu.table_schema = s.nspname
4996
4994
  ) AS "primaryKey",
4997
4995
  (
4998
4996
  SELECT
@@ -5034,15 +5032,16 @@ const constraintsSql = `SELECT
5034
5032
  WHEN false THEN
5035
5033
  json_build_object(
5036
5034
  'columns',
5037
- json_agg(ccu.column_name),
5035
+ json_agg(a.attname ORDER BY k.ordinality),
5038
5036
  'expression',
5039
5037
  pg_get_expr(conbin, conrelid)
5040
5038
  )
5041
5039
  END
5042
- 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
5043
5044
  WHERE conbin IS NOT NULL
5044
- AND ccu.constraint_name = c.conname
5045
- AND ccu.table_schema = s.nspname
5046
5045
  ) AS "check"
5047
5046
  FROM pg_catalog.pg_constraint c
5048
5047
  JOIN pg_class t ON t.oid = conrelid