refactor(db): generate the Kysely table types from the migrated schema

The repositories typed their Kysely statements against 159 table interfaces
written by hand, one or more per repository. Nothing compared them with the
schema: a migration that renamed a column or changed its type left them
stale while tsc stayed green, and several had already drifted
(reservations.accommodation_id is TEXT, not INTEGER).

scripts/generate-db-types.ts migrates a throwaway database with the real
migrations, reads every table back and writes one interface per table into
src/db/kysely/ plus the DB map in db.ts. Every hand-written interface is now
Pick<DB, ...> of that type, and npm run check:db-types fails when the
committed files no longer match the migrations.

A column an insert may leave out (rowid, DEFAULT, nullable) is
InsertOptional<T>, declared as ColumnType<T, T | void, T>. The server
compiles without strictNullChecks, where Kysely's own Generated<T> still
demands the column; that is why the old code kept separate insert-only
interfaces. The ids callers pass as number | string are cast to the column
type at the bind, so every statement binds the same value as before.
This commit is contained in:
Maurice
2026-10-08 15:07:48 +02:00
parent ee921d5c28
commit 5f17a5df50
227 changed files with 3244 additions and 1394 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ These principles come out of a full-repo audit and shape all new code:
- **Protect the crown jewels.** The client's offline-first data core (repos + mutation queue + Dexie), the out-of-process plugin sandbox, the Zod contract layer, and the auth primitives are production-grade. Extend them; never route around them or rewrite them in anger.
- **No "modern shell over legacy core."** The debt pattern is a modern frame delegating to the old approach underneath (on the client: feature components calling the raw API past the offline core). New code goes all-in on the target architecture; when touching a legacy seam, migrate it rather than adding another wrapper.
- **Single source of truth over manual synchronization.** Never add a hand-mirrored copy of state, schema, or contract (server↔Dexie↔Zustand, schema↔SQL, the plugin contract). Derive from one source, or guard the copy with a parity test that cannot silently skip — the server entities are the precedent: `npm run gen:entities`/`check:entities --workspace=server` (`server/scripts/generate-entities.ts`) regenerate them from the live migrated schema instead of hand-editing, and a parity test (PARITY-009) pins entity-vs-DB drift (delete rules, index names) at zero skips.
- **Single source of truth over manual synchronization.** Never add a hand-mirrored copy of state, schema, or contract (server↔Dexie↔Zustand, schema↔SQL, the plugin contract). Derive from one source, or guard the copy with a parity test that cannot silently skip — the server entities are the precedent: `npm run gen:entities`/`check:entities --workspace=server` (`server/scripts/generate-entities.ts`) regenerate them from the live migrated schema instead of hand-editing, and a parity test (PARITY-009) pins entity-vs-DB drift (delete rules, index names) at zero skips. The Kysely table types the repositories query through are generated the same way (`gen:db-types`/`check:db-types`, `server/scripts/generate-db-types.ts`).
- **DI over global mutable module state.** New server code injects its dependencies; new client code avoids `window`-global buses and mutable module state.
- **Use the runtime's native idioms.** Prefer React 19 features (`useOptimistic`, Actions, `use()`/Suspense) and Nest subsystems (providers, pipes, guards, `@nestjs/schedule`) over hand-rolled equivalents.
- **Fail closed, gates stay on.** Security switches default to safe; misconfiguration must refuse, not degrade. Never lower a quality gate to land a change — no new `any`, no new `eslint-disable`, no downgrading rules to `warn`, no lowered coverage thresholds.
+3 -1
View File
@@ -15,6 +15,8 @@ npm run test # vitest run; also test:unit / test:integration / test
npm run test:coverage # istanbul coverage; per-domain ratchet over src/nest/**
npm run gen:plugin-facts # regenerate the plugin-protocol tables into plugin-sdk/ + shared/
npm run check:plugin-facts # CI gate — fails if the generated copies drifted
npm run gen:db-types # regenerate the Kysely table types in src/db/kysely/ from the migrated schema
npm run check:db-types # CI gate: fails when src/db/kysely/ no longer matches the migrations
node scripts/coverage-thresholds.mjs # after test:coverage — prints the ratchet block for vitest.config.ts
npm run db:call-graph -- --sync --tx [--domains nest/days,…] # sync DB-touching methods + transaction sites (exit 1 if any)
npm run lint:size # no file in src/ or scripts/ past 1000 lines, longer ones only shrink (CI gate)
@@ -42,7 +44,7 @@ Nest owns everything. Every domain is a DI module under `src/nest/<domain>/` (`c
- **Scheduling**: `src/nest/scheduling/` (`CronRegistrarService`) is the one way to schedule a cron. Jobs are `*.job.ts` providers in their owning domain. The registrar refuses to schedule under `NODE_ENV=test` (an integration test pins it). **Never use a `@Cron` decorator** — it bypasses that gate.
- **Plugins** (`src/nest/plugins/`): the child-process runtime (`supervisor/`, `runtime/plugin-host-entry.ts`, `protocol/envelope.ts`) is **intentionally not Nest** — it is the security boundary. `host/rpc-host.ts` registers an RPC method at spawn only if the plugin holds the unlocking permission (registration = authorization). Install-time gates live in `install/`; the manifest's `trek` version range fails closed, and `TREK_PLUGINS_IGNORE_TREK_RANGE` downgrades that to a warning. The protocol tables in `protocol/envelope.ts` (+ `src/plugin-event-sink.ts`) are **generated** into `plugin-sdk/` and `shared/` — run `gen:plugin-facts` after touching them and commit the output. `runtime/egress-policy.ts` is a hand-kept mirror guarded by a parity test in `plugin-sdk/`; change both sides together.
- **Storage**: `src/nest/storage/` is the upload driver abstraction (local / S3 / mirror behind one interface, with an admin surface and a usage job). Domain services never touch the filesystem or the S3 SDK directly.
- **DB** (`src/db/`): `better-sqlite3`, WAL, FK on. `database.ts` only holds the connection and applies pragmas. It does not build a schema, and importing it opens nothing (the first reader does). The connection's lifecycle belongs to the `DatabaseLifecycle` provider (`nest/database/database-lifecycle.service.ts`): `buildApp()` opens it through `open()` (which binds the ORM to later swaps and runs the schema bootstrap below), the shutdown closes it through `close()`, and a restore or the demo reset swaps the file only through the database backup port, `DATABASE_BACKUP` (`nest/database/database-backup.interface.ts`; the SQLite implementation is `nest/backup/sqlite-database-backup.ts`: `VACUUM INTO` snapshot, close, atomic file swap, `reopen()`). The port works on `DatabaseLifecycle.file`, the one resolved path (`TREK_DB_FILE` or `data/travel.db`), and a snapshot that fails fails the backup rather than archiving the live file. `MaintenanceRepository` is provided only by `MaintenanceModule`'s factory and injected everywhere else; no consumer constructs it. A provider that has to follow every reopen (the demo reset job saves the first demo baseline after a restore's re-bootstrap seeded the example trips) registers with `DatabaseLifecycle.onReopened()`, which runs after the reopen's schema bootstrap; a listener contains its own failures, since one that throws fails the reopen. MikroORM's migrations (`db/migrations/`) are the only schema source, **including for tests**: the hand-kept `schema.ts`/`migrations.ts`/`seeds.ts` builders and the parity test that guarded them are gone. Seeding is the MikroORM seeders in `db/seeders/`, applied by `db/orm.ts` from `buildApp()` before anything reads. An install the retired positional runner migrated (a `schema_version` row, no `mikro_orm_migrations` rows) is baselined by `db/legacy-baseline.ts`: the migrations whose `Legacy migration step N` docstring is ≤ its version are recorded as executed (never replayed) in the same transaction as the migrator run, while the baseline migration itself still runs first, as the legacy runner's `createTables()` did on every boot; anything it cannot map refuses the boot. Before a boot applies pending migrations to a file database that holds anything, `db/pre-migrate-snapshot.ts` writes a `VACUUM INTO` copy next to it (`pre-migrate-<schema>-<time>.db`, `<schema>` being `legacy-<schema_version>` or the last recorded migration's timestamp; the newest `TREK_DB_PRE_MIGRATE_SNAPSHOT_KEEP` stay) and the newer-database refusal names the matching copy; a copy that cannot be written refuses the boot unless `TREK_DB_PRE_MIGRATE_SNAPSHOT=false`. It is off under `NODE_ENV=test` unless a suite sets that variable to true, and a restore's re-bootstrap skips it (the archive is the copy). After the migrator, `db/email-case-index.ts` creates the case-insensitive unique index on `users.email` that its migration had to defer on an install holding two accounts whose emails differ only in case (flag `email_case_index_pending`). `db/orm-driver.ts` binds the ORM to that same connection instead of opening a second one — with `:memory:` under test, a second connection is a second, empty database. Every read and write goes through a repository in `db/repositories/` (each extends the shared `TrekRepository` base in `db/repositories/_shared/`, which validates the request context before delegating to MikroORM) and, for multi-statement writes, `UnitOfWork.transactional(...)` (`nest/database/unit-of-work.ts`, provided by the global `OrmModule`) — there is no `DatabaseService`/`DatabaseModule` to inject any more. Entrypoints outside an HTTP request — an MCP tool call, a plugin RPC dispatch, a WebSocket message, a cron job, boot-time seeding, a backup restore — open one explicitly with `withRequestContext()` (`nest/database/request-context.ts`), since only the pathless `mikroOrmRequestContext` middleware `buildApp()` mounts (with `@mikro-orm/nestjs`'s own `registerRequestContext` turned off in `app.module.ts`, UPLOADS-P16) forks an `EntityManager` per HTTP request. `NODE_ENV=test` ⇒ isolated `:memory:` DB per vitest worker, opened from a snapshot `tests/global-setup.ts` migrates once per run; `TREK_DB_FILE` ⇒ explicit file DB (Playwright harness).
- **DB** (`src/db/`): `better-sqlite3`, WAL, FK on. `database.ts` only holds the connection and applies pragmas. It does not build a schema, and importing it opens nothing (the first reader does). The connection's lifecycle belongs to the `DatabaseLifecycle` provider (`nest/database/database-lifecycle.service.ts`): `buildApp()` opens it through `open()` (which binds the ORM to later swaps and runs the schema bootstrap below), the shutdown closes it through `close()`, and a restore or the demo reset swaps the file only through the database backup port, `DATABASE_BACKUP` (`nest/database/database-backup.interface.ts`; the SQLite implementation is `nest/backup/sqlite-database-backup.ts`: `VACUUM INTO` snapshot, close, atomic file swap, `reopen()`). The port works on `DatabaseLifecycle.file`, the one resolved path (`TREK_DB_FILE` or `data/travel.db`), and a snapshot that fails fails the backup rather than archiving the live file. `MaintenanceRepository` is provided only by `MaintenanceModule`'s factory and injected everywhere else; no consumer constructs it. A provider that has to follow every reopen (the demo reset job saves the first demo baseline after a restore's re-bootstrap seeded the example trips) registers with `DatabaseLifecycle.onReopened()`, which runs after the reopen's schema bootstrap; a listener contains its own failures, since one that throws fails the reopen. MikroORM's migrations (`db/migrations/`) are the only schema source, **including for tests**: the hand-kept `schema.ts`/`migrations.ts`/`seeds.ts` builders and the parity test that guarded them are gone. Seeding is the MikroORM seeders in `db/seeders/`, applied by `db/orm.ts` from `buildApp()` before anything reads. An install the retired positional runner migrated (a `schema_version` row, no `mikro_orm_migrations` rows) is baselined by `db/legacy-baseline.ts`: the migrations whose `Legacy migration step N` docstring is ≤ its version are recorded as executed (never replayed) in the same transaction as the migrator run, while the baseline migration itself still runs first, as the legacy runner's `createTables()` did on every boot; anything it cannot map refuses the boot. Before a boot applies pending migrations to a file database that holds anything, `db/pre-migrate-snapshot.ts` writes a `VACUUM INTO` copy next to it (`pre-migrate-<schema>-<time>.db`, `<schema>` being `legacy-<schema_version>` or the last recorded migration's timestamp; the newest `TREK_DB_PRE_MIGRATE_SNAPSHOT_KEEP` stay) and the newer-database refusal names the matching copy; a copy that cannot be written refuses the boot unless `TREK_DB_PRE_MIGRATE_SNAPSHOT=false`. It is off under `NODE_ENV=test` unless a suite sets that variable to true, and a restore's re-bootstrap skips it (the archive is the copy). After the migrator, `db/email-case-index.ts` creates the case-insensitive unique index on `users.email` that its migration had to defer on an install holding two accounts whose emails differ only in case (flag `email_case_index_pending`). `db/orm-driver.ts` binds the ORM to that same connection instead of opening a second one — with `:memory:` under test, a second connection is a second, empty database. Kysely statements (`this.kysely<...>()`) type against `DB` from `db/kysely/db.ts`, narrowed with `Pick<DB, 'trips' | 'days'>`; those files are generated from the migrated schema by `scripts/generate-db-types.ts`, so a migration that adds or changes a column is followed by `npm run gen:db-types`, never by a hand-written table interface. Every read and write goes through a repository in `db/repositories/` (each extends the shared `TrekRepository` base in `db/repositories/_shared/`, which validates the request context before delegating to MikroORM) and, for multi-statement writes, `UnitOfWork.transactional(...)` (`nest/database/unit-of-work.ts`, provided by the global `OrmModule`) — there is no `DatabaseService`/`DatabaseModule` to inject any more. Entrypoints outside an HTTP request — an MCP tool call, a plugin RPC dispatch, a WebSocket message, a cron job, boot-time seeding, a backup restore — open one explicitly with `withRequestContext()` (`nest/database/request-context.ts`), since only the pathless `mikroOrmRequestContext` middleware `buildApp()` mounts (with `@mikro-orm/nestjs`'s own `registerRequestContext` turned off in `app.module.ts`, UPLOADS-P16) forks an `EntityManager` per HTTP request. `NODE_ENV=test` ⇒ isolated `:memory:` DB per vitest worker, opened from a snapshot `tests/global-setup.ts` migrates once per run; `TREK_DB_FILE` ⇒ explicit file DB (Playwright harness).
## Rules for new code
+2
View File
@@ -22,6 +22,8 @@
"check:plugin-facts": "node --import tsx scripts/gen-plugin-facts.ts --check",
"gen:entities": "node --import tsx scripts/generate-entities.ts",
"check:entities": "node --import tsx scripts/generate-entities.ts --check",
"gen:db-types": "node --import tsx scripts/generate-db-types.ts",
"check:db-types": "node --import tsx scripts/generate-db-types.ts --check",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
+259
View File
@@ -0,0 +1,259 @@
/**
* Generates the Kysely database type from the migrated schema.
*
* Repositories that need a statement the MikroORM QueryBuilder cannot express
* go through `this.kysely<...>()`, and Kysely types every table and column it
* touches from the type parameter. Those parameters used to be interfaces
* written by hand in each repository, so a migration that renamed a column or
* made it nullable left them stale while `tsc` stayed green. This script
* derives them instead, the same way `generate-entities.ts` derives the
* entities: it migrates a throwaway SQLite file with the real migrations,
* reads every table's columns back and writes
*
* src/db/kysely/<Table>.table.ts one interface per table
* src/db/kysely/db.ts `DB`, the map from table name to interface
*
* A repository narrows it with `Pick<DB, 'trips' | 'days'>`.
*
* The column types describe what the driver hands back, which is the storage
* model, not the domain one: an INTEGER flag is `number`, a timestamp is the
* `string` it is stored as. A column an insert may leave out (an integer
* primary key, anything with a DEFAULT, anything nullable) is
* `InsertOptional<T>`, declared in the generated `columns.ts`.
*
* Usage:
* node --import tsx scripts/generate-db-types.ts # rewrite src/db/kysely/
* node --import tsx scripts/generate-db-types.ts --check # exit 1 when src/db/kysely/ drifted (CI)
*/
import fs from 'node:fs';
import path from 'node:path';
import Database from 'better-sqlite3';
import { migrateTempDb, tempDbPath } from './generate-entities';
const SERVER_ROOT = path.join(__dirname, '..');
export const KYSELY_DIR = path.join(SERVER_ROOT, 'src/db/kysely');
/** Tables the application never queries: the migrator's own bookkeeping. */
const SKIPPED_TABLES: ReadonlySet<string> = new Set(['mikro_orm_migrations']);
const HEADER = '// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:\n' +
'// change the migration, then run `npm run gen:db-types`.\n';
export interface ColumnInfo {
name: string;
/** The declared type as `PRAGMA table_xinfo` reports it (may be empty). */
type: string;
notnull: boolean;
hasDefault: boolean;
/** Position in the primary key, 0 when the column is not part of it. */
pk: number;
/** 0 for an ordinary column, 2 or 3 for a generated (computed) one. */
hidden: number;
}
export interface TableInfo {
name: string;
columns: ColumnInfo[];
}
/**
* The TypeScript type a value of this declared type comes back as from
* better-sqlite3, following SQLite's affinity rules (sqlite.org/datatype3.html
* section 3.1). Date-like declarations have NUMERIC affinity on paper, but
* every one of them in this schema holds ISO text, so they read as strings.
*/
export function tsTypeFor(declared: string): string {
const t = declared.toUpperCase();
if (t.includes('INT')) return 'number';
if (t.includes('CHAR') || t.includes('CLOB') || t.includes('TEXT')) return 'string';
if (t.includes('BLOB')) return 'Buffer';
if (t.includes('REAL') || t.includes('FLOA') || t.includes('DOUB')) return 'number';
if (t.includes('DATE') || t.includes('TIME')) return 'string';
if (t.includes('BOOL') || t.includes('NUMERIC') || t.includes('DECIMAL')) return 'number';
if (t === '') return 'unknown';
throw new Error(`generate-db-types: no TypeScript mapping for the declared column type "${declared}"`);
}
/** `budget_items` -> `BudgetItems`. */
export function pascalCase(table: string): string {
return table
.split('_')
.filter((part) => part !== '')
.map((part) => part[0].toUpperCase() + part.slice(1))
.join('');
}
/** The interface name for a table: `BudgetItemsTable`. */
export function interfaceName(table: string): string {
return `${pascalCase(table)}Table`;
}
function columnType(table: TableInfo, column: ColumnInfo): string {
// A lone INTEGER primary key aliases the rowid: it is never null and the
// database assigns it when the insert leaves it out.
const pkColumns = table.columns.filter((c) => c.pk > 0);
const isRowid = column.pk > 0 && pkColumns.length === 1 && column.type.toUpperCase() === 'INTEGER';
const base = tsTypeFor(column.type);
const nullable = !column.notnull && column.pk === 0;
const value = nullable ? `${base} | null` : base;
if (column.hidden === 2 || column.hidden === 3) return `GeneratedAlways<${value}>`;
if (isRowid || column.hasDefault || nullable) return `InsertOptional<${value}>`;
return value;
}
const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
function propertyKey(name: string): string {
return IDENTIFIER.test(name) ? name : `'${name.replace(/'/g, "\\'")}'`;
}
/** The source of `<Table>.table.ts`. */
export function renderTable(table: TableInfo): string {
const types = table.columns.map((c) => columnType(table, c));
const has = (marker: string) => types.some((t) => t.startsWith(`${marker}<`));
const imports =
(has('GeneratedAlways') ? "import type { GeneratedAlways } from 'kysely';\n" : '') +
(has('InsertOptional') ? "import type { InsertOptional } from './columns';\n" : '');
const importBlock = imports === '' ? '' : `${imports}\n`;
const body = table.columns.map((c, i) => ` ${propertyKey(c.name)}: ${types[i]};`).join('\n');
return `${HEADER}\n${importBlock}export interface ${interfaceName(table.name)} {\n${body}\n}\n`;
}
/**
* The source of `columns.ts`. Kysely makes a column optional on insert when its
* insert type can be null or undefined, which it tests with `NonNullable`. The
* server compiles without `strictNullChecks`, where `T | undefined` and
* `T | null` collapse to `T`, so Kysely's own `Generated<T>` would still demand
* the column. `void` survives that collapse and still refuses any other value,
* so the insert stays typed.
*/
export function renderColumns(): string {
return (
`${HEADER}\nimport type { ColumnType } from 'kysely';\n\n` +
'/** A column an insert may leave out: the database assigns it (rowid, DEFAULT) or stores NULL. */\n' +
'export type InsertOptional<T> = ColumnType<T, T | void, T>;\n'
);
}
/** The source of `db.ts`. */
export function renderDb(tables: readonly TableInfo[]): string {
const imports = tables
.map((t) => `import type { ${interfaceName(t.name)} } from './${pascalCase(t.name)}.table';`)
.join('\n');
const body = tables.map((t) => ` ${propertyKey(t.name)}: ${interfaceName(t.name)};`).join('\n');
return (
`${HEADER}\n${imports}\n\n` +
'/** Every table of the migrated schema. A repository narrows it: `this.kysely<Pick<DB, \'trips\'>>()`. */\n' +
`export interface DB {\n${body}\n}\n`
);
}
/** Reads every application table of a migrated database, sorted by name, columns in declaration order. */
export function readSchema(dbPath: string): TableInfo[] {
const conn = new Database(dbPath, { readonly: true });
try {
const names = conn
.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name")
.all() as { name: string }[];
return names
.filter(({ name }) => !SKIPPED_TABLES.has(name))
.map(({ name }) => {
const rows = conn.prepare(`PRAGMA table_xinfo("${name.replace(/"/g, '""')}")`).all() as {
name: string;
type: string;
notnull: number;
dflt_value: string | null;
pk: number;
hidden: number;
}[];
return {
name,
columns: rows
.filter((r) => r.hidden !== 1)
.map((r) => ({
name: r.name,
type: r.type,
notnull: r.notnull === 1,
hasDefault: r.dflt_value !== null,
pk: r.pk,
hidden: r.hidden,
})),
};
});
} finally {
conn.close();
}
}
/** File name -> content for everything under src/db/kysely/. */
export function renderAll(tables: readonly TableInfo[]): Map<string, string> {
if (tables.length === 0) {
throw new Error('generate-db-types: the migrated schema has no tables; check the migrations path');
}
const files = new Map<string, string>();
for (const table of tables) files.set(`${pascalCase(table.name)}.table.ts`, renderTable(table));
files.set('columns.ts', renderColumns());
files.set('db.ts', renderDb(tables));
return files;
}
export async function generateDbTypes(): Promise<Map<string, string>> {
const dbPath = tempDbPath();
try {
await migrateTempDb(dbPath);
return renderAll(readSchema(dbPath));
} finally {
fs.rmSync(dbPath, { force: true });
}
}
/** Every file that differs from, is missing from or is extra in `dir`. Read-only. */
export function checkDbTypes(dir: string, files: ReadonlyMap<string, string>): string[] {
const drift: string[] = [];
for (const [fileName, content] of files) {
const onDisk = path.join(dir, fileName);
const current = fs.existsSync(onDisk) ? fs.readFileSync(onDisk, 'utf8').replace(/\r\n/g, '\n') : undefined;
if (current !== content) drift.push(fileName);
}
const onDiskFiles = fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => f.endsWith('.ts')) : [];
for (const fileName of onDiskFiles) {
if (!files.has(fileName)) drift.push(`${fileName} (not produced by the generator)`);
}
return drift.sort();
}
/** Replaces the contents of `dir` with `files`, removing any .ts file the generator no longer produces. */
export function writeDbTypes(dir: string, files: ReadonlyMap<string, string>): void {
fs.mkdirSync(dir, { recursive: true });
for (const fileName of fs.readdirSync(dir)) {
if (fileName.endsWith('.ts') && !files.has(fileName)) fs.rmSync(path.join(dir, fileName));
}
for (const [fileName, content] of files) fs.writeFileSync(path.join(dir, fileName), content);
}
async function main(): Promise<void> {
const check = process.argv.slice(2).includes('--check');
const files = await generateDbTypes();
if (check) {
const drift = checkDbTypes(KYSELY_DIR, files);
for (const fileName of drift) console.error(`[generate-db-types] DRIFT: src/db/kysely/${fileName}`);
if (drift.length > 0) {
console.error('[generate-db-types] --check failed. Run: npm run gen:db-types');
process.exit(1);
}
console.log(`[generate-db-types] --check: ${files.size} files match the migrated schema`);
return;
}
writeDbTypes(KYSELY_DIR, files);
console.log(`[generate-db-types] wrote ${files.size} files to src/db/kysely/`);
}
if (require.main === module) {
main().catch((err: unknown) => {
console.error('[generate-db-types] failed:', err);
process.exit(1);
});
}
+2 -2
View File
@@ -1921,11 +1921,11 @@ export function applyTextPasses(source: string, fixups: RuleFixups): string {
// side effect and needs nothing from those modules.
// ---------------------------------------------------------------------------
function tempDbPath(): string {
export function tempDbPath(): string {
return path.join(os.tmpdir(), `trek-gen-entities-${crypto.randomUUID()}.db`);
}
async function migrateTempDb(dbPath: string): Promise<void> {
export async function migrateTempDb(dbPath: string): Promise<void> {
const orm = await SqliteMikroORM.init({
entities: [],
discovery: { warnWhenNoEntities: false },
+3 -4
View File
@@ -2,10 +2,9 @@
"scripts/db-call-graph.mjs": 1036,
"scripts/generate-entities.ts": 2259,
"src/db/dialect/sql-functions.ts": 1007,
"src/db/repositories/DayAssignments.repository.ts": 1030,
"src/db/repositories/Places.repository.ts": 1483,
"src/db/repositories/Reservations.repository.ts": 1806,
"src/db/repositories/Trips.repository.ts": 1164,
"src/db/repositories/Places.repository.ts": 1440,
"src/db/repositories/Reservations.repository.ts": 1676,
"src/db/repositories/Trips.repository.ts": 1121,
"src/db/repositories/Users.repository.ts": 1710,
"src/nest/atlas/atlas-geo.ts": 1005,
"src/nest/atlas/atlas.service.ts": 1182,
+15
View File
@@ -0,0 +1,15 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface AddonsTable {
id: string;
name: string;
description: InsertOptional<string | null>;
type: InsertOptional<string>;
icon: InsertOptional<string | null>;
enabled: InsertOptional<number | null>;
config: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
}
@@ -0,0 +1,9 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface AppSettingsTable {
key: string;
value: InsertOptional<string | null>;
}
@@ -0,0 +1,10 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface AssignmentParticipantsTable {
id: InsertOptional<number>;
assignment_id: number;
user_id: number;
}
+14
View File
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface AuditLogTable {
id: InsertOptional<number>;
created_at: InsertOptional<string | null>;
user_id: InsertOptional<number | null>;
action: string;
resource: InsertOptional<string | null>;
details: InsertOptional<string | null>;
ip: InsertOptional<string | null>;
}
+19
View File
@@ -0,0 +1,19 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface BucketListTable {
id: InsertOptional<number>;
user_id: number;
name: string;
lat: InsertOptional<number | null>;
lng: InsertOptional<number | null>;
country_code: InsertOptional<string | null>;
notes: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
target_date: InsertOptional<string | null>;
visited_at: InsertOptional<string | null>;
visited_source: InsertOptional<string | null>;
region_code: InsertOptional<string | null>;
}
@@ -0,0 +1,10 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface BudgetCategoryOrderTable {
trip_id: number;
category: string;
sort_order: InsertOptional<number>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface BudgetItemMembersTable {
id: InsertOptional<number>;
budget_item_id: number;
user_id: number;
paid: InsertOptional<number>;
amount: InsertOptional<number | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface BudgetItemPayersTable {
id: InsertOptional<number>;
budget_item_id: number;
user_id: number;
amount: InsertOptional<number>;
}
+24
View File
@@ -0,0 +1,24 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface BudgetItemsTable {
id: InsertOptional<number>;
trip_id: number;
category: InsertOptional<string>;
name: string;
total_price: InsertOptional<number>;
persons: InsertOptional<number | null>;
days: InsertOptional<number | null>;
note: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
paid_by_user_id: InsertOptional<number | null>;
expense_date: InsertOptional<string | null>;
reservation_id: InsertOptional<number | null>;
currency: InsertOptional<string | null>;
exchange_rate: InsertOptional<number>;
ticket_json: InsertOptional<string | null>;
place_id: InsertOptional<number | null>;
}
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface BudgetSettlementsTable {
id: InsertOptional<number>;
trip_id: number;
from_user_id: number;
to_user_id: number;
amount: InsertOptional<number>;
created_at: InsertOptional<string | null>;
created_by_user_id: InsertOptional<number | null>;
currency: InsertOptional<string | null>;
exchange_rate: InsertOptional<number>;
settled_at: InsertOptional<string | null>;
note: InsertOptional<string | null>;
}
+13
View File
@@ -0,0 +1,13 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CategoriesTable {
id: InsertOptional<number>;
name: string;
color: InsertOptional<string | null>;
icon: InsertOptional<string | null>;
user_id: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
}
+15
View File
@@ -0,0 +1,15 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollabLinksTable {
id: InsertOptional<number>;
trip_id: number;
user_id: number;
title: string;
url: string;
pinned: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollabMessageReactionsTable {
id: InsertOptional<number>;
message_id: number;
user_id: number;
emoji: string;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollabMessagesTable {
id: InsertOptional<number>;
trip_id: number;
user_id: number;
text: string;
reply_to: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
deleted: InsertOptional<number | null>;
}
+18
View File
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollabNotesTable {
id: InsertOptional<number>;
trip_id: number;
user_id: number;
category: InsertOptional<string | null>;
title: string;
content: InsertOptional<string | null>;
color: InsertOptional<string | null>;
pinned: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
website: InsertOptional<string | null>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollabPollVotesTable {
id: InsertOptional<number>;
poll_id: number;
user_id: number;
option_index: number;
created_at: InsertOptional<string | null>;
}
+16
View File
@@ -0,0 +1,16 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollabPollsTable {
id: InsertOptional<number>;
trip_id: number;
user_id: number;
question: string;
options: string;
multiple: InsertOptional<number | null>;
closed: InsertOptional<number | null>;
deadline: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,13 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollectionLabelsTable {
id: InsertOptional<number>;
collection_id: number;
name: string;
color: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,13 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollectionMembersTable {
id: InsertOptional<number>;
collection_id: number;
user_id: number;
status: InsertOptional<string>;
role: InsertOptional<string>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,7 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface CollectionPlaceLabelsTable {
collection_place_id: number;
label_id: number;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollectionPlaceRatingsTable {
id: InsertOptional<number>;
collection_place_id: number;
user_id: number;
rating: number;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,7 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface CollectionPlaceTagsTable {
collection_place_id: number;
tag_id: number;
}
@@ -0,0 +1,33 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollectionPlacesTable {
id: InsertOptional<number>;
collection_id: number;
owner_id: number;
saved_by: InsertOptional<number | null>;
name: string;
description: InsertOptional<string | null>;
lat: InsertOptional<number | null>;
lng: InsertOptional<number | null>;
address: InsertOptional<string | null>;
category_id: InsertOptional<number | null>;
price: InsertOptional<number | null>;
currency: InsertOptional<string | null>;
notes: InsertOptional<string | null>;
image_url: InsertOptional<string | null>;
google_place_id: InsertOptional<string | null>;
google_ftid: InsertOptional<string | null>;
osm_id: InsertOptional<string | null>;
website: InsertOptional<string | null>;
phone: InsertOptional<string | null>;
status: InsertOptional<string>;
source_trip_id: InsertOptional<number | null>;
source_place_id: InsertOptional<number | null>;
links: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
}
+18
View File
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface CollectionsTable {
id: InsertOptional<number>;
owner_id: number;
name: string;
description: InsertOptional<string | null>;
color: InsertOptional<string | null>;
icon: InsertOptional<string | null>;
cover_image: InsertOptional<string | null>;
links: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
}
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DawarichConnectionsTable {
user_id: InsertOptional<number>;
url: InsertOptional<string | null>;
api_key: InsertOptional<string | null>;
allow_insecure_tls: InsertOptional<number>;
sync_enabled: InsertOptional<number>;
last_sync_at: InsertOptional<string | null>;
last_sync_state: InsertOptional<string>;
last_sync_error: InsertOptional<string | null>;
capabilities: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
}
@@ -0,0 +1,33 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DawarichVisitSuggestionsTable {
id: InsertOptional<number>;
user_id: number;
source_visit_id: string;
trip_id: InsertOptional<number | null>;
name: string;
lat: InsertOptional<number | null>;
lng: InsertOptional<number | null>;
started_at: string;
ended_at: string;
duration_minutes: InsertOptional<number>;
local_date: string;
source_status: InsertOptional<string>;
confidence: InsertOptional<number | null>;
confidence_band: InsertOptional<string | null>;
country_code: InsertOptional<string | null>;
state: InsertOptional<string>;
target: InsertOptional<string | null>;
accepted_place_id: InsertOptional<number | null>;
accepted_journal_entry_id: InsertOptional<number | null>;
accepted_bucket_list_item_id: InsertOptional<number | null>;
matched_bucket_list_item_id: InsertOptional<number | null>;
source_hash: string;
accepted_hash: InsertOptional<string | null>;
source_missing_at: InsertOptional<string | null>;
first_seen_at: InsertOptional<string>;
last_seen_at: InsertOptional<string>;
}
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DayAccommodationsTable {
id: InsertOptional<number>;
trip_id: number;
place_id: InsertOptional<number | null>;
start_day_id: number;
end_day_id: number;
check_in: InsertOptional<string | null>;
check_in_end: InsertOptional<string | null>;
check_out: InsertOptional<string | null>;
confirmation: InsertOptional<string | null>;
notes: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,23 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DayAssignmentsTable {
id: InsertOptional<number>;
day_id: number;
place_id: number;
order_index: InsertOptional<number | null>;
notes: InsertOptional<string | null>;
reservation_status: InsertOptional<string | null>;
reservation_notes: InsertOptional<string | null>;
reservation_datetime: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
assignment_time: InsertOptional<string | null>;
assignment_end_time: InsertOptional<string | null>;
leg_transport_mode: InsertOptional<string | null>;
incoming_leg_transport_mode: InsertOptional<string | null>;
end_day: InsertOptional<number>;
accommodation_id: InsertOptional<number | null>;
route_excluded: InsertOptional<number>;
}
+16
View File
@@ -0,0 +1,16 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DayNotesTable {
id: InsertOptional<number>;
day_id: number;
trip_id: number;
text: string;
time: InsertOptional<string | null>;
icon: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
color: InsertOptional<string | null>;
}
+14
View File
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DaysTable {
id: InsertOptional<number>;
trip_id: number;
day_number: number;
date: InsertOptional<string | null>;
notes: InsertOptional<string | null>;
title: InsertOptional<string | null>;
default_transport_mode: InsertOptional<string | null>;
}
@@ -0,0 +1,21 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DocumentConnectionsTable {
id: InsertOptional<number>;
trip_id: number;
provider_id: string;
owner_user_id: number;
base_url: string;
secrets: InsertOptional<string | null>;
settings: InsertOptional<string>;
allow_insecure_tls: InsertOptional<number>;
capabilities: InsertOptional<string | null>;
last_probe_at: InsertOptional<string | null>;
last_probe_state: InsertOptional<string>;
last_probe_error: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
}
@@ -0,0 +1,17 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DocumentProviderFieldsTable {
id: InsertOptional<number>;
provider_id: string;
field_key: string;
label: string;
input_type: InsertOptional<string>;
placeholder: InsertOptional<string | null>;
hint: InsertOptional<string | null>;
required: InsertOptional<number | null>;
secret: InsertOptional<number | null>;
sort_order: InsertOptional<number | null>;
}
@@ -0,0 +1,13 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DocumentProvidersTable {
id: string;
name: string;
description: InsertOptional<string | null>;
icon: InsertOptional<string | null>;
enabled: InsertOptional<number | null>;
sort_order: InsertOptional<number | null>;
}
@@ -0,0 +1,28 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface DocumentSyncItemsTable {
id: InsertOptional<number>;
link_id: number;
trip_id: number;
file_id: InsertOptional<number | null>;
trek_doc_uid: string;
remote_id: InsertOptional<string | null>;
remote_name: InsertOptional<string | null>;
remote_version: InsertOptional<string | null>;
remote_size: InsertOptional<number | null>;
remote_modified_at: InsertOptional<string | null>;
content_sha256: InsertOptional<string | null>;
pushed_sha256: InsertOptional<string | null>;
state: InsertOptional<string>;
error_code: InsertOptional<string | null>;
attempts: InsertOptional<number>;
next_attempt_at: InsertOptional<string | null>;
remote_missing_at: InsertOptional<string | null>;
first_seen_at: InsertOptional<string>;
last_seen_at: InsertOptional<string>;
synced_at: InsertOptional<string | null>;
remote_trashed_at: InsertOptional<string | null>;
}
+14
View File
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface FileLinksTable {
id: InsertOptional<number>;
file_id: number;
reservation_id: InsertOptional<number | null>;
assignment_id: InsertOptional<number | null>;
place_id: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
budget_item_id: InsertOptional<number | null>;
}
@@ -0,0 +1,9 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface GoogleApiUsageTable {
day: string;
calls: InsertOptional<number>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface GooglePlacePhotoMetaTable {
place_id: string;
attribution: InsertOptional<string | null>;
fetched_at: number;
error_at: InsertOptional<number | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface HiddenCountriesTable {
id: InsertOptional<number>;
user_id: number;
country_code: string;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface HiddenRegionsTable {
id: InsertOptional<number>;
user_id: number;
region_code: string;
country_code: string;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface IdempotencyKeysTable {
key: string;
user_id: number;
method: string;
path: string;
status_code: number;
response_body: string;
created_at: InsertOptional<number>;
}
@@ -0,0 +1,15 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface InviteTokensTable {
id: InsertOptional<number>;
token: string;
max_uses: InsertOptional<number>;
used_count: InsertOptional<number>;
expires_at: InsertOptional<string | null>;
created_by: number;
created_at: InsertOptional<string | null>;
trip_id: InsertOptional<number | null>;
}
@@ -0,0 +1,16 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneyBooksTable {
id: InsertOptional<number>;
journey_id: number;
title: InsertOptional<string>;
document: string;
version: InsertOptional<number>;
created_by: InsertOptional<number | null>;
updated_by: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneyContributorsTable {
journey_id: number;
user_id: number;
role: string;
added_at: number;
hide_skeletons: InsertOptional<number>;
}
@@ -0,0 +1,33 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneyEntriesTable {
id: InsertOptional<number>;
journey_id: number;
source_trip_id: InsertOptional<number | null>;
source_place_id: InsertOptional<number | null>;
author_id: number;
type: string;
title: InsertOptional<string | null>;
story: InsertOptional<string | null>;
entry_date: string;
entry_time: InsertOptional<string | null>;
location_name: InsertOptional<string | null>;
location_lat: InsertOptional<number | null>;
location_lng: InsertOptional<number | null>;
mood: InsertOptional<string | null>;
weather: InsertOptional<string | null>;
tags: InsertOptional<string | null>;
visibility: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: number;
updated_at: number;
pros_cons: InsertOptional<string | null>;
stats_excluded: InsertOptional<number>;
dismissed: InsertOptional<number>;
country_code: InsertOptional<string | null>;
source_assignment_id: InsertOptional<number | null>;
is_draft: InsertOptional<number>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneyEntryPhotosTable {
entry_id: number;
journey_photo_id: number;
sort_order: InsertOptional<number | null>;
created_at: number;
}
@@ -0,0 +1,17 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneyPhotosTable {
id: InsertOptional<number>;
journey_id: number;
photo_id: number;
caption: InsertOptional<string | null>;
shared: InsertOptional<number | null>;
sort_order: InsertOptional<number | null>;
provider: InsertOptional<string | null>;
asset_id: InsertOptional<string | null>;
owner_id: InsertOptional<number | null>;
created_at: number;
}
@@ -0,0 +1,16 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneyShareTokensTable {
id: InsertOptional<number>;
journey_id: number;
token: string;
created_by: number;
share_timeline: InsertOptional<number | null>;
share_gallery: InsertOptional<number | null>;
share_map: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
newest_first: InsertOptional<number>;
}
@@ -0,0 +1,8 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface JourneyTripsTable {
journey_id: number;
trip_id: number;
added_at: number;
}
+22
View File
@@ -0,0 +1,22 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface JourneysTable {
id: InsertOptional<number>;
user_id: number;
title: string;
subtitle: InsertOptional<string | null>;
cover_gradient: InsertOptional<string | null>;
status: InsertOptional<string | null>;
created_at: number;
updated_at: number;
cover_image: InsertOptional<string | null>;
show_trip_tracks: InsertOptional<number>;
show_verdict: InsertOptional<number>;
show_mood: InsertOptional<number>;
show_weather: InsertOptional<number>;
status_override: InsertOptional<string | null>;
photo_location: InsertOptional<number>;
}
+17
View File
@@ -0,0 +1,17 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface McpTokensTable {
id: InsertOptional<number>;
user_id: number;
name: string;
token_hash: string;
token_prefix: string;
created_at: InsertOptional<string | null>;
last_used_at: InsertOptional<string | null>;
kind: InsertOptional<string>;
scope_mode: InsertOptional<string>;
api_scopes: InsertOptional<string | null>;
}
+10
View File
@@ -0,0 +1,10 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface MigrationsTable {
id: InsertOptional<number>;
timestamp: number;
name: string;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface NotificationChannelPreferencesTable {
user_id: number;
event_type: string;
channel: string;
enabled: InsertOptional<number>;
}
@@ -0,0 +1,26 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface NotificationsTable {
id: InsertOptional<number>;
type: string;
scope: string;
target: number;
sender_id: InsertOptional<number | null>;
recipient_id: number;
title_key: string;
title_params: InsertOptional<string | null>;
text_key: string;
text_params: InsertOptional<string | null>;
positive_text_key: InsertOptional<string | null>;
negative_text_key: InsertOptional<string | null>;
positive_callback: InsertOptional<string | null>;
negative_callback: InsertOptional<string | null>;
response: InsertOptional<string | null>;
navigate_text_key: InsertOptional<string | null>;
navigate_target: InsertOptional<string | null>;
is_read: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface OauthClientsTable {
id: string;
user_id: InsertOptional<number | null>;
name: string;
client_id: string;
client_secret_hash: string;
redirect_uris: InsertOptional<string>;
allowed_scopes: InsertOptional<string>;
created_at: InsertOptional<string | null>;
is_public: InsertOptional<number>;
created_via: InsertOptional<string>;
allows_client_credentials: InsertOptional<number>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface OauthConsentsTable {
id: InsertOptional<number>;
client_id: string;
user_id: number;
scopes: InsertOptional<string>;
updated_at: InsertOptional<string | null>;
}
+19
View File
@@ -0,0 +1,19 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface OauthTokensTable {
id: InsertOptional<number>;
client_id: string;
user_id: number;
access_token_hash: string;
refresh_token_hash: string;
scopes: InsertOptional<string>;
access_token_expires_at: string;
refresh_token_expires_at: string;
revoked_at: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
parent_token_id: InsertOptional<number | null>;
audience: InsertOptional<string | null>;
}
@@ -0,0 +1,7 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface PackingBagMembersTable {
bag_id: number;
user_id: number;
}
+15
View File
@@ -0,0 +1,15 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingBagsTable {
id: InsertOptional<number>;
trip_id: number;
name: string;
color: InsertOptional<string>;
weight_limit_grams: InsertOptional<number | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
user_id: InsertOptional<number | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingCategoryAssigneesTable {
id: InsertOptional<number>;
trip_id: number;
category_name: string;
user_id: number;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingItemContributorsTable {
item_id: number;
user_id: number;
status: InsertOptional<string>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,7 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface PackingItemRecipientsTable {
item_id: number;
user_id: number;
}
@@ -0,0 +1,21 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingItemsTable {
id: InsertOptional<number>;
trip_id: number;
name: string;
checked: InsertOptional<number | null>;
category: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
created_at: InsertOptional<string | null>;
weight_grams: InsertOptional<number | null>;
bag_id: InsertOptional<number | null>;
quantity: InsertOptional<number>;
updated_at: InsertOptional<string | null>;
is_private: InsertOptional<number>;
owner_id: InsertOptional<number | null>;
packed_quantity: InsertOptional<number | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingTemplateCategoriesTable {
id: InsertOptional<number>;
template_id: number;
name: string;
sort_order: InsertOptional<number>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingTemplateItemsTable {
id: InsertOptional<number>;
category_id: number;
name: string;
sort_order: InsertOptional<number>;
weight_grams: InsertOptional<number | null>;
quantity: InsertOptional<number>;
bag_name: InsertOptional<string | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PackingTemplatesTable {
id: InsertOptional<number>;
name: string;
created_by: number;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PasswordResetTokensTable {
id: InsertOptional<number>;
user_id: number;
token_hash: string;
expires_at: string;
consumed_at: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
created_ip: InsertOptional<string | null>;
}
@@ -0,0 +1,19 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PhotoProviderFieldsTable {
id: InsertOptional<number>;
provider_id: string;
field_key: string;
label: string;
input_type: InsertOptional<string>;
placeholder: InsertOptional<string | null>;
hint: InsertOptional<string | null>;
required: InsertOptional<number | null>;
secret: InsertOptional<number | null>;
settings_key: InsertOptional<string | null>;
payload_key: InsertOptional<string | null>;
sort_order: InsertOptional<number | null>;
}
@@ -0,0 +1,13 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PhotoProvidersTable {
id: string;
name: string;
description: InsertOptional<string | null>;
icon: InsertOptional<string | null>;
enabled: InsertOptional<number | null>;
sort_order: InsertOptional<number | null>;
}
+18
View File
@@ -0,0 +1,18 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PhotosTable {
id: InsertOptional<number>;
trip_id: number;
day_id: InsertOptional<number | null>;
place_id: InsertOptional<number | null>;
filename: string;
original_name: string;
file_size: InsertOptional<number | null>;
mime_type: InsertOptional<string | null>;
caption: InsertOptional<string | null>;
taken_at: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PlaceDetailsCacheTable {
place_id: string;
lang: InsertOptional<string>;
expanded: InsertOptional<number>;
payload_json: string;
fetched_at: number;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PlaceRatingsTable {
id: InsertOptional<number>;
place_id: number;
user_id: number;
rating: number;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PlaceRegionsTable {
place_id: InsertOptional<number>;
country_code: string;
region_code: string;
region_name: string;
}
@@ -0,0 +1,20 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PlaceShadowPicksTable {
id: InsertOptional<number>;
created_at: InsertOptional<string>;
query: string;
lang: InsertOptional<string | null>;
bias_lat: InsertOptional<number | null>;
bias_lng: InsertOptional<number | null>;
source: string;
live_rank: number;
live_count: number;
picked_name: string;
picked_lat: number;
picked_lng: number;
picked_place_id: InsertOptional<string | null>;
}
+7
View File
@@ -0,0 +1,7 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface PlaceTagsTable {
place_id: number;
tag_id: number;
}
+41
View File
@@ -0,0 +1,41 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PlacesTable {
id: InsertOptional<number>;
trip_id: number;
name: string;
description: InsertOptional<string | null>;
lat: InsertOptional<number | null>;
lng: InsertOptional<number | null>;
address: InsertOptional<string | null>;
category_id: InsertOptional<number | null>;
price: InsertOptional<number | null>;
currency: InsertOptional<string | null>;
reservation_status: InsertOptional<string | null>;
reservation_notes: InsertOptional<string | null>;
reservation_datetime: InsertOptional<string | null>;
place_time: InsertOptional<string | null>;
end_time: InsertOptional<string | null>;
duration_minutes: InsertOptional<number | null>;
notes: InsertOptional<string | null>;
image_url: InsertOptional<string | null>;
google_place_id: InsertOptional<string | null>;
google_ftid: InsertOptional<string | null>;
website: InsertOptional<string | null>;
phone: InsertOptional<string | null>;
transport_mode: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
osm_id: InsertOptional<string | null>;
route_geometry: InsertOptional<string | null>;
route_color: InsertOptional<string | null>;
stop_type: InsertOptional<string | null>;
fill_percent: InsertOptional<number | null>;
amap_poi_id: InsertOptional<string | null>;
source: InsertOptional<string | null>;
email: InsertOptional<string | null>;
opening_hours: InsertOptional<string | null>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginActionsTable {
plugin_id: string;
action_key: string;
label: string;
hint: InsertOptional<string | null>;
danger: InsertOptional<number>;
sort_order: InsertOptional<number>;
scope: InsertOptional<string>;
}
@@ -0,0 +1,16 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginCapabilityAuditTable {
id: InsertOptional<number>;
plugin_id: string;
acting_user_id: InsertOptional<number | null>;
method: string;
resource: InsertOptional<string | null>;
code: string;
ts: InsertOptional<string>;
prev_hash: InsertOptional<string | null>;
hash: string;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginEgressHostsTable {
id: InsertOptional<number>;
plugin_id: string;
host: string;
created_at: InsertOptional<string>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginEntityMetadataTable {
id: InsertOptional<number>;
plugin_id: string;
entity_type: string;
entity_id: number;
key: string;
value: InsertOptional<string | null>;
updated_at: InsertOptional<string>;
}
@@ -0,0 +1,13 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginErrorLogTable {
id: InsertOptional<number>;
plugin_id: string;
ts: InsertOptional<string | null>;
level: InsertOptional<string>;
message: InsertOptional<string | null>;
stack: InsertOptional<string | null>;
}
@@ -0,0 +1,10 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginMetaMigrationsTable {
plugin_id: string;
migration_id: string;
applied_at: InsertOptional<string | null>;
}
@@ -0,0 +1,10 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface PluginOauthStateTable {
state: string;
plugin_id: string;
user_id: number;
verifier: string;
created_at: number;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginOauthTokensTable {
plugin_id: string;
user_id: number;
access_token: InsertOptional<string | null>;
refresh_token: InsertOptional<string | null>;
expires_at: InsertOptional<number | null>;
scope: InsertOptional<string | null>;
updated_at: InsertOptional<string>;
}
@@ -0,0 +1,14 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginScheduledTasksTable {
id: InsertOptional<number>;
plugin_id: string;
name: string;
due_at: number;
payload: InsertOptional<string>;
every_ms: InsertOptional<number | null>;
created_at: InsertOptional<string>;
}
@@ -0,0 +1,21 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginSettingsFieldsTable {
id: InsertOptional<number>;
plugin_id: string;
field_key: string;
label: InsertOptional<string | null>;
input_type: InsertOptional<string>;
placeholder: InsertOptional<string | null>;
hint: InsertOptional<string | null>;
required: InsertOptional<number>;
secret: InsertOptional<number>;
scope: InsertOptional<string>;
options: InsertOptional<string | null>;
oauth_config: InsertOptional<string | null>;
sort_order: InsertOptional<number>;
default_value: InsertOptional<string | null>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginUserConfigTable {
plugin_id: string;
user_id: number;
config: InsertOptional<string>;
updated_at: InsertOptional<string>;
}
@@ -0,0 +1,11 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginUserErasureQueueTable {
id: InsertOptional<number>;
plugin_id: string;
user_id: number;
created_at: InsertOptional<string>;
}
+38
View File
@@ -0,0 +1,38 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PluginsTable {
id: string;
name: string;
description: InsertOptional<string | null>;
type: InsertOptional<string>;
icon: InsertOptional<string | null>;
version: InsertOptional<string | null>;
api_version: InsertOptional<number | null>;
min_trek_version: InsertOptional<string | null>;
permissions: InsertOptional<string | null>;
granted_permissions: InsertOptional<string | null>;
status: InsertOptional<string>;
config: InsertOptional<string | null>;
source_repo: InsertOptional<string | null>;
source_commit: InsertOptional<string | null>;
sha256: InsertOptional<string | null>;
crash_count: InsertOptional<number>;
last_error: InsertOptional<string | null>;
reviewed_at: InsertOptional<string | null>;
sort_order: InsertOptional<number>;
installed_at: InsertOptional<string | null>;
updated_at: InsertOptional<string | null>;
enabled: InsertOptional<number>;
capabilities: InsertOptional<string>;
author_pubkey: InsertOptional<string | null>;
dependencies: InsertOptional<string>;
operator_egress: InsertOptional<number>;
update_block_code: InsertOptional<string | null>;
update_block_detail: InsertOptional<string | null>;
update_block_version: InsertOptional<string | null>;
trek_range: InsertOptional<string | null>;
update_hold: InsertOptional<number>;
}
@@ -0,0 +1,17 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface PushSubscriptionsTable {
id: InsertOptional<number>;
user_id: number;
endpoint: string;
p256dh: string;
auth: string;
vapid_public_key: string;
user_agent: InsertOptional<string | null>;
created_at: InsertOptional<string>;
last_success_at: InsertOptional<string | null>;
failure_count: InsertOptional<number>;
}
@@ -0,0 +1,8 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
export interface ReservationDayPositionsTable {
reservation_id: number;
day_id: number;
position: number;
}
@@ -0,0 +1,19 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface ReservationEndpointsTable {
id: InsertOptional<number>;
reservation_id: number;
role: string;
sequence: InsertOptional<number>;
name: string;
code: InsertOptional<string | null>;
lat: number;
lng: number;
timezone: InsertOptional<string | null>;
local_time: InsertOptional<string | null>;
local_date: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
}
@@ -0,0 +1,10 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface ReservationTravelersTable {
id: InsertOptional<number>;
reservation_id: number;
user_id: number;
}
@@ -0,0 +1,34 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface ReservationsTable {
id: InsertOptional<number>;
trip_id: number;
day_id: InsertOptional<number | null>;
end_day_id: InsertOptional<number | null>;
place_id: InsertOptional<number | null>;
assignment_id: InsertOptional<number | null>;
title: string;
accommodation_id: InsertOptional<string | null>;
reservation_time: InsertOptional<string | null>;
reservation_end_time: InsertOptional<string | null>;
location: InsertOptional<string | null>;
confirmation_number: InsertOptional<string | null>;
notes: InsertOptional<string | null>;
status: InsertOptional<string | null>;
type: InsertOptional<string | null>;
created_at: InsertOptional<string | null>;
metadata: InsertOptional<string | null>;
day_plan_position: InsertOptional<number | null>;
needs_review: InsertOptional<number>;
external_source: InsertOptional<string | null>;
external_id: InsertOptional<string | null>;
external_owner_user_id: InsertOptional<number | null>;
external_synced_at: InsertOptional<string | null>;
sync_enabled: InsertOptional<number | null>;
external_hash: InsertOptional<string | null>;
url: InsertOptional<string | null>;
ingest_state: InsertOptional<string>;
}
@@ -0,0 +1,12 @@
// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:
// change the migration, then run `npm run gen:db-types`.
import type { InsertOptional } from './columns';
export interface RoadtripDayBoundariesTable {
trip_id: number;
day_number: number;
from_assignment_id: number;
to_assignment_id: InsertOptional<number | null>;
fraction: number;
}

Some files were not shown because too many files have changed in this diff Show More