diff --git a/database/entity/0025-combine_transaction_tables2/Transaction.ts b/database/entity/0025-combine_transaction_tables2/Transaction.ts new file mode 100644 index 000000000..f707e0811 --- /dev/null +++ b/database/entity/0025-combine_transaction_tables2/Transaction.ts @@ -0,0 +1,83 @@ +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: 'transaction_type_id', unsigned: true, nullable: false }) + transactionTypeId: 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: number + + @Column({ + name: 'balance_date', + type: 'timestamp', + default: () => 'CURRENT_TIMESTAMP', + nullable: false, + }) + balanceDate: Date + + @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', nullable: false }) + received: 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_state_user_transaction_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedStateUserTransactionId?: number | null + + @Column({ type: 'binary', length: 64, nullable: true, default: null }) + signature: Buffer + + @Column({ name: 'tx_hash', type: 'binary', length: 48, default: null, nullable: true }) + txHash: Buffer + + @Column({ type: 'binary', length: 32, nullable: true, default: null }) + pubkey: Buffer + + @Column({ + name: 'creation_ident_hash', + type: 'binary', + length: 32, + nullable: true, + default: null, + }) + creationIdentHash: Buffer +} diff --git a/database/entity/Transaction.ts b/database/entity/Transaction.ts index 5c9d2df88..d98b73e5b 100644 --- a/database/entity/Transaction.ts +++ b/database/entity/Transaction.ts @@ -1 +1 @@ -export { Transaction } from './0024-combine_transaction_tables/Transaction' +export { Transaction } from './0025-combine_transaction_tables2/Transaction' diff --git a/database/entity/UserTransaction.ts b/database/entity/UserTransaction.ts deleted file mode 100644 index bcbe6a65a..000000000 --- a/database/entity/UserTransaction.ts +++ /dev/null @@ -1 +0,0 @@ -export { UserTransaction } from './0001-init_db/UserTransaction' diff --git a/database/entity/index.ts b/database/entity/index.ts index 9371b5420..67f809b56 100644 --- a/database/entity/index.ts +++ b/database/entity/index.ts @@ -6,7 +6,6 @@ import { ServerUser } from './ServerUser' import { Transaction } from './Transaction' import { User } from './User' import { UserSetting } from './UserSetting' -import { UserTransaction } from './UserTransaction' import { AdminPendingCreation } from './AdminPendingCreation' export const entities = [ @@ -19,5 +18,4 @@ export const entities = [ Transaction, User, UserSetting, - UserTransaction, ]