Skip to content

Commit

Permalink
Add created_at, updated_at columns
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jul 8, 2024
1 parent 6766dd7 commit de6a349
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plextraktsync/db/models/SyncRecord.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
from __future__ import annotations

from datetime import datetime
from typing import Optional

from sqlmodel import Field, SQLModel
from sqlmodel import Field, SQLModel, Column, DateTime, func, text


class SyncRecord(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
media_type: str
trakt_id: int
created_at: datetime = Field(
sa_column_kwargs={
"server_default": text("CURRENT_TIMESTAMP"),
}
)
updated_at: Optional[datetime] = Field(
sa_column=Column(DateTime(), onupdate=func.now())
)
plex_timestamp_watched: str
seen_on_plex_sync: str
trakt_timestamp_watched: str
Expand Down

0 comments on commit de6a349

Please sign in to comment.