262
263/**
264 * Store a message in the database
265 */
266async function storeMessage(userId, userName, text, direction) {
7}
8
9// Query the Maine bill database
10export function search(term: string): Promise<SearchResult[]> {
11 return fetchText(getSearchURL(term)).then((res) => {
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
4 */
5
6// Database exports
7export * from "./db/schema.ts";
8export * from "./db/init.ts";
34export { default as debugClient } from "./test/debug-client.http.ts";
35
36// Initialize database and run migrations on startup
37import { runMigrations } from "./db/migrations.ts";
38
40runMigrations().then(result => {
41 if (result.success) {
42 console.log("Database initialized and migrated successfully");
43 } else {
44 console.error("Database initialization or migration failed:", result.error);
45 }
46});
1/**
2 * Database query functions for productpanel
3 * Provides typed functions for database operations
4 */
5
36
37/**
38 * Create a new app in the database
39 */
40export async function createApp(app: Omit<App, 'id' | 'created_at'>): Promise<App> {
1/**
2 * Fix Apps Data Structure
3 * Repairs any apps with incorrect data structure in the database
4 */
5
122 };
123
124 // Update the app in the database
125 await sqlite.execute({
126 sql: `UPDATE apps SET
222 };
223
224 // Update the feedback in the database
225 await sqlite.execute({
226 sql: `UPDATE feedback SET
109 const feedback = generateRandomFeedback(appId);
110
111 // Insert feedback into database with named parameters
112 // No need to specify ID as it's auto-incremented
113 await sqlite.execute({
49- All test data can be easily identified by the "[TEST]" prefix
50- The cleanup function removes only data with the test prefix
51- Test data is entirely contained within Val Town's SQLite database
52
74 <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4">
75 <p class="text-yellow-700">
76 <strong>Note:</strong> These actions directly affect the database. Use with caution.
77 </p>
78 </div>
5import { runMigrations } from "../db/migrations.ts";
6
7// Step 1: Initialize the database
8console.log("Initializing database...");
9const migrationResult = await runMigrations();
10if (!migrationResult.success) {
11 console.error("Database migration failed:", migrationResult.error);
12 Deno.exit(1);
13}
14console.log("Database initialized successfully");
15
16// Step 2: Create test data