diff --git a/drizzle/schema.ts b/drizzle/schema.ts index 6dfa3d4..b48f9b0 100644 --- a/drizzle/schema.ts +++ b/drizzle/schema.ts @@ -66,8 +66,8 @@ export const veilleItems = mysqlTable("veille_items", { categorie: varchar("categorie", { length: 128 }), niveau: varchar("niveau", { length: 128 }), territoire: varchar("territoire", { length: 255 }), - // Liste JSON des territoires (multi-département) ex: ["Isère","Savoie"] - territoires: json("territoires").$type(), + // Liste JSON des territoires (multi-département) ex: ["Isère","Savoie"] — stocké en text pour compatibilité Drizzle/MySQL + territoires: text("territoires"), resume: text("resume"), source: varchar("source", { length: 512 }), passage: text("passage"), @@ -91,8 +91,8 @@ export const aapItems = mysqlTable("aap_items", { categorie: mysqlEnum("categorie", ["Handicap", "PA", "Enfance", "Précarité", "Sanitaire", "Autre"]).notNull(), region: varchar("region", { length: 255 }), departement: varchar("departement", { length: 255 }), - // Liste JSON des départements (multi-département) ex: ["Isère (38)","Savoie (73)"] - departements: json("departements").$type(), + // Liste JSON des départements (multi-département) ex: ["Isère (38)","Savoie (73)"] — stocké en text pour compatibilité Drizzle/MySQL + departements: text("departements"), dateCloture: timestamp("dateCloture"), datePublication: timestamp("datePublication"), lien: text("lien"), diff --git a/server/rssEngine.ts b/server/rssEngine.ts index baa86a2..6940b5e 100644 --- a/server/rssEngine.ts +++ b/server/rssEngine.ts @@ -364,7 +364,7 @@ async function processFeed(feed: RssFeed): Promise { categorie, niveau, territoire, - territoires: (territoire !== "France" && territoire !== "Auvergne-Rhône-Alpes" ? [territoire] : []) as any, + territoires: JSON.stringify(territoire !== "France" && territoire !== "Auvergne-Rhône-Alpes" ? [territoire] : []), resume: description || null, source: feed.name, lien: link || null, @@ -409,7 +409,7 @@ async function processFeed(feed: RssFeed): Promise { categorie, region, departement, - departements: (departement ? [departement] : []) as any, + departements: JSON.stringify(departement ? [departement] : []), lien: link || null, datePublication: pubDate, }); @@ -508,7 +508,7 @@ export async function migrateExistingItems(): Promise { categorie: newCategorie, niveau: newNiveau, territoire: newTerritoire, - territoires: (newTerritoire !== "France" && newTerritoire !== "Auvergne-Rhône-Alpes" ? [newTerritoire] : []) as any, + territoires: JSON.stringify(newTerritoire !== "France" && newTerritoire !== "Auvergne-Rhône-Alpes" ? [newTerritoire] : []), titre: row.titre, dedupKey: newDedupKey, }) @@ -541,7 +541,7 @@ export async function migrateExistingItems(): Promise { categorie: newCategorie, niveau: allTerritoires.length > 1 ? "departemental" : "regional", territoire: allTerritoires.length > 0 ? allTerritoires[0] : "Auvergne-Rhône-Alpes", - territoires: allTerritoires as any, + territoires: JSON.stringify(allTerritoires), titre: primary.titre, dedupKey: newDedupKey, }) @@ -579,7 +579,7 @@ export async function migrateExistingItems(): Promise { .set({ region: newRegion, departement: newDept, - departements: (newDept ? [newDept] : []) as any, + departements: JSON.stringify(newDept ? [newDept] : []), titre: row.titre, dedupKey: newDedupKey, }) @@ -606,7 +606,7 @@ export async function migrateExistingItems(): Promise { .set({ region: "Auvergne-Rhône-Alpes", departement: allDepts.length > 0 ? allDepts[0] : null, - departements: allDepts as any, + departements: JSON.stringify(allDepts), titre: primary.titre, dedupKey: newDedupKey, })