refactor: database types (#19624)

This commit is contained in:
Jason Rasmussen
2025-06-30 13:19:16 -04:00
committed by GitHub
parent 09cbc5d3f4
commit e60bc3c304
99 changed files with 518 additions and 889 deletions
@@ -1,10 +1,5 @@
import { ColumnType } from 'kysely';
import { PrimaryGeneratedUuidV7Column } from 'src/decorators';
import { Column, CreateDateColumn, Table } from 'src/sql-tools';
type Timestamp = ColumnType<Date, Date | string, Date | string>;
type Generated<T> =
T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
import { Column, CreateDateColumn, Generated, Table, Timestamp } from 'src/sql-tools';
@Table('memories_audit')
export class MemoryAuditTable {
@@ -18,5 +13,5 @@ export class MemoryAuditTable {
userId!: string;
@CreateDateColumn({ default: () => 'clock_timestamp()', indexName: 'IDX_memories_audit_deleted_at' })
deletedAt!: Timestamp;
deletedAt!: Generated<Timestamp>;
}