0.20

The Postgres store no longer creates its tables. You apply them, before you deploy.

Postgres

Before you deploy 0.20, apply the SQL its store needs, node_modules/experimental-a2/sql/postgres/schema.sql, once per database, however you run SQL against it. It creates only what's missing and leaves existing data alone, so it's safe on a database an earlier release set up, and the deployment running now keeps working against it, without waiting on its writes.

  • Apply it as the role your app connects with. It records a schema version in a new a2_schema table, which the store reads on a cold start. If another role applies it, grant your app's role select on it:

    grant select on a2_schema to your_app_role;
  • With listenConnectionString, also apply sql/postgres/notifications.sql. It installs the triggers the store used to install for you.

  • The app's role needs no DDL rights. Read and write access to A2's tables is enough.

If you deploy first

The store throws STORE_NOT_CONFIGURED on its first query, naming the file to apply. Until you apply it, nothing is written: appends fail, and scheduled work waits. Vercel Queues keeps redelivering it, and the QStash scheduler hands each task to a later message, 30 seconds out and backing off to one day. The next call after you apply the file succeeds, with no redeploy.

Other stores

Nothing to do. SQLite still creates its tables when it opens its file, and Redis creates its keys as it writes.

Moving past 0.20 to 0.21 or later? Apply that release's schema.sql instead, the way 0.21 says. It drops a2_schema.