drizzle-orm 0.9.7 → 0.9.8
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/columns/column.d.ts +2 -2
- package/columns/column.js +4 -4
- package/package.json +1 -1
package/columns/column.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class Column<T extends ColumnType, TNullable extends boolean = tr
|
|
|
51
51
|
constructor(parent: AbstractTable<any>, columnName: string, columnType: T, nullable: TNullable);
|
|
52
52
|
serial(): Column<T, false, true>;
|
|
53
53
|
primaryKey(): Column<T, TAutoIncrement extends true ? true : false, TAutoIncrement>;
|
|
54
|
-
foreignKey<ITable extends AbstractTable<ITable>>(table: new (db: DB) => ITable, callback: (table: ITable) => Column<T, boolean, boolean>, onConstraint
|
|
54
|
+
foreignKey<ITable extends AbstractTable<ITable>>(table: new (db: DB) => ITable, callback: (table: ITable) => Column<T, boolean, boolean>, onConstraint?: {
|
|
55
55
|
onDelete?: 'CASCADE' | 'RESTRICT';
|
|
56
56
|
onUpdate?: 'CASCADE' | 'RESTRICT';
|
|
57
57
|
}): Column<T, TNullable, TAutoIncrement>;
|
|
@@ -61,7 +61,7 @@ export declare class IndexedColumn<T extends ColumnType, TNullable extends boole
|
|
|
61
61
|
constructor(parent: AbstractTable<any>, columnName: string, columnType: T, nullable: TNullable);
|
|
62
62
|
serial(): IndexedColumn<T, false, true>;
|
|
63
63
|
primaryKey(): IndexedColumn<T, TAutoIncrement extends true ? true : false, TAutoIncrement>;
|
|
64
|
-
foreignKey<ITable extends AbstractTable<ITable>>(table: new (db: DB) => ITable, callback: (table: ITable) => IndexedColumn<T, boolean, boolean>, onConstraint
|
|
64
|
+
foreignKey<ITable extends AbstractTable<ITable>>(table: new (db: DB) => ITable, callback: (table: ITable) => IndexedColumn<T, boolean, boolean>, onConstraint?: {
|
|
65
65
|
onDelete?: 'CASCADE' | 'RESTRICT';
|
|
66
66
|
onUpdate?: 'CASCADE' | 'RESTRICT';
|
|
67
67
|
}): IndexedColumn<T, TNullable, TAutoIncrement>;
|
package/columns/column.js
CHANGED
|
@@ -59,8 +59,8 @@ class Column extends AbstractColumn {
|
|
|
59
59
|
foreignKey(table, callback, onConstraint) {
|
|
60
60
|
const tableInstance = this.getParent().db.create(table);
|
|
61
61
|
this.referenced = callback(tableInstance);
|
|
62
|
-
this.onDelete = onConstraint.onDelete ? `ON DELETE ${onConstraint.onDelete}` : undefined;
|
|
63
|
-
this.onUpdate = onConstraint.onUpdate ? `ON UPDATE ${onConstraint.onUpdate}` : undefined;
|
|
62
|
+
this.onDelete = (onConstraint === null || onConstraint === void 0 ? void 0 : onConstraint.onDelete) ? `ON DELETE ${onConstraint.onDelete}` : undefined;
|
|
63
|
+
this.onUpdate = (onConstraint === null || onConstraint === void 0 ? void 0 : onConstraint.onUpdate) ? `ON UPDATE ${onConstraint.onUpdate}` : undefined;
|
|
64
64
|
return this;
|
|
65
65
|
}
|
|
66
66
|
autoIncrement() {
|
|
@@ -86,8 +86,8 @@ class IndexedColumn extends AbstractColumn {
|
|
|
86
86
|
foreignKey(table, callback, onConstraint) {
|
|
87
87
|
// eslint-disable-next-line new-cap
|
|
88
88
|
this.referenced = callback(this.getParent().db.create(table));
|
|
89
|
-
this.onDelete = onConstraint.onDelete ? `ON DELETE ${onConstraint.onDelete}` : undefined;
|
|
90
|
-
this.onUpdate = onConstraint.onUpdate ? `ON UPDATE ${onConstraint.onUpdate}` : undefined;
|
|
89
|
+
this.onDelete = (onConstraint === null || onConstraint === void 0 ? void 0 : onConstraint.onDelete) ? `ON DELETE ${onConstraint.onDelete}` : undefined;
|
|
90
|
+
this.onUpdate = (onConstraint === null || onConstraint === void 0 ? void 0 : onConstraint.onUpdate) ? `ON UPDATE ${onConstraint.onUpdate}` : undefined;
|
|
91
91
|
return this;
|
|
92
92
|
}
|
|
93
93
|
autoIncrement() {
|