feat: implement product grid data fetching with schema self-healing and add a database verification script.

This commit is contained in:
Michael committed 2026-03-10 13:53:33 +01:00
1 parent 08d361e980
commit 1b09994087
5 files changed
+133 -1

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { db } from "@/db";
import { ventesProduits } from "@/db/schema";
import { sql } from "drizzle-orm";
async function main() {
console.log("--- DB DIAGNOSIS Start ---");
try {
const results = await db.execute(sql`
SELECT
code_fournisseur,
nom_fournisseur,
COUNT(*) as total_rows,
COUNT(DISTINCT codein) as distinct_products
FROM ventes_produits
GROUP BY code_fournisseur, nom_fournisseur
ORDER BY total_rows DESC
`);
console.table(results.rows);
} catch (error) {
console.error("Diagnosis failed:", error);
}
console.log("--- DB DIAGNOSIS End ---");
}
main();