@immich/sql-tools 0.0.1 → 0.1.0
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/README.md +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/package.json +2 -1
package/README.md
ADDED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1013,7 +1013,8 @@ const transformConstraints = (ctx, item) => {
|
|
|
1013
1013
|
const withAction = (constraint) => ` ON UPDATE ${constraint.onUpdate ?? ActionType.NO_ACTION} ON DELETE ${constraint.onDelete ?? ActionType.NO_ACTION}`;
|
|
1014
1014
|
const asConstraintBody = (constraint) => {
|
|
1015
1015
|
const base = `CONSTRAINT "${constraint.name}"`;
|
|
1016
|
-
|
|
1016
|
+
const type = constraint.type;
|
|
1017
|
+
switch (type) {
|
|
1017
1018
|
case ConstraintType.PRIMARY_KEY: {
|
|
1018
1019
|
const columnNames = asColumnList(constraint.columnNames);
|
|
1019
1020
|
return `${base} PRIMARY KEY (${columnNames})`;
|
|
@@ -1031,7 +1032,7 @@ const asConstraintBody = (constraint) => {
|
|
|
1031
1032
|
return `${base} CHECK (${constraint.expression})`;
|
|
1032
1033
|
}
|
|
1033
1034
|
default: {
|
|
1034
|
-
throw new Error(`Unknown constraint type: ${
|
|
1035
|
+
throw new Error(`Unknown constraint type: ${type}`);
|
|
1035
1036
|
}
|
|
1036
1037
|
}
|
|
1037
1038
|
};
|