@tstdl/base 0.92.93 → 0.92.95
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.
|
@@ -8,7 +8,7 @@ type ConverterContext = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare const getDrizzleTableFromType: typeof _getDrizzleTableFromType;
|
|
10
10
|
export declare function getColumnDefinitions(table: PgTableWithColumns<any>): ColumnDefinition[];
|
|
11
|
-
export declare function _getDrizzleTableFromType<T extends EntityType, S extends string>(type: T,
|
|
11
|
+
export declare function _getDrizzleTableFromType<T extends EntityType, S extends string>(type: T, fallbackSchemaName?: S): PgTableFromType<T, S>;
|
|
12
12
|
export declare function registerEnum(enumeration: Enumeration, name: string): void;
|
|
13
13
|
export declare function getPgEnum(schema: string | PgSchema, enumeration: Enumeration, context?: ConverterContext): PgEnum<[string, ...string[]]>;
|
|
14
14
|
export {};
|
|
@@ -25,7 +25,7 @@ const columnDefinitionsSymbol = Symbol('columnDefinitions');
|
|
|
25
25
|
export function getColumnDefinitions(table) {
|
|
26
26
|
return table[columnDefinitionsSymbol];
|
|
27
27
|
}
|
|
28
|
-
export function _getDrizzleTableFromType(type,
|
|
28
|
+
export function _getDrizzleTableFromType(type, fallbackSchemaName) {
|
|
29
29
|
const metadata = reflectionRegistry.getMetadata(type);
|
|
30
30
|
assertDefined(metadata, `Type ${type.name} does not have reflection metadata.`);
|
|
31
31
|
const tableReflectionDatas = [];
|
|
@@ -36,7 +36,7 @@ export function _getDrizzleTableFromType(type, schemaName) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
const tableReflectionData = tableReflectionDatas[0];
|
|
39
|
-
const schema = assertDefinedPass(
|
|
39
|
+
const schema = assertDefinedPass(tableReflectionData?.schema ?? fallbackSchemaName, 'Table schema not provided');
|
|
40
40
|
const tableName = tableReflectionData?.name ?? getDefaultTableName(type);
|
|
41
41
|
const dbSchema = getDbSchema(schema);
|
|
42
42
|
const columnDefinitions = getPostgresColumnEntries(type, dbSchema, tableName);
|