@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 ADDED
@@ -0,0 +1,9 @@
1
+ # SQL Tools
2
+
3
+ Kysely-based tools and utilities for managing postgres schema.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i @immich/sql-tool
9
+ ```
package/dist/index.d.ts CHANGED
@@ -198,7 +198,7 @@ export declare type DatabaseIndex = {
198
198
  synchronize: boolean;
199
199
  };
200
200
 
201
- declare type DatabaseLike = Sql | Kysely<any>;
201
+ declare type DatabaseLike = Sql | Kysely<unknown>;
202
202
 
203
203
  export declare type DatabaseOptions = {
204
204
  name?: string;
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
- switch (constraint.type) {
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: ${constraint.type}`);
1035
+ throw new Error(`Unknown constraint type: ${type}`);
1035
1036
  }
1036
1037
  }
1037
1038
  };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@immich/sql-tools",
3
- "version": "0.0.1",
3
+ "description": "Kysely-based tools and utilities for managing postgres schema",
4
+ "version": "0.1.0",
4
5
  "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",