postgres init

This commit is contained in:
Ben Wilson
2023-12-04 00:34:33 -05:00
parent f7303d73af
commit 39c4c033e2
11 changed files with 305 additions and 85 deletions
+4 -9
View File
@@ -1,14 +1,9 @@
import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
import { DateTimeTransformer } from '../utils/DateTimeTransformer';
import { TrackedEntity } from '../utils/TrackedEntity.entity';
//https://www.sqlite.org/withoutrowid.html
//The WITHOUT ROWID optimization is likely to be helpful for tables that have non-integer
// or composite (multi-column) PRIMARY KEYs and that do not store large strings or BLOBs.
//WITHOUT ROWID tables work best when individual rows are not too large.
@Entity({ withoutRowid: true })
@Entity()
@Index(['address', 'clientName', 'sessionId'], { unique: true })
export class ClientEntity extends TrackedEntity {
@@ -28,13 +23,13 @@ export class ClientEntity extends TrackedEntity {
@Column({ type: 'datetime', transformer: new DateTimeTransformer() })
@Column({ type: 'timestamp' })
startTime: Date;
@Column({ type: 'real', default: 0 })
@Column({ type: 'decimal', default: 0 })
bestDifficulty: number
@Column({ default: 0 })
@Column({ default: 0, type: 'decimal' })
hashRate: number;
}