pqb 0.43.0 → 0.43.1
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 +6 -4
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2835,13 +2835,15 @@ declare namespace TableData {
|
|
|
2835
2835
|
* - SET DEFAULT Set all the referencing columns, or a specified subset of the referencing columns, to their default values. A subset of columns can only be specified for ON DELETE actions. (There must be a row in the referenced table matching the default values, if they are not null, or the operation will fail.)
|
|
2836
2836
|
*/
|
|
2837
2837
|
type Action = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
2838
|
-
interface
|
|
2839
|
-
name?: string;
|
|
2838
|
+
interface BaseOptions {
|
|
2840
2839
|
match?: Match;
|
|
2841
2840
|
onUpdate?: Action;
|
|
2842
2841
|
onDelete?: Action;
|
|
2843
2842
|
dropMode?: TableData.DropMode;
|
|
2844
2843
|
}
|
|
2844
|
+
interface Options extends BaseOptions {
|
|
2845
|
+
name?: string;
|
|
2846
|
+
}
|
|
2845
2847
|
}
|
|
2846
2848
|
export { };
|
|
2847
2849
|
}
|
|
@@ -2971,7 +2973,7 @@ declare const tableDataMethods: TableDataMethods<string>;
|
|
|
2971
2973
|
declare const parseTableData: (dataFn?: TableDataFn<unknown, any>) => TableData;
|
|
2972
2974
|
declare const parseTableDataInput: (tableData: TableData, item: TableDataInput) => void;
|
|
2973
2975
|
|
|
2974
|
-
interface NumberColumnData extends BaseNumberData {
|
|
2976
|
+
interface NumberColumnData extends BaseNumberData, ColumnData {
|
|
2975
2977
|
identity?: TableData.Identity;
|
|
2976
2978
|
}
|
|
2977
2979
|
interface SerialColumnData extends NumberColumnData {
|
|
@@ -8470,7 +8472,7 @@ declare const columnForeignKeysToCode: (foreignKeys: TableData.ColumnReferences[
|
|
|
8470
8472
|
declare const foreignKeyArgumentToCode: ({ fnOrTable, foreignColumns, options, }: TableData.ColumnReferences, migration: boolean | undefined) => Codes;
|
|
8471
8473
|
declare const columnIndexesToCode: (items: Exclude<ColumnData['indexes'], undefined>) => Codes;
|
|
8472
8474
|
declare const columnExcludesToCode: (items: Exclude<ColumnData['excludes'], undefined>) => Codes;
|
|
8473
|
-
declare const columnCheckToCode: (ctx: ColumnToCodeCtx,
|
|
8475
|
+
declare const columnCheckToCode: (ctx: ColumnToCodeCtx, checks: ColumnDataCheckBase[]) => string;
|
|
8474
8476
|
declare const identityToCode: (identity: TableData.Identity, dataType?: string) => Codes;
|
|
8475
8477
|
declare const columnCode: (type: ColumnType, ctx: ColumnToCodeCtx, key: string, code: Code) => Code;
|
|
8476
8478
|
|
package/dist/index.js
CHANGED
|
@@ -812,8 +812,10 @@ const columnExcludesToCode = (items) => {
|
|
|
812
812
|
}
|
|
813
813
|
return code;
|
|
814
814
|
};
|
|
815
|
-
const columnCheckToCode = (ctx,
|
|
816
|
-
return
|
|
815
|
+
const columnCheckToCode = (ctx, checks) => {
|
|
816
|
+
return checks.map(
|
|
817
|
+
({ sql, name }) => `.check(${sql.toCode(ctx.t)}${name ? `, '${name}'` : ""})`
|
|
818
|
+
).join("");
|
|
817
819
|
};
|
|
818
820
|
const identityToCode = (identity, dataType) => {
|
|
819
821
|
const code = [];
|
|
@@ -897,8 +899,8 @@ const columnCode = (type, ctx, key, code) => {
|
|
|
897
899
|
}
|
|
898
900
|
}
|
|
899
901
|
if (data.comment) orchidCore.addCode(code, `.comment(${orchidCore.singleQuote(data.comment)})`);
|
|
900
|
-
if (data.
|
|
901
|
-
orchidCore.addCode(code, columnCheckToCode(ctx, data.
|
|
902
|
+
if (data.checks) {
|
|
903
|
+
orchidCore.addCode(code, columnCheckToCode(ctx, data.checks));
|
|
902
904
|
}
|
|
903
905
|
if (data.errors) {
|
|
904
906
|
for (const part of orchidCore.columnErrorMessagesToCode(data.errors)) {
|