19 "Mood Journal: Build an app for tracking daily moods and identifying patterns over time.",
20 "Plant Care Assistant: Create a guide for plant owners to track watering schedules and care instructions.",
21 "Movie Database: Design an app to keep track of movies you've watched or want to watch, with ratings and reviews.",
22 "Language Learning Tool: Develop a simple language learning app with vocabulary lists and practice exercises.",
23 "Habit Tracker: Build an app to help users form and maintain good habits by tracking daily activities.",
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3
4import { TABLE_NAME } from "./database";
5
6export default async function(req: Request): Promise<Response> {
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3
4import { TABLE_NAME } from "./database";
5
6export default async function(req: Request): Promise<Response> {
50 }
51
52 // Now it's time to upload things to database and blob storage
53 // First, add to database, and get the ID
54 const id = await sqlite.execute(
55 `INSERT INTO ${TABLE_NAME} (title, data, type, time) VALUES ($title, $data, $type, CURRENT_TIMESTAMP)`,
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3export const TABLE_NAME = "pondiverse_creations_v4";
4
5async function dropTable() {
24 return fetchCreations(req);
25
26 if (req.method == "POST" && url.pathname == "/updateDatabase")
27 return updateTable(req);
28
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { updateTable } from "./database";
3
4export default async function(req: Request): Promise<Response> {
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3
4import { TABLE_NAME } from "./database";
5
6export default async function(req: Request): Promise<Response> {
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3
4import { TABLE_NAME } from "./database";
5
6export default async function(req: Request): Promise<Response> {
5/**
6 * Every Val Town account comes with its own private
7 * [SQLite database](https://www.sqlite.org/) that
8 * is accessible from any of your vals.
9 * ([Docs ↗](https://docs.val.town/std/sqlite))
118
119// adapted from
120// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
121function rowFromSql(
122 sqlRow: Array<unknown>,
372 const url = new URL(request.url);
373
374 // Initialize database tables
375 await sqlite.execute(`
376 CREATE TABLE IF NOT EXISTS ${KEY}_items_${SCHEMA_VERSION} (