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.mjs CHANGED
@@ -5003,23 +5003,19 @@ const constraintsSql = `SELECT
5003
5003
  ft.relname,
5004
5004
  'columns',
5005
5005
  (
5006
- SELECT json_agg(ccu.column_name ORDER BY a.attnum)
5007
- FROM information_schema.key_column_usage ccu
5006
+ SELECT json_agg(a.attname ORDER BY k.ordinality)
5007
+ FROM unnest(c.conkey) WITH ORDINALITY AS k(attnum, ordinality)
5008
5008
  JOIN pg_catalog.pg_attribute a
5009
5009
  ON a.attrelid = c.conrelid
5010
- AND a.attname = ccu.column_name
5011
- WHERE ccu.constraint_name = c.conname
5012
- AND ccu.table_schema = cs.nspname
5010
+ AND a.attnum = k.attnum
5013
5011
  ),
5014
5012
  'foreignColumns',
5015
5013
  (
5016
- SELECT json_agg(ccu.column_name ORDER BY a.attnum)
5017
- FROM information_schema.constraint_column_usage ccu
5014
+ SELECT json_agg(a.attname ORDER BY k.ordinality)
5015
+ FROM unnest(c.confkey) WITH ORDINALITY AS k(attnum, ordinality)
5018
5016
  JOIN pg_catalog.pg_attribute a
5019
5017
  ON a.attrelid = c.confrelid
5020
- AND a.attname = ccu.column_name
5021
- WHERE ccu.constraint_name = c.conname
5022
- AND ccu.table_schema = cs.nspname
5018
+ AND a.attnum = k.attnum
5023
5019
  ),
5024
5020
  'match',
5025
5021
  c.confmatchtype,
@@ -5030,7 +5026,6 @@ const constraintsSql = `SELECT
5030
5026
  )
5031
5027
  FROM pg_class ft
5032
5028
  JOIN pg_catalog.pg_namespace fs ON fs.oid = ft.relnamespace
5033
- JOIN pg_catalog.pg_namespace cs ON cs.oid = c.connamespace
5034
5029
  WHERE contype = 'f' AND ft.oid = confrelid
5035
5030
  ) AS "references",
5036
5031
  (