feat(astuce): ajout colonnes categorie/tags/mois + migration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,11 @@ EXPECTED_COLUMNS: dict[str, list[tuple[str, str, str | None]]] = {
|
||||
("identified_confidence", "REAL", None),
|
||||
("identified_source", "TEXT", None),
|
||||
],
|
||||
"astuce": [
|
||||
("categorie", "TEXT", None),
|
||||
("tags", "TEXT", None),
|
||||
("mois", "TEXT", None),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
|
||||
19
backend/app/models/astuce.py
Normal file
19
backend/app/models/astuce.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class Astuce(SQLModel, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
# Anciens champs conservés (colonnes existantes en DB)
|
||||
entity_type: Optional[str] = None
|
||||
entity_id: Optional[int] = None
|
||||
source: Optional[str] = None
|
||||
# Champs principaux
|
||||
titre: str
|
||||
contenu: str
|
||||
# Nouveaux champs bibliothèque
|
||||
categorie: Optional[str] = None # "plante"|"jardin"|"tache"|"general"|"ravageur"|"maladie"
|
||||
tags: Optional[str] = None # JSON array string: '["tomate","semis"]'
|
||||
mois: Optional[str] = None # JSON array string: '[3,4,5]' ou null = toute l'année
|
||||
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
||||
Reference in New Issue
Block a user