From 964a81f7909fc38955c82d8d25545ac5a0c54a68 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 1 May 2025 09:54:59 +0200 Subject: [PATCH] add missing table row types, needed for esbuild --- database/entity/0001-init_db/Migration.ts | 2 +- .../LoginEmailOptIn.ts | 10 ++--- .../LoginElopageBuys.ts | 10 +++-- .../TransactionLink.ts | 6 +-- .../AdminPendingCreation.ts | 4 +- .../Transaction.ts | 1 + .../ContributionLink.ts | 12 +++--- .../entity/0063-event_link_fields/Event.ts | 23 ++++++----- .../Transaction.ts | 1 + .../0069-add_user_roles_table/UserRole.ts | 11 +++-- .../DltTransaction.ts | 10 ++++- .../Transaction.ts | 1 + .../PendingTransaction.ts | 9 +++-- .../Transaction.ts | 7 ++-- .../Contribution.ts | 28 +++++++------ .../ContributionMessage.ts | 10 ++--- .../UserContact.ts | 40 ++++++++++++++++--- .../FederatedCommunity.ts | 4 +- .../User.ts | 27 ++++++++++--- .../0086-add_community_location/Community.ts | 2 +- database/entity/index.ts | 2 +- 21 files changed, 145 insertions(+), 75 deletions(-) diff --git a/database/entity/0001-init_db/Migration.ts b/database/entity/0001-init_db/Migration.ts index 2aa79ae9f..13c848b07 100644 --- a/database/entity/0001-init_db/Migration.ts +++ b/database/entity/0001-init_db/Migration.ts @@ -5,7 +5,7 @@ export class Migration extends BaseEntity { @PrimaryGeneratedColumn() // This is actually not a primary column version: number - @Column({ length: 256, nullable: true, default: null }) + @Column({ type: 'varchar', length: 256, nullable: true, default: null }) fileName: string @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) diff --git a/database/entity/0003-login_server_tables/LoginEmailOptIn.ts b/database/entity/0003-login_server_tables/LoginEmailOptIn.ts index 60717d2c2..46f74e7de 100644 --- a/database/entity/0003-login_server_tables/LoginEmailOptIn.ts +++ b/database/entity/0003-login_server_tables/LoginEmailOptIn.ts @@ -6,21 +6,21 @@ export class LoginEmailOptIn extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ name: 'user_id' }) + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) userId: number @Column({ name: 'verification_code', type: 'bigint', unsigned: true, unique: true }) verificationCode: BigInt - @Column({ name: 'email_opt_in_type_id' }) + @Column({ name: 'email_opt_in_type_id', type: 'int', unsigned: true, nullable: false }) emailOptInTypeId: number - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP' }) + @Column({ name: 'created', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) createdAt: Date - @Column({ name: 'resend_count', default: 0 }) + @Column({ name: 'resend_count', type: 'int', unsigned: true, default: 0 }) resendCount: number - @Column({ name: 'updated', default: () => 'CURRENT_TIMESTAMP' }) + @Column({ name: 'updated', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) updatedAt: Date } diff --git a/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts b/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts index 45d82ad7c..18dbe7961 100644 --- a/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts +++ b/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts @@ -20,11 +20,12 @@ export class LoginElopageBuys extends BaseEntity { @Column({ type: 'int', width: 11, name: 'product_id', nullable: true, default: null }) productId: number | null - @Column({ name: 'product_price', nullable: false }) + @Column({ name: 'product_price', type: 'int', nullable: false }) productPrice: number @Column({ name: 'payer_email', + type: 'varchar', length: 255, nullable: false, charset: 'utf8', @@ -34,6 +35,7 @@ export class LoginElopageBuys extends BaseEntity { @Column({ name: 'publisher_email', + type: 'varchar', length: 255, nullable: false, charset: 'utf8', @@ -41,12 +43,12 @@ export class LoginElopageBuys extends BaseEntity { }) publisherEmail: string - @Column({ nullable: false }) + @Column({ type: 'bool', nullable: false }) payed: boolean - @Column({ name: 'success_date', nullable: false }) + @Column({ name: 'success_date', type: 'datetime', nullable: false }) successDate: Date - @Column({ length: 255, nullable: false }) + @Column({ type: 'varchar', length: 255, nullable: false }) event: string } diff --git a/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts b/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts index 585b42612..104d6e1bc 100644 --- a/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts +++ b/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts @@ -7,7 +7,7 @@ export class TransactionLink extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ unsigned: true, nullable: false }) + @Column({ type: 'bigint', unsigned: true, nullable: false }) userId: number @Column({ @@ -29,10 +29,10 @@ export class TransactionLink extends BaseEntity { }) holdAvailableAmount: Decimal - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string - @Column({ length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) code: string @Column({ diff --git a/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts b/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts index f2d0d1386..b56b5ac47 100644 --- a/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts +++ b/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts @@ -7,7 +7,7 @@ export class AdminPendingCreation extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ unsigned: true, nullable: false }) + @Column({ type: 'bigint', unsigned: true, nullable: false }) userId: number @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) @@ -16,7 +16,7 @@ export class AdminPendingCreation extends BaseEntity { @Column({ type: 'datetime', nullable: false }) date: Date - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string @Column({ diff --git a/database/entity/0036-unique_previous_in_transactions/Transaction.ts b/database/entity/0036-unique_previous_in_transactions/Transaction.ts index eef845330..efa376cbe 100644 --- a/database/entity/0036-unique_previous_in_transactions/Transaction.ts +++ b/database/entity/0036-unique_previous_in_transactions/Transaction.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-use-before-define */ import { Decimal } from 'decimal.js-light' import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' diff --git a/database/entity/0038-add_contribution_links_table/ContributionLink.ts b/database/entity/0038-add_contribution_links_table/ContributionLink.ts index f64b92208..479aff51a 100644 --- a/database/entity/0038-add_contribution_links_table/ContributionLink.ts +++ b/database/entity/0038-add_contribution_links_table/ContributionLink.ts @@ -7,10 +7,10 @@ export class ContributionLink extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) name: string - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string @Column({ name: 'valid_from', type: 'datetime', nullable: false }) @@ -28,10 +28,10 @@ export class ContributionLink extends BaseEntity { }) amount: Decimal - @Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) cycle: string - @Column({ name: 'max_per_cycle', unsigned: true, nullable: false, default: 1 }) + @Column({ name: 'max_per_cycle', type: 'int', unsigned: true, nullable: false, default: 1 }) maxPerCycle: number @Column({ @@ -77,10 +77,10 @@ export class ContributionLink extends BaseEntity { @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) createdAt: Date - @DeleteDateColumn({ name: 'deleted_at' }) + @DeleteDateColumn({ name: 'deleted_at', type: 'datetime' }) deletedAt: Date | null - @Column({ length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) code: string @Column({ name: 'link_enabled', type: 'boolean', default: true }) diff --git a/database/entity/0063-event_link_fields/Event.ts b/database/entity/0063-event_link_fields/Event.ts index d84adac1c..ce125b8df 100644 --- a/database/entity/0063-event_link_fields/Event.ts +++ b/database/entity/0063-event_link_fields/Event.ts @@ -21,7 +21,7 @@ export class Event extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) type: string @CreateDateColumn({ @@ -32,56 +32,61 @@ export class Event extends BaseEntity { }) createdAt: Date - @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) + @Column({ name: 'affected_user_id', type: 'bigint', unsigned: true, nullable: false }) affectedUserId: number @ManyToOne(() => User) @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) affectedUser: User - @Column({ name: 'acting_user_id', unsigned: true, nullable: false }) + @Column({ name: 'acting_user_id', type: 'bigint', unsigned: true, nullable: false }) actingUserId: number @ManyToOne(() => User) @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) actingUser: User - @Column({ name: 'involved_user_id', type: 'int', unsigned: true, nullable: true }) + @Column({ name: 'involved_user_id', type: 'bigint', unsigned: true, nullable: true }) involvedUserId: number | null @ManyToOne(() => User) @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) involvedUser: User | null - @Column({ name: 'involved_transaction_id', type: 'int', unsigned: true, nullable: true }) + @Column({ name: 'involved_transaction_id', type: 'bigint', unsigned: true, nullable: true }) involvedTransactionId: number | null @ManyToOne(() => Transaction) @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) involvedTransaction: Transaction | null - @Column({ name: 'involved_contribution_id', type: 'int', unsigned: true, nullable: true }) + @Column({ name: 'involved_contribution_id', type: 'bigint', unsigned: true, nullable: true }) involvedContributionId: number | null @ManyToOne(() => Contribution) @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) involvedContribution: Contribution | null - @Column({ name: 'involved_contribution_message_id', type: 'int', unsigned: true, nullable: true }) + @Column({ + name: 'involved_contribution_message_id', + type: 'bigint', + unsigned: true, + nullable: true, + }) involvedContributionMessageId: number | null @ManyToOne(() => ContributionMessage) @JoinColumn({ name: 'involved_contribution_message_id', referencedColumnName: 'id' }) involvedContributionMessage: ContributionMessage | null - @Column({ name: 'involved_transaction_link_id', type: 'int', unsigned: true, nullable: true }) + @Column({ name: 'involved_transaction_link_id', type: 'bigint', unsigned: true, nullable: true }) involvedTransactionLinkId: number | null @ManyToOne(() => TransactionLink) @JoinColumn({ name: 'involved_transaction_link_id', referencedColumnName: 'id' }) involvedTransactionLink: TransactionLink | null - @Column({ name: 'involved_contribution_link_id', type: 'int', unsigned: true, nullable: true }) + @Column({ name: 'involved_contribution_link_id', type: 'bigint', unsigned: true, nullable: true }) involvedContributionLinkId: number | null @ManyToOne(() => ContributionLink) diff --git a/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts b/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts index 905f17830..9c798f7c9 100644 --- a/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts +++ b/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-use-before-define */ import { Decimal } from 'decimal.js-light' import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' diff --git a/database/entity/0069-add_user_roles_table/UserRole.ts b/database/entity/0069-add_user_roles_table/UserRole.ts index 4d1e3f87d..536248da0 100644 --- a/database/entity/0069-add_user_roles_table/UserRole.ts +++ b/database/entity/0069-add_user_roles_table/UserRole.ts @@ -9,13 +9,18 @@ export class UserRole extends BaseEntity { @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) userId: number - @Column({ length: 40, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 40, nullable: false, collation: 'utf8mb4_unicode_ci' }) role: string - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) + @Column({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) createdAt: Date - @Column({ name: 'updated_at', nullable: true, default: null, type: 'datetime' }) + @Column({ name: 'updated_at', type: 'datetime', nullable: true, default: null }) updatedAt: Date | null @ManyToOne( diff --git a/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts b/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts index c2f28593a..afd9ba9a1 100644 --- a/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts +++ b/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts @@ -11,6 +11,7 @@ export class DltTransaction extends BaseEntity { @Column({ name: 'message_id', + type: 'varchar', length: 64, nullable: true, default: null, @@ -21,10 +22,15 @@ export class DltTransaction extends BaseEntity { @Column({ name: 'verified', type: 'bool', nullable: false, default: false }) verified: boolean - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) + @Column({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) createdAt: Date - @Column({ name: 'verified_at', nullable: true, default: null, type: 'datetime' }) + @Column({ name: 'verified_at', type: 'datetime', nullable: true, default: null }) verifiedAt: Date | null @OneToOne( diff --git a/database/entity/0070-add_dlt_transactions_table/Transaction.ts b/database/entity/0070-add_dlt_transactions_table/Transaction.ts index 4620ad231..23fcca475 100644 --- a/database/entity/0070-add_dlt_transactions_table/Transaction.ts +++ b/database/entity/0070-add_dlt_transactions_table/Transaction.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-use-before-define */ import { Decimal } from 'decimal.js-light' import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' diff --git a/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts b/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts index 65febfded..7c06b173b 100644 --- a/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts +++ b/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-use-before-define */ import { Decimal } from 'decimal.js-light' import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' @@ -7,13 +8,13 @@ export class PendingTransaction extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ name: 'state', unsigned: true, nullable: false }) + @Column({ name: 'state', type: 'int', unsigned: true, nullable: false }) state: number @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) previous: number | null - @Column({ name: 'type_id', unsigned: true, nullable: false }) + @Column({ name: 'type_id', type: 'int', unsigned: true, nullable: false }) typeId: number @Column({ @@ -68,13 +69,13 @@ export class PendingTransaction extends BaseEntity { }) decayStart: Date | null - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) creationDate: Date | null - @Column({ name: 'user_id', unsigned: true, nullable: false }) + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) userId: number @Column({ diff --git a/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts b/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts index f3e3b2281..18450ba21 100644 --- a/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts +++ b/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-use-before-define */ import { Decimal } from 'decimal.js-light' import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' @@ -12,7 +13,7 @@ export class Transaction extends BaseEntity { @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) previous: number | null - @Column({ name: 'type_id', unsigned: true, nullable: false }) + @Column({ name: 'type_id', type: 'int', unsigned: true, nullable: false }) typeId: number @Column({ @@ -67,13 +68,13 @@ export class Transaction extends BaseEntity { }) decayStart: Date | null - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) creationDate: Date | null - @Column({ name: 'user_id', unsigned: true, nullable: false }) + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) userId: number @Column({ diff --git a/database/entity/0078-move_resubmission_date/Contribution.ts b/database/entity/0078-move_resubmission_date/Contribution.ts index 6de8f74d7..3e134a653 100644 --- a/database/entity/0078-move_resubmission_date/Contribution.ts +++ b/database/entity/0078-move_resubmission_date/Contribution.ts @@ -20,7 +20,7 @@ export class Contribution extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ unsigned: true, nullable: false, name: 'user_id' }) + @Column({ type: 'bigint', unsigned: true, nullable: false, name: 'user_id' }) userId: number @ManyToOne( @@ -39,7 +39,7 @@ export class Contribution extends BaseEntity { @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) contributionDate: Date - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) memo: string @Column({ @@ -51,26 +51,27 @@ export class Contribution extends BaseEntity { }) amount: Decimal - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'moderator_id' }) moderatorId: number - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'contribution_link_id' }) contributionLinkId: number - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'confirmed_by' }) confirmedBy: number - @Column({ nullable: true, name: 'confirmed_at' }) + @Column({ type: 'datetime', nullable: true, name: 'confirmed_at' }) confirmedAt: Date - @Column({ unsigned: true, nullable: true, name: 'denied_by' }) + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'denied_by' }) deniedBy: number - @Column({ nullable: true, name: 'denied_at' }) + @Column({ type: 'datetime', nullable: true, name: 'denied_at' }) deniedAt: Date @Column({ name: 'contribution_type', + type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci', @@ -79,25 +80,26 @@ export class Contribution extends BaseEntity { @Column({ name: 'contribution_status', + type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci', }) contributionStatus: string - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'transaction_id' }) transactionId: number - @Column({ nullable: true, name: 'updated_at' }) + @Column({ type: 'datetime', nullable: true, name: 'updated_at' }) updatedAt: Date - @Column({ nullable: true, unsigned: true, name: 'updated_by', type: 'int' }) + @Column({ type: 'bigint', nullable: true, unsigned: true, name: 'updated_by' }) updatedBy: number | null - @DeleteDateColumn({ name: 'deleted_at' }) + @DeleteDateColumn({ type: 'datetime', name: 'deleted_at' }) deletedAt: Date | null - @DeleteDateColumn({ unsigned: true, nullable: true, name: 'deleted_by' }) + @DeleteDateColumn({ type: 'bigint', unsigned: true, nullable: true, name: 'deleted_by' }) deletedBy: number @OneToMany( diff --git a/database/entity/0078-move_resubmission_date/ContributionMessage.ts b/database/entity/0078-move_resubmission_date/ContributionMessage.ts index 1c5e89f92..adf60d437 100644 --- a/database/entity/0078-move_resubmission_date/ContributionMessage.ts +++ b/database/entity/0078-move_resubmission_date/ContributionMessage.ts @@ -21,7 +21,7 @@ export class ContributionMessage extends BaseEntity { id: number @Index() - @Column({ name: 'contribution_id', unsigned: true, nullable: false }) + @Column({ name: 'contribution_id', type: 'bigint', unsigned: true, nullable: false }) contributionId: number @ManyToOne( @@ -31,7 +31,7 @@ export class ContributionMessage extends BaseEntity { @JoinColumn({ name: 'contribution_id' }) contribution: Contribution - @Column({ name: 'user_id', unsigned: true, nullable: false }) + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) userId: number @ManyToOne( @@ -41,7 +41,7 @@ export class ContributionMessage extends BaseEntity { @JoinColumn({ name: 'user_id' }) user: User - @Column({ length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) message: string @CreateDateColumn() @@ -55,10 +55,10 @@ export class ContributionMessage extends BaseEntity { @DeleteDateColumn({ name: 'deleted_at' }) deletedAt: Date | null - @Column({ name: 'deleted_by', default: null, unsigned: true, nullable: true }) + @Column({ name: 'deleted_by', type: 'bigint', default: null, unsigned: true, nullable: true }) deletedBy: number - @Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) type: string @Column({ name: 'is_moderator', type: 'bool', nullable: false, default: false }) diff --git a/database/entity/0082-introduce_gms_registration/UserContact.ts b/database/entity/0082-introduce_gms_registration/UserContact.ts index 740d6e6c9..eabcf89eb 100644 --- a/database/entity/0082-introduce_gms_registration/UserContact.ts +++ b/database/entity/0082-introduce_gms_registration/UserContact.ts @@ -17,6 +17,7 @@ export class UserContact extends BaseEntity { @Column({ name: 'type', + type: 'varchar', length: 100, nullable: true, default: null, @@ -33,7 +34,13 @@ export class UserContact extends BaseEntity { @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) userId: number - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) + @Column({ + type: 'varchar', + length: 255, + unique: true, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) email: string @Column({ name: 'gms_publish_email', type: 'bool', nullable: false, default: false }) @@ -42,10 +49,22 @@ export class UserContact extends BaseEntity { @Column({ name: 'email_verification_code', type: 'bigint', unsigned: true, unique: true }) emailVerificationCode: string - @Column({ name: 'email_opt_in_type_id' }) + @Column({ + name: 'email_opt_in_type_id', + type: 'int', + unsigned: true, + nullable: false, + default: 0, + }) emailOptInTypeId: number - @Column({ name: 'email_resend_count' }) + @Column({ + name: 'email_resend_count', + type: 'int', + unsigned: true, + nullable: false, + default: 0, + }) emailResendCount: number @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) @@ -53,6 +72,7 @@ export class UserContact extends BaseEntity { @Column({ name: 'country_code', + type: 'varchar', length: 255, unique: false, nullable: true, @@ -60,13 +80,23 @@ export class UserContact extends BaseEntity { }) countryCode: string - @Column({ length: 255, unique: false, nullable: true, collation: 'utf8mb4_unicode_ci' }) + @Column({ + type: 'varchar', + length: 255, + unique: false, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) phone: string @Column({ name: 'gms_publish_phone', type: 'int', unsigned: true, nullable: false, default: 0 }) gmsPublishPhone: number - @CreateDateColumn({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) + @CreateDateColumn({ + name: 'created_at', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) createdAt: Date @UpdateDateColumn({ diff --git a/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts b/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts index 1f077bd5f..b0edfca91 100644 --- a/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts +++ b/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts @@ -21,10 +21,10 @@ export class FederatedCommunity extends BaseEntity { @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) publicKey: Buffer - @Column({ name: 'api_version', length: 10, nullable: false }) + @Column({ name: 'api_version', type: 'varchar', length: 10, nullable: false }) apiVersion: string - @Column({ name: 'end_point', length: 255, nullable: false }) + @Column({ name: 'end_point', type: 'varchar', length: 255, nullable: false }) endPoint: string @Column({ name: 'last_announced_at', type: 'datetime', nullable: true }) diff --git a/database/entity/0084-introduce_humhub_registration/User.ts b/database/entity/0084-introduce_humhub_registration/User.ts index d192d3805..c12a7dcfd 100644 --- a/database/entity/0084-introduce_humhub_registration/User.ts +++ b/database/entity/0084-introduce_humhub_registration/User.ts @@ -27,6 +27,7 @@ export class User extends BaseEntity { @Column({ name: 'gradido_id', + type: 'char', length: 36, nullable: false, collation: 'utf8mb4_unicode_ci', @@ -51,6 +52,7 @@ export class User extends BaseEntity { @Column({ name: 'alias', + type: 'varchar', length: 20, nullable: true, default: null, @@ -70,6 +72,7 @@ export class User extends BaseEntity { @Column({ name: 'first_name', + type: 'varchar', length: 255, nullable: true, default: null, @@ -79,6 +82,7 @@ export class User extends BaseEntity { @Column({ name: 'last_name', + type: 'varchar', length: 255, nullable: true, default: null, @@ -92,10 +96,15 @@ export class User extends BaseEntity { @Column({ name: 'humhub_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) humhubPublishName: number - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) + @Column({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) createdAt: Date - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) + @DeleteDateColumn({ name: 'deleted_at', type: 'datetime', nullable: true }) deletedAt: Date | null @Column({ type: 'bigint', default: 0, unsigned: true }) @@ -110,7 +119,13 @@ export class User extends BaseEntity { }) passwordEncryptionType: number - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) + @Column({ + type: 'varchar', + length: 4, + default: 'de', + collation: 'utf8mb4_unicode_ci', + nullable: false, + }) language: string @Column({ type: 'bool', default: false }) @@ -126,19 +141,19 @@ export class User extends BaseEntity { @JoinColumn({ name: 'user_id' }) userRoles: UserRole[] - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) + @Column({ name: 'referrer_id', type: 'bigint', unsigned: true, nullable: true, default: null }) referrerId?: number | null @Column({ name: 'contribution_link_id', - type: 'int', + type: 'bigint', unsigned: true, nullable: true, default: null, }) contributionLinkId?: number | null - @Column({ name: 'publisher_id', default: 0 }) + @Column({ name: 'publisher_id', type: 'bigint', unsigned: true, default: 0 }) publisherId: number @Column({ name: 'gms_allowed', type: 'bool', default: true }) diff --git a/database/entity/0086-add_community_location/Community.ts b/database/entity/0086-add_community_location/Community.ts index 374ea6a99..8c3a5c229 100644 --- a/database/entity/0086-add_community_location/Community.ts +++ b/database/entity/0086-add_community_location/Community.ts @@ -21,7 +21,7 @@ export class Community extends BaseEntity { @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) foreign: boolean - @Column({ name: 'url', length: 255, nullable: false }) + @Column({ name: 'url', type: 'varchar', length: 255, nullable: false }) url: string @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) diff --git a/database/entity/index.ts b/database/entity/index.ts index fa7063a8e..71329b6ee 100644 --- a/database/entity/index.ts +++ b/database/entity/index.ts @@ -1,5 +1,4 @@ import { latestDbVersion } from '../src/config/detectLastDBVersion' -import { PendingTransaction } from './0071-add-pending_transactions-table/PendingTransaction' import { Community } from './Community' import { Contribution } from './Contribution' import { ContributionLink } from './ContributionLink' @@ -11,6 +10,7 @@ import { LoginElopageBuys } from './LoginElopageBuys' import { LoginEmailOptIn } from './LoginEmailOptIn' import { Migration } from './Migration' import { OpenaiThreads } from './OpenaiThreads' +import { PendingTransaction } from './PendingTransaction' import { ProjectBranding } from './ProjectBranding' import { Transaction } from './Transaction' import { TransactionLink } from './TransactionLink'