rake-db 2.23.34 → 2.23.36
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 +19 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3981,33 +3981,40 @@ JOIN pg_catalog.pg_type t
|
|
|
3981
3981
|
) = d.typbasetype
|
|
3982
3982
|
JOIN pg_catalog.pg_namespace s ON s.oid = t.typnamespace
|
|
3983
3983
|
WHERE d.typtype = 'd' AND ${filterSchema("n.nspname")}`;
|
|
3984
|
-
const collationsSql = `SELECT
|
|
3984
|
+
const collationsSql = (version) => `SELECT
|
|
3985
3985
|
nspname "schemaName",
|
|
3986
3986
|
collname "name",
|
|
3987
3987
|
CASE WHEN collprovider = 'i' THEN 'icu' WHEN collprovider = 'c' THEN 'libc' ELSE collprovider::text END "provider",
|
|
3988
3988
|
collisdeterministic "deterministic",
|
|
3989
3989
|
collcollate "lcCollate",
|
|
3990
3990
|
collctype "lcCType",
|
|
3991
|
-
colliculocale "locale",
|
|
3991
|
+
${version >= 17 ? "colllocale" : "colliculocale"} "locale",
|
|
3992
3992
|
collversion "version"
|
|
3993
3993
|
FROM pg_collation
|
|
3994
3994
|
JOIN pg_namespace n on pg_collation.collnamespace = n.oid
|
|
3995
3995
|
WHERE ${filterSchema("n.nspname")}`;
|
|
3996
|
-
const sql = `SELECT (${schemasSql}) AS "schemas", ${jsonAgg(
|
|
3996
|
+
const sql = (version) => `SELECT (${schemasSql}) AS "schemas", ${jsonAgg(
|
|
3997
3997
|
tablesSql,
|
|
3998
3998
|
"tables"
|
|
3999
|
-
)}, ${jsonAgg(viewsSql, "views")}, ${jsonAgg(
|
|
4000
|
-
|
|
4001
|
-
"
|
|
4002
|
-
)}, ${jsonAgg(
|
|
4003
|
-
|
|
4004
|
-
"
|
|
4005
|
-
)}, ${jsonAgg(
|
|
4006
|
-
|
|
3999
|
+
)}, ${jsonAgg(viewsSql, "views")}, ${jsonAgg(
|
|
4000
|
+
indexesSql,
|
|
4001
|
+
"indexes"
|
|
4002
|
+
)}, ${jsonAgg(constraintsSql, "constraints")}, ${jsonAgg(
|
|
4003
|
+
triggersSql,
|
|
4004
|
+
"triggers"
|
|
4005
|
+
)}, ${jsonAgg(extensionsSql, "extensions")}, ${jsonAgg(
|
|
4006
|
+
enumsSql,
|
|
4007
|
+
"enums"
|
|
4008
|
+
)}, ${jsonAgg(domainsSql, "domains")}, ${jsonAgg(
|
|
4009
|
+
collationsSql(version),
|
|
4007
4010
|
"collations"
|
|
4008
4011
|
)}`;
|
|
4009
4012
|
async function introspectDbSchema(db) {
|
|
4010
|
-
const
|
|
4013
|
+
const {
|
|
4014
|
+
rows: [{ version: versionString }]
|
|
4015
|
+
} = await db.query("SELECT version()");
|
|
4016
|
+
const version = +versionString.match(/\d+/)[0];
|
|
4017
|
+
const data = await db.query(sql(version));
|
|
4011
4018
|
const result = data.rows[0];
|
|
4012
4019
|
for (const domain of result.domains) {
|
|
4013
4020
|
nullsToUndefined(domain);
|