
This app uses Val Town SQLite to manage data. Every Val Town account comes with a free SQLite database, hosted on Turso. This folder is broken up into two files:
migrations.ts
- code to set up the database tables the app needsqueries.ts
- functions to run queries against those tables, which are imported and used in the main Hono server in/backend/index.ts
In backend/database/migrations.ts
, this app creates a new SQLite table reactHonoStarter_messages
to store messages.
This "migration" runs once on every app startup because it's imported in index.ts
. You can comment this line out for a slight (30ms) performance improvement on cold starts. It's left in so that users who fork this project will have the migration run correctly.
SQLite has much more limited support for altering existing tables as compared to other databases. Often it's easier to create new tables with the schema you want, and then copy the data over. Happily LLMs are quite good at those sort of database operations, but please reach out in the Val Town Discord if you need help.