PlanetScale provide a hosted MySQL database with 5GB of storage included in the free tier.
Go to https://auth.planetscale.com/sign-up
Select New database on the dashboard.
Create a database.
Go to Settings → Passwords and click New password.
Save the host
, username
, and password
values as Val Town secrets – use planetScaleHost
, planetScaleUsername
, and planetScalePassword
respectively.
Copy and paste this val to create a table with the given schema.
https://www.val.town/embed/vtdocs.planetScaleCreateStockTable
Insert one or more items.
https://www.val.town/embed/vtdocs.planetScaleInsertStockTable
Use the rows
property to get your query results – or return the entire results
object to see what other data is available.
https://www.val.town/embed/vtdocs.planetScaleSelectStockTable