Skip to content

Commit bde6b73

Browse files
committed
fix(seed): only stamp models that have the timestamp fields
Brand and DiscreteGPU have no created_at/updated_at, so assigning them raised ValueError on every brand insert. Refs #1
1 parent ed8fb60 commit bde6b73

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎app/seed.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def _with_id(obj: Any, taken: set[int]) -> Any:
124124
def _stamp(obj: Any, path: str | None, stamps: dict[str, tuple[datetime, datetime]]) -> Any:
125125
"""Replace the seed-time timestamps with the record's git history."""
126126
times = stamps.get(path or "")
127-
if times:
127+
# brand and gpu carry no timestamps at all — skip rather than invent fields.
128+
if times and hasattr(obj, "created_at"):
128129
obj.created_at, obj.updated_at = times
129130
return obj
130131

0 commit comments

Comments
 (0)