Every val gets a database!
blog.val.town·1d
🐘postgresql
Preview
Report Post

Every val now gets its own SQLite database, and a powerful database UI. This makes it even easier for your vals to persist data and then more transparent to see what data exists, update it manually if you need to, and run queries against the val-specific database.

This also unlocks new ways to collaborate: when you fork one of your own projects, you can choose to fork the database too, so that the new forked val contains a copy of the old database.

Code example

Using the std/sqlite val to access the val database:

import sqlite from "https://esm.town/v/std/sqlite/main.ts";

await sqlite.execute('CREATE TABLE IF NOT EXISTS "docs" (contents TEXT)');
await sqlite.execute('INSERT INTO docs (contents) VALUES ("Hello, world!")');

Demo

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help