add type definitions, make code required (not null)

This commit is contained in:
Moriz Wahl 2022-06-13 12:23:57 +02:00
parent 83c8f9731e
commit 795d339398
2 changed files with 6 additions and 4 deletions

View File

@ -47,6 +47,7 @@ export class ContributionLink extends BaseEntity {
@Column({ @Column({
name: 'total_max_count_of_contribution', name: 'total_max_count_of_contribution',
type: 'int',
unsigned: true, unsigned: true,
nullable: true, nullable: true,
default: null, default: null,
@ -66,6 +67,7 @@ export class ContributionLink extends BaseEntity {
@Column({ @Column({
name: 'min_gap_hours', name: 'min_gap_hours',
type: 'int',
unsigned: true, unsigned: true,
nullable: true, nullable: true,
default: null, default: null,
@ -75,11 +77,11 @@ export class ContributionLink extends BaseEntity {
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
createdAt: Date createdAt: Date
@DeleteDateColumn() @DeleteDateColumn({ name: 'deleted_at' })
deletedAt: Date | null deletedAt: Date | null
@Column({ length: 24, nullable: true, collation: 'utf8mb4_unicode_ci' }) @Column({ length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' })
code: string | null code: string
@Column({ name: 'link_enabled', type: 'boolean', default: true }) @Column({ name: 'link_enabled', type: 'boolean', default: true })
linkEnabled: boolean linkEnabled: boolean

View File

@ -23,7 +23,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
\`min_gap_hours\` int(10) unsigned NULL DEFAULT NULL, \`min_gap_hours\` int(10) unsigned NULL DEFAULT NULL,
\`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, \`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
\`deleted_at\` datetime NULL DEFAULT NULL, \`deleted_at\` datetime NULL DEFAULT NULL,
\`code\` varchar(24) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, \`code\` varchar(24) COLLATE utf8mb4_unicode_ci NOT NULL,
\`link_enabled\` tinyint(4) NOT NULL DEFAULT '1', \`link_enabled\` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (\`id\`) PRIMARY KEY (\`id\`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`)