mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 04:08:45 -05:00
fix(entity): use TIMESTAMPTZ in Postgres and sort issue comments oldest-first (#1654)
* fix(entity): use TIMESTAMPTZ in Postgres and sort issue comments oldest-first Switch key datetime columns to TIMESTAMPTZ for proper UTC handling (“just now”) and sort issue comments on load so the original description stays first and in proper sorted order in fix-pgsql-timezone fixes #1569, fixes #1568 * refactor(migration): manually rewrite pgsql migration to preserve existing data Typeorm generated migration was dropping the entire column thus leading to data loss so this is an attempt at manually rewriting the migration to preserve the data * refactor(migrations): rename to be consistent with other migration files * fix: use id to order instead of createdAt to avoid non-existant createdAt --------- Co-authored-by: Gauthier <mail@gauthierth.fr>
This commit is contained in:
@@ -5,15 +5,14 @@ import Media from '@server/entity/Media';
|
||||
import { User } from '@server/entity/User';
|
||||
import type { WatchlistItem } from '@server/interfaces/api/discoverInterfaces';
|
||||
import logger from '@server/logger';
|
||||
import { DbAwareColumn } from '@server/utils/DbColumnHelper';
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import type { ZodNumber, ZodOptional, ZodString } from 'zod';
|
||||
|
||||
@@ -56,10 +55,14 @@ export class Watchlist implements WatchlistItem {
|
||||
})
|
||||
public media: Media;
|
||||
|
||||
@CreateDateColumn()
|
||||
@DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
|
||||
public createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
@DbAwareColumn({
|
||||
type: 'datetime',
|
||||
default: () => 'CURRENT_TIMESTAMP',
|
||||
onUpdate: 'CURRENT_TIMESTAMP',
|
||||
})
|
||||
public updatedAt: Date;
|
||||
|
||||
constructor(init?: Partial<Watchlist>) {
|
||||
|
||||
Reference in New Issue
Block a user