diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts index e47d078a2..d43c9787b 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts @@ -95,8 +95,8 @@ export class Channel extends BaseClass { @ManyToOne(() => User) owner: User; - @Column({ nullable: true }) - last_pin_timestamp?: number; + @Column({ nullable: true, type: "timestamp with time zone" }) + last_pin_timestamp?: Date | null; // ISO8601 @Column({ nullable: true }) default_auto_archive_duration?: number; diff --git a/src/util/migration/postgres/1771997061671-LastPinTimestampAsDate.ts b/src/util/migration/postgres/1771997061671-LastPinTimestampAsDate.ts new file mode 100644 index 000000000..a5aaf4749 --- /dev/null +++ b/src/util/migration/postgres/1771997061671-LastPinTimestampAsDate.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class LastPinTimestampAsDate1771997061671 implements MigrationInterface { + name = "LastPinTimestampAsDate1771997061671"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "last_pin_timestamp"`); + await queryRunner.query(`ALTER TABLE "channels" ADD "last_pin_timestamp" TIMESTAMP WITH TIME ZONE`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "last_pin_timestamp"`); + await queryRunner.query(`ALTER TABLE "channels" ADD "last_pin_timestamp" integer`); + } +}