rake-db 2.22.39 → 2.22.41
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.d.ts +2 -0
- package/dist/index.js +27 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3674,12 +3674,12 @@ const columnsSql = ({
|
|
|
3674
3674
|
join = "",
|
|
3675
3675
|
where
|
|
3676
3676
|
}) => `SELECT
|
|
3677
|
-
${schema}.nspname
|
|
3678
|
-
${table}.relname
|
|
3679
|
-
a.attname
|
|
3680
|
-
t.typname
|
|
3681
|
-
tn.nspname
|
|
3682
|
-
a.attndims
|
|
3677
|
+
${schema}.nspname "schemaName",
|
|
3678
|
+
${table}.relname "tableName",
|
|
3679
|
+
a.attname "name",
|
|
3680
|
+
t.typname "type",
|
|
3681
|
+
tn.nspname "typeSchema",
|
|
3682
|
+
a.attndims "arrayDims",
|
|
3683
3683
|
information_schema._pg_char_max_length(tt.id, tt.mod) "maxChars",
|
|
3684
3684
|
information_schema._pg_numeric_precision(tt.id, tt.mod) "numericPrecision",
|
|
3685
3685
|
information_schema._pg_numeric_scale(tt.id,tt.mod) "numericScale",
|
|
@@ -3719,7 +3719,9 @@ const columnsSql = ({
|
|
|
3719
3719
|
seq.seqcycle
|
|
3720
3720
|
)
|
|
3721
3721
|
) END
|
|
3722
|
-
) "identity"
|
|
3722
|
+
) "identity",
|
|
3723
|
+
ext.extname "extension",
|
|
3724
|
+
a.atttypmod "typmod"
|
|
3723
3725
|
FROM pg_attribute a
|
|
3724
3726
|
${join}
|
|
3725
3727
|
LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum
|
|
@@ -3743,6 +3745,8 @@ LEFT JOIN pg_catalog.pg_description pgd
|
|
|
3743
3745
|
AND pgd.objsubid = a.attnum
|
|
3744
3746
|
LEFT JOIN (pg_depend dep JOIN pg_sequence seq ON (dep.classid = 'pg_class'::regclass AND dep.objid = seq.seqrelid AND dep.deptype = 'i'))
|
|
3745
3747
|
ON (dep.refclassid = 'pg_class'::regclass AND dep.refobjid = ${table}.oid AND dep.refobjsubid = a.attnum)
|
|
3748
|
+
LEFT JOIN pg_depend d ON d.objid = t.oid AND d.classid = 'pg_type'::regclass AND d.deptype = 'e'
|
|
3749
|
+
LEFT JOIN pg_extension ext ON ext.oid = d.refobjid
|
|
3746
3750
|
WHERE a.attnum > 0
|
|
3747
3751
|
AND NOT a.attisdropped
|
|
3748
3752
|
AND ${where}
|
|
@@ -4263,7 +4267,8 @@ const makeDomainsMap = (ctx, data) => {
|
|
|
4263
4267
|
tableName: "",
|
|
4264
4268
|
isNullable: it.isNullable,
|
|
4265
4269
|
collate: it.collate,
|
|
4266
|
-
default: it.default
|
|
4270
|
+
default: it.default,
|
|
4271
|
+
typmod: -1
|
|
4267
4272
|
});
|
|
4268
4273
|
if (it.check) {
|
|
4269
4274
|
column.data.check = {
|
|
@@ -4299,9 +4304,11 @@ const instantiateDbColumn = (ctx, data, domains, dbColumn) => {
|
|
|
4299
4304
|
const typeId = typeSchema === "pg_catalog" ? typeName : `${typeSchema}.${typeName}`;
|
|
4300
4305
|
const domainColumn = domains[typeId];
|
|
4301
4306
|
if (domainColumn) {
|
|
4302
|
-
column = new pqb.DomainColumn(
|
|
4303
|
-
|
|
4304
|
-
|
|
4307
|
+
column = new pqb.DomainColumn(
|
|
4308
|
+
ctx.columnSchemaConfig,
|
|
4309
|
+
typeId,
|
|
4310
|
+
dbColumn.extension
|
|
4311
|
+
).as(domainColumn);
|
|
4305
4312
|
} else {
|
|
4306
4313
|
const enumType = data.enums.find(
|
|
4307
4314
|
(x) => x.name === typeName && x.schemaName === typeSchema
|
|
@@ -4314,7 +4321,11 @@ const instantiateDbColumn = (ctx, data, domains, dbColumn) => {
|
|
|
4314
4321
|
ctx.columnSchemaConfig.type
|
|
4315
4322
|
);
|
|
4316
4323
|
} else {
|
|
4317
|
-
column = new pqb.CustomTypeColumn(
|
|
4324
|
+
column = new pqb.CustomTypeColumn(
|
|
4325
|
+
ctx.columnSchemaConfig,
|
|
4326
|
+
typeId,
|
|
4327
|
+
dbColumn.extension
|
|
4328
|
+
);
|
|
4318
4329
|
((_c = (_a = ctx.unsupportedTypes)[_b = dbColumn.type]) != null ? _c : _a[_b] = []).push(
|
|
4319
4330
|
`${dbColumn.schemaName}${dbColumn.tableName ? `.${dbColumn.tableName}` : ""}.${dbColumn.name}`
|
|
4320
4331
|
);
|
|
@@ -4337,7 +4348,10 @@ const instantiateDbColumn = (ctx, data, domains, dbColumn) => {
|
|
|
4337
4348
|
return column;
|
|
4338
4349
|
};
|
|
4339
4350
|
const instantiateColumnByDbType = (ctx, type, isSerial, params) => {
|
|
4340
|
-
|
|
4351
|
+
let columnFn = ctx.columnsByType[!isSerial ? type : type === "int2" ? "smallserial" : type === "int4" ? "serial" : "bigserial"];
|
|
4352
|
+
if (!columnFn && params.extension === "postgis" && type === "geography" && pqb.PostgisGeographyPointColumn.isDefaultPoint(params.typmod)) {
|
|
4353
|
+
columnFn = ctx.columnsByType.geographyDefaultPoint;
|
|
4354
|
+
}
|
|
4341
4355
|
return columnFn ? pqb.instantiateColumn(columnFn, params) : void 0;
|
|
4342
4356
|
};
|
|
4343
4357
|
const tableToAst = (ctx, data, table, action, domains) => {
|