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

View File

@@ -8,8 +8,10 @@ import {
CreateDateColumn,
DeleteDateColumn,
ForeignKeyColumn,
Generated,
PrimaryGeneratedColumn,
Table,
Timestamp,
UpdateDateColumn,
} from 'src/sql-tools';
@@ -24,16 +26,16 @@ import {
})
export class MemoryTable {
@PrimaryGeneratedColumn()
id!: string;
id!: Generated<string>;
@CreateDateColumn()
createdAt!: Date;
createdAt!: Generated<Timestamp>;
@UpdateDateColumn()
updatedAt!: Date;
updatedAt!: Generated<Timestamp>;
@DeleteDateColumn()
deletedAt?: Date;
deletedAt!: Timestamp | null;
@ForeignKeyColumn(() => UserTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
ownerId!: string;
@@ -46,22 +48,22 @@ export class MemoryTable {
/** unless set to true, will be automatically deleted in the future */
@Column({ type: 'boolean', default: false })
isSaved!: boolean;
isSaved!: Generated<boolean>;
/** memories are sorted in ascending order by this value */
@Column({ type: 'timestamp with time zone' })
memoryAt!: Date;
memoryAt!: Timestamp;
/** when the user last viewed the memory */
@Column({ type: 'timestamp with time zone', nullable: true })
seenAt?: Date;
seenAt!: Timestamp | null;
@Column({ type: 'timestamp with time zone', nullable: true })
showAt?: Date;
showAt!: Timestamp | null;
@Column({ type: 'timestamp with time zone', nullable: true })
hideAt?: Date;
hideAt!: Timestamp | null;
@UpdateIdColumn({ indexName: 'IDX_memories_update_id' })
updateId?: string;
updateId!: Generated<string>;
}