diff --git a/migrations/0045-fix-discord-gcal-field.ts b/migrations/0045-fix-discord-gcal-field.ts new file mode 100644 index 00000000..5cb62f6d --- /dev/null +++ b/migrations/0045-fix-discord-gcal-field.ts @@ -0,0 +1,12 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class FixDiscordGcalField1714770061929 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query('ALTER TABLE "Events" ALTER COLUMN "discordEvent" TYPE varchar'); + await queryRunner.query('ALTER TABLE "Events" ALTER COLUMN "googleCalendarEvent" TYPE varchar'); + } + + public async down(queryRunner: QueryRunner): Promise { + // nothing here because it's fixing an earlier migration (# 0044) + } +} diff --git a/models/EventModel.ts b/models/EventModel.ts index 0fae36f5..256fa443 100644 --- a/models/EventModel.ts +++ b/models/EventModel.ts @@ -67,10 +67,10 @@ export class EventModel extends BaseEntity { @OneToMany((type) => ExpressCheckinModel, (expressCheckin) => expressCheckin.event, { cascade: true }) expressCheckins: ExpressCheckinModel[]; - @Column('uuid', { nullable: true }) + @Column('varchar', { nullable: true }) discordEvent: Uuid; - @Column('uuid', { nullable: true }) + @Column('varchar', { nullable: true }) googleCalendarEvent: Uuid; public getPublicEvent(canSeeAttendanceCode = false): PublicEvent { diff --git a/tests/data/EventFactory.ts b/tests/data/EventFactory.ts index cefd6d14..bf6a9d38 100644 --- a/tests/data/EventFactory.ts +++ b/tests/data/EventFactory.ts @@ -41,8 +41,8 @@ export class EventFactory { deleted: false, eventLink: faker.internet.url(), thumbnail: FactoryUtils.getRandomImageUrl(), - discordEvent: uuid(), - googleCalendarEvent: uuid(), + discordEvent: faker.datatype.hexaDecimal(10), + googleCalendarEvent: faker.datatype.hexaDecimal(10), }); return EventModel.merge(fake, substitute); }