add code column to model and entity

This commit is contained in:
Moriz Wahl 2022-03-09 12:02:10 +01:00
parent 19084d7514
commit eb5b19e6d6
3 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,9 @@ export class TransactionLink {
@Field(() => String) @Field(() => String)
memo: string memo: string
@Field(() => String)
code: string
@Field(() => Date) @Field(() => Date)
createdAt: Date createdAt: Date

View File

@ -3,7 +3,7 @@ import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
@Entity('transaction_links') @Entity('transaction_links')
export class Transaction extends BaseEntity { export class TransactionLink extends BaseEntity {
@PrimaryGeneratedColumn('increment', { unsigned: true }) @PrimaryGeneratedColumn('increment', { unsigned: true })
id: number id: number
@ -22,6 +22,9 @@ export class Transaction extends BaseEntity {
@Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' })
memo: string memo: string
@Column({ length: 96, nullable: false, collation: 'utf8mb4_unicode_ci' })
code: string
@Column({ @Column({
type: 'datetime', type: 'datetime',
default: () => 'CURRENT_TIMESTAMP', default: () => 'CURRENT_TIMESTAMP',

View File

@ -10,6 +10,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
\`userId\` int UNSIGNED NOT NULL, \`userId\` int UNSIGNED NOT NULL,
\`amount\` DECIMAL(40,20) NOT NULL, \`amount\` DECIMAL(40,20) NOT NULL,
\`memo\` varchar(255) NOT NULL, \`memo\` varchar(255) NOT NULL,
\`code\` varchar(96) NOT NULL,
\`createdAt\` datetime NOT NULL, \`createdAt\` datetime NOT NULL,
\`validUntil\` datetime NOT NULL, \`validUntil\` datetime NOT NULL,
\`showEmail\` boolean NOT NULL DEFAULT false, \`showEmail\` boolean NOT NULL DEFAULT false,