source: database/drizzle/util/reports.ts@ c586cbd

main
Last change on this file since c586cbd was b348db4, checked in by Tome <gjorgievtome@…>, 5 months ago

Add stored functions and triggers

  • Property mode set to 100644
File size: 1.3 KB
Line 
1import 'dotenv/config';
2import { db } from '../db';
3import { sql } from 'drizzle-orm';
4
5async function main() {
6 console.log("Generating Reports . . .");
7
8 try {
9 const r1 = await db.execute(sql`SELECT * FROM get_report_top_components()`);
10 console.log('--- Top Performing Components ---');
11 console.table(r1.rows);
12
13 const r2 = await db.execute(sql`SELECT * FROM get_report_user_leaderboard()`);
14 console.log('--- User Reputation Leaderboard ---');
15 console.table(r2.rows);
16
17 const r3 = await db.execute(sql`SELECT * FROM get_report_price_performance()`);
18 console.log('--- Price-to-Performance Analysis ---');
19 console.table(r3.rows);
20
21 const r4 = await db.execute(sql`SELECT * FROM get_report_budget_tier()`);
22 console.log('--- Budget Tier Popularity ---');
23 console.table(r4.rows);
24
25 const r5 = await db.execute(sql`SELECT * FROM get_report_compatibility()`);
26 console.log('--- Component Compatibility ---');
27 console.table(r5.rows);
28
29 const r6 = await db.execute(sql`SELECT * FROM get_report_storage_optimization()`);
30 console.log('--- Storage Optimization ---');
31 console.table(r6.rows);
32
33 process.exit(0);
34 } catch (e) {
35 console.error(e);
36 process.exit(1);
37 }
38}
39
40main();
Note: See TracBrowser for help on using the repository browser.