modify column to datetime(3)

This commit is contained in:
Ulf Gebhardt 2023-03-07 12:16:17 +01:00
parent 1eb0cb92eb
commit cbc7a0557d
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 8 additions and 1 deletions

View File

@ -25,7 +25,7 @@ export class Event extends BaseEntity {
@CreateDateColumn({
name: 'created_at',
type: 'datetime',
default: () => 'CURRENT_TIMESTAMP()',
default: () => 'CURRENT_TIMESTAMP(3)',
nullable: false,
})
createdAt: Date

View File

@ -57,9 +57,16 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
await queryFn(
'UPDATE `events` SET acting_user_id=involved_user_id WHERE `type` = "TRANSACTION_RECEIVE";',
)
await queryFn(
'ALTER TABLE `events` MODIFY COLUMN `created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3);',
)
}
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
await queryFn(
'ALTER TABLE `events` MODIFY COLUMN `created_at` datetime() NOT NULL DEFAULT CURRENT_TIMESTAMP();',
)
await queryFn(
'UPDATE `events` SET involved_user_id=acting_user_id WHERE `type` = "ADMIN_CONTRIBUTION_DENY";',
)