Post

Say I have a SvelteKit in which most pages can be prerendered and this requires data from the DB. Some pages require the DB live. Now what happens during a deployment? I need to update the DB (if migrations were added) and then update the web application and push the new code. However, since... 1/2

... these steps may require a few mins, data might be inconsistent. The pages that require the DB live already have the new data before the deployment is finished. This might actually crash the application. AI suggests removing the prerendering and using caching instead. Other ideas? 2/2

0 reposts0 likes

Is the issue that the database shape changed? In that case, the best practice is to never do hard changes: you should be back compatible in one release, then migrate the data and then hard delete the column (or do the "hard change")

This is the way to go when the schema changes. But I was referring to changes of the data. I have a Wiki style app (will be announced soon ✨) and the information on some pages could be different from the one on other pages, namely when the database update has finished, but the app update not yet.

Specifically, in the deployment pipeline, I first update the remote database (1), then build the application (2), and then deploy it to Netlify (3). Currently it only takes like 2 minutes, but in the time between (1) and (3) the deployed app has inconsistent data.