4import { INFERENCE_CALLS_TABLE, USAGE_TABLE } from "./schema.tsx";
5
6// Eventually we'll have a user database,
7// but in the meantime, we can cache user info in memory
8const userIdCache: { [key: string]: any } = {};
198```
199โโโ backend/
200โ โโโ database/
201โ โ โโโ migrations.ts # Schema definitions
202โ โ โโโ queries.ts # DB query functions
257 ```
258
259### Database Patterns
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
197 <div className="space-y-6">
198 <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border dark:border-gray-700 p-6">
199 <h2 className="text-2xl font-bold text-gray-900 dark:text-white mb-6">SQLite Database</h2>
200
201 {/* Tables sidebar */}
14 { name: "Vals", path: "/vals", icon: "โก", description: "Manage your functions" },
15 { name: "Blobs", path: "/blobs", icon: "๐ฆ", description: "File storage" },
16 { name: "SQLite", path: "/sqlite", icon: "๐๏ธ", description: "Database management" },
17 { name: "Emails", path: "/emails", icon: "๐ง", description: "Email functionality" },
18 { name: "Profile", path: "/profile", icon: "๐ค", description: "User profile" },
125 <h3 className="font-semibold text-gray-900 dark:text-white mb-2">SQLite</h3>
126 <p className="text-sm text-gray-600 dark:text-gray-400">
127 Query and manage your databases
128 </p>
129 </div>
130 </p>
131 <p className="text-sm text-gray-600 dark:text-gray-400">
132 Manage blobs, emails, profiles, SQLite databases, and vals from one place
133 </p>
134 </div>
1# Val Town Dashboard
2
3A dashboard application for managing Val Town resources including blobs, emails, profiles, SQLite databases, and vals.
4
5## Project Structure
36- **Email Management**: Handle Val Town email functionality
37- **Profile Management**: Manage Val Town user profiles
38- **SQLite Management**: Interact with Val Town SQLite databases
39- **Vals Management**: Manage Val Town vals (functions)
40- **Settings**: User authentication and preferences
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { castVote, getVoteResults, hasUserVoted, getUserVote } from "../database/queries.ts";
3import { CANDIDATES } from "../../shared/types.ts";
4
22 )`);
23
24 console.log('Database migrations completed');
25}
26
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import { getVoteResults, getChatMessages } from "./database/queries.ts";
5import votes from "./routes/votes.ts";
6import chat from "./routes/chat.ts";
13});
14
15// Initialize database on startup
16await runMigrations();
17