mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: implement product grid data fetching with schema self-healing and add a database verification script.
This commit is contained in:
1 parent
08d361e980
commit
1b09994087
5 files changed
+133
-1
No files matched your search
@@ -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();
|
||||
Reference in new issue
Block a user