diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 5c28a3e74..e74271c9b 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -12,7 +12,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0069-add_user_roles_table', + DB_VERSION: '0070-add_dlt_transactions_table', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts b/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts index ece6d146d..829454b99 100644 --- a/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts +++ b/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts @@ -1,6 +1,4 @@ -import Decimal from 'decimal.js-light' import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' import { Transaction } from '../Transaction' @Entity('dlt_transactions', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) @@ -11,47 +9,18 @@ export class DltTransaction extends BaseEntity { @Column({ name: 'transaction_id', type: 'int', unsigned: true, nullable: false }) transactionId: number - @Column({ name: 'message_id', length: 40, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ + name: 'message_id', + length: 40, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) messageId: string @Column({ name: 'verified', type: 'bool', nullable: false, default: false }) verified: boolean - @Column({ - name: 'community_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - transformer: DecimalTransformer, - }) - communityBalance: Decimal | null - - @Column({ - name: 'community_balance_date', - type: 'datetime', - nullable: true, - }) - CommunityBalanceDate: Date | null - - @Column({ - name: 'community_balance_decay', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - transformer: DecimalTransformer, - }) - CommunityBalanceDecay: Decimal | null - - @Column({ - name: 'community_balance_decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - CommunityBalanceDecayStart: Date | null - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) createdAt: Date diff --git a/database/entity/DltTransaction.ts b/database/entity/DltTransaction.ts new file mode 100644 index 000000000..d9c03306c --- /dev/null +++ b/database/entity/DltTransaction.ts @@ -0,0 +1 @@ +export { DltTransaction } from './0070-add_dlt_transactions_table/DltTransaction' diff --git a/database/entity/index.ts b/database/entity/index.ts index b27ac4d61..a5c37efa9 100644 --- a/database/entity/index.ts +++ b/database/entity/index.ts @@ -12,12 +12,14 @@ import { ContributionMessage } from './ContributionMessage' import { Community } from './Community' import { FederatedCommunity } from './FederatedCommunity' import { UserRole } from './UserRole' +import { DltTransaction } from './DltTransaction' export const entities = [ Community, Contribution, ContributionLink, ContributionMessage, + DltTransaction, Event, FederatedCommunity, LoginElopageBuys, diff --git a/database/migrations/0070-add_dlt_transactions_table.ts b/database/migrations/0070-add_dlt_transactions_table.ts index 90b59ffc1..479855a39 100644 --- a/database/migrations/0070-add_dlt_transactions_table.ts +++ b/database/migrations/0070-add_dlt_transactions_table.ts @@ -6,12 +6,8 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis CREATE TABLE dlt_transactions ( id int unsigned NOT NULL AUTO_INCREMENT, transactions_id int(10) unsigned NOT NULL, - message_id varchar(40) NOT NULL, + message_id varchar(40) NULL DEFAULT NULL, verified tinyint(4) NOT NULL DEFAULT 0, - community_balance decimal(40,20) DEFAULT NULL NULL, - community_balance_date datetime(3) DEFAULT NULL NULL, - community_balance_decay decimal(40,20) DEFAULT NULL NULL, - community_balance_decay_start datetime(3) DEFAULT NULL NULL, created_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), verified_at datetime(3), PRIMARY KEY (id) diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 03048b624..2b06094f6 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -4,7 +4,7 @@ import dotenv from 'dotenv' dotenv.config() const constants = { - DB_VERSION: '0069-add_user_roles_table', + DB_VERSION: '0070-add_dlt_transactions_table', LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL || 'info', diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index 72da74aaa..5402d6d96 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ */ const constants = { - DB_VERSION: '0069-add_user_roles_table', + DB_VERSION: '0070-add_dlt_transactions_table', // DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info