fix: switch timestamp to include timezone

This commit is contained in:
dr-carrot
2024-05-29 18:04:35 -04:00
parent caaed7c8b8
commit 94a9806089
2 changed files with 4 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ import type { DownloadingItem } from '@server/lib/downloadtracker';
import downloadTracker from '@server/lib/downloadtracker';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { DbAwareColumn } from '@server/utils/DbColumnHelper';
import {
AfterLoad,
Column,
@@ -121,10 +122,10 @@ class Media {
@UpdateDateColumn()
public updatedAt: Date;
@Column({ type: 'timestamp without time zone', default: () => 'now()' })
@DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
public lastSeasonChange: Date;
@Column({ type: 'timestamp without time zone', default: () => 'now()' })
@DbAwareColumn({ type: 'datetime', nullable: true })
public mediaAddedAt: Date;
@Column({ nullable: true, type: 'int' })

View File

@@ -1,9 +1,8 @@
import { isPgsql } from '@server/datasource';
import type { ColumnOptions, ColumnType } from 'typeorm';
import { Column } from 'typeorm';
// TODO cleanup this file
const pgTypeMapping: { [key: string]: ColumnType } = {
datetime: 'timestamp without time zone',
datetime: 'timestamp with time zone',
};
export function resolveDbType(pgType: ColumnType): ColumnType {