Skip to content

Commit

Permalink
chore: add kysely codegen command, exclude from prettier and re-run i…
Browse files Browse the repository at this point in the history
…t on latest migrations
  • Loading branch information
zackpollard committed Jan 15, 2025
1 parent 819c246 commit 6878ab3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions server/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules
coverage
dist
**/migrations/**
db.d.ts

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
Expand Down
1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"typeorm:migrations:revert": "typeorm migration:revert -d ./dist/bin/database.js",
"typeorm:schema:drop": "typeorm query -d ./dist/bin/database.js 'DROP schema public cascade; CREATE schema public;'",
"typeorm:schema:reset": "npm run typeorm:schema:drop && npm run typeorm:migrations:run",
"kysely:codegen": "npx kysely-codegen --include-pattern=\"(public|vectors).*\" --dialect postgres --url postgres://postgres:postgres@localhost/immich --log-level debug --out-file=./src/db.d.ts",
"sync:open-api": "node ./dist/bin/sync-open-api.js",
"sync:sql": "node ./dist/bin/sync-sql.js",
"email:dev": "email dev -p 3050 --dir src/emails"
Expand Down
23 changes: 14 additions & 9 deletions server/src/db.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
* Please do not edit it manually.
*/

import type { ColumnType } from 'kysely';
import type { ColumnType } from "kysely";

export type ArrayType<T> = ArrayTypeImpl<T> extends (infer U)[] ? U[] : ArrayTypeImpl<T>;
export type ArrayType<T> = ArrayTypeImpl<T> extends (infer U)[]
? U[]
: ArrayTypeImpl<T>;

export type ArrayTypeImpl<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S[], I[], U[]> : T[];
export type ArrayTypeImpl<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S[], I[], U[]>
: T[];

export type AssetsStatusEnum = 'active' | 'deleted' | 'trashed';
export type AssetsStatusEnum = "active" | "deleted" | "trashed";

export type Generated<T> =
T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;

export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;

Expand All @@ -28,7 +33,7 @@ export type JsonPrimitive = boolean | number | string | null;

export type JsonValue = JsonArray | JsonObject | JsonPrimitive;

export type Sourcetype = 'exif' | 'machine-learning';
export type Sourcetype = "exif" | "machine-learning";

export type Timestamp = ColumnType<Date, Date | string, Date | string>;

Expand Down Expand Up @@ -257,7 +262,7 @@ export interface NaturalearthCountries {
admin: string;
admin_a3: string;
coordinates: string;
id: number;
id: Generated<number>;
type: string;
}

Expand Down Expand Up @@ -433,6 +438,6 @@ export interface DB {
tags_closure: TagsClosure;
user_metadata: UserMetadata;
users: Users;
'vectors.pg_vector_index_stat': VectorsPgVectorIndexStat;
"vectors.pg_vector_index_stat": VectorsPgVectorIndexStat;
version_history: VersionHistory;
}

0 comments on commit 6878ab3

Please sign in to comment.