sqliteExplorerAppREADME.md1 match
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
1# Uptime Checker & Status Page
23This is a free, hackable uptime/downtime monitor that sends you an email when the site doesn't return a 200. It also stores historical uptime and latency data in your Val Town SQLite, which is used to power a status page. It supports multiple URLs in the same database and status page.
45## Installation
getValsContextWindowmain.tsx1 match
116{
117name: "Use Val Town SQLite to store data",
118prompt: "Write a val that uses an SQLite database",
119code: `import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
120
sqliteExplorerAppREADME.md1 match
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
databaseRunnermain.tsx20 matches
6import pg from "npm:pg";
78type DatabaseType = "postgres" | "mysql" | "duckdb";
910interface QueryRequest {
11databaseType: DatabaseType;
12url?: string;
13query?: string;
33}
3435const { databaseType, url, query, introspect, gzip = false } = requestBody;
36console.log(`Database type: ${databaseType}`);
37console.log(`Query: ${query}`);
38console.log(`Introspect: ${introspect}`);
39console.log(`Gzip: ${gzip}`);
4041if (!databaseType) {
42console.error("Missing database type");
43return new Response("databaseType is required", { status: 400 });
44}
4549}
5051if (databaseType !== "duckdb" && !url) {
52console.error("Missing URL for non-DuckDB query");
53return new Response("URL is required for postgres and mysql", { status: 400 });
57try {
58if (introspect) {
59console.log(`Introspecting ${databaseType} schema`);
60if (databaseType === "postgres") {
61results = await introspectPostgresSchema(url!);
62} else if (databaseType === "mysql") {
63results = await introspectMysqlSchema(url!);
64} else {
65console.error(`Introspection not supported for ${databaseType}`);
66return new Response(`Introspection not supported for ${databaseType}`, { status: 400 });
67}
68} else {
69console.log(`Executing ${databaseType} query`);
70if (databaseType === "postgres") {
71results = await executePostgresQuery(url!, query!);
72} else if (databaseType === "mysql") {
73results = await executeMysqlQuery(url!, query!);
74} else if (databaseType === "duckdb") {
75console.log("DuckDB is not supported");
76return new Response("DuckDB is not supported", { status: 400 });
77} else {
78console.error(`Invalid database type: ${databaseType}`);
79return new Response("Invalid databaseType", { status: 400 });
80}
81}
118if (error.code === "ETIMEDOUT") {
119throw new Error(
120"Connection to PostgreSQL timed out. Please check your database URL and ensure the database is accessible.",
121);
122}
sqliteExplorerAppREADME.md1 match
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
sqliteExplorerAppREADME.md1 match
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
38todo("Inserting and Querying Data"),
39todo("Running Migrations"),
40todo("SQLite as a KV Database"),
41todo("Drizzle in Val Town"),
42],
38todo("Inserting and Querying Data"),
39todo("Running Migrations"),
40todo("SQLite as a KV Database"),
41todo("Drizzle in Val Town"),
42],
sqliteExplorerAppREADME.md1 match
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