3 ms·
Not really sure how you distinguish between runtime and something else. It seems to me that you could provision a "shard" as simply as executing in a worker:
by ibejoeb 3y ago
Not really sure how you distinguish between runtime and something else. It seems to me that you could provision a "shard" as simply as executing in a worker:
wrangler d1 create customer28 --experimental-backend
wrangler d1 execute customer28 --file=schema.sql
- fauigerzigerk 3y agoWhat I mean is that workers cannot create databases. You have to create each database using wrangler (or the UI) and then edit the configuration file to add a binding. The binding becomes a variable in the JavaScript environment, which means you have to change the source code every time a new database is created. Therefore, creating a database per user as part of the user signup flow is not possible.
- ibejoeb 3y agoAh, I see. I thought it would be possible to dynamically set a secret which would effectively be a database uri. But upon further investigation, it does indeed need a redeploy. I suppose you could make something to write the bindings to the toml and trigger a redeploy, but that's definitely not pretty.