From 8aaa6117bab28fbfc4d848e58c4d3ee6ecf1d733 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 24 Feb 2022 00:26:15 +0100 Subject: [PATCH] new entity definition --- .../Transaction.ts | 62 +++++++++++++++++++ database/entity/Transaction.ts | 2 +- ...ble.ts => 0027-clean_transaction_table.ts} | 0 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 database/entity/0027-clean_transaction_table/Transaction.ts rename database/migrations/{0026-clean_transaction_table.ts => 0027-clean_transaction_table.ts} (100%) diff --git a/database/entity/0027-clean_transaction_table/Transaction.ts b/database/entity/0027-clean_transaction_table/Transaction.ts new file mode 100644 index 000000000..c23600386 --- /dev/null +++ b/database/entity/0027-clean_transaction_table/Transaction.ts @@ -0,0 +1,62 @@ +import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm' + +@Entity('transactions') +export class Transaction extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'user_id', unsigned: true, nullable: false }) + userId: number + + @Column({ name: 'transaction_id', unsigned: true, nullable: false }) + transactionId: number + + @Column({ name: 'type_id', unsigned: true, nullable: false }) + typeId: number + + @Column({ type: 'bigint', nullable: false }) + amount: BigInt + + @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ + name: 'send_sender_final_balance', + type: 'bigint', + nullable: true, + default: null, + }) + sendSenderFinalBalance: BigInt | null + + @Column({ name: 'balance', type: 'bigint', default: 0 }) + balance: BigInt + + @Column({ + name: 'balance_date', + type: 'timestamp', + default: () => 'CURRENT_TIMESTAMP', + nullable: false, + }) + balanceDate: Date + + @Column({ name: 'creation_date', type: 'timestamp', nullable: true, default: null }) + creationDate: Date + + @Column({ + name: 'linked_user_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedUserId?: number | null + + @Column({ + name: 'linked_transaction_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedTransactionId?: number | null +} diff --git a/database/entity/Transaction.ts b/database/entity/Transaction.ts index a49e9d0a1..af6a17424 100644 --- a/database/entity/Transaction.ts +++ b/database/entity/Transaction.ts @@ -1 +1 @@ -export { Transaction } from './0026-combine_transaction_tables2/Transaction' +export { Transaction } from './0027-clean_transaction_table/Transaction' diff --git a/database/migrations/0026-clean_transaction_table.ts b/database/migrations/0027-clean_transaction_table.ts similarity index 100% rename from database/migrations/0026-clean_transaction_table.ts rename to database/migrations/0027-clean_transaction_table.ts