rake-db 2.37.15 → 2.37.17

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
@@ -5026,23 +5026,19 @@ const constraintsSql = `SELECT
5026
5026
  ft.relname,
5027
5027
  'columns',
5028
5028
  (
5029
- SELECT json_agg(ccu.column_name ORDER BY a.attnum)
5030
- FROM information_schema.key_column_usage ccu
5029
+ SELECT json_agg(a.attname ORDER BY k.ordinality)
5030
+ FROM unnest(c.conkey) WITH ORDINALITY AS k(attnum, ordinality)
5031
5031
  JOIN pg_catalog.pg_attribute a
5032
5032
  ON a.attrelid = c.conrelid
5033
- AND a.attname = ccu.column_name
5034
- WHERE ccu.constraint_name = c.conname
5035
- AND ccu.table_schema = cs.nspname
5033
+ AND a.attnum = k.attnum
5036
5034
  ),
5037
5035
  'foreignColumns',
5038
5036
  (
5039
- SELECT json_agg(ccu.column_name ORDER BY a.attnum)
5040
- FROM information_schema.constraint_column_usage ccu
5037
+ SELECT json_agg(a.attname ORDER BY k.ordinality)
5038
+ FROM unnest(c.confkey) WITH ORDINALITY AS k(attnum, ordinality)
5041
5039
  JOIN pg_catalog.pg_attribute a
5042
5040
  ON a.attrelid = c.confrelid
5043
- AND a.attname = ccu.column_name
5044
- WHERE ccu.constraint_name = c.conname
5045
- AND ccu.table_schema = cs.nspname
5041
+ AND a.attnum = k.attnum
5046
5042
  ),
5047
5043
  'match',
5048
5044
  c.confmatchtype,
@@ -5053,7 +5049,6 @@ const constraintsSql = `SELECT
5053
5049
  )
5054
5050
  FROM pg_class ft
5055
5051
  JOIN pg_catalog.pg_namespace fs ON fs.oid = ft.relnamespace
5056
- JOIN pg_catalog.pg_namespace cs ON cs.oid = c.connamespace
5057
5052
  WHERE contype = 'f' AND ft.oid = confrelid
5058
5053
  ) AS "references",
5059
5054
  (