PlanetScale

PlanetScale

PlanetScale provide a hosted MySQL database with 5GB of storage included in the free tier.

1. Sign up to PlanetScale

2. Create a new database

Select New database on the dashboard.

Create a database.

image
image

3. Create a password

Go to SettingsPasswords and click New password.

image

Save the host, username, and password values as Val Town secrets – use planetScaleHost, planetScaleUsername, and planetScalePassword respectively.

image

4. Create your first table

Copy and paste this val to create a table with the given schema.

5. Insert an item

Insert one or more items.

6. Query an item

Use the rows property to get your query results – or return the entire results object to see what other data is available.

7. Do more than queries!

Read the source of the @vtdocs.queryPlanetScale helper, see how it uses the @planetscale/database SDK, refer to the driver’s documentation, and extend it!