News for hackers. Stuff that matters.
Re:How Figma's databases team lived to tell the scale by fauigerzigerk on Friday March 15, 2024 @04:37AM (#39713369)
That would be fantastic. Unfortunately it's not true. D1 doesn't support the one database per customer approach unless you have just a handful of customers that you can set up manually.

You have to create each database manually using wrangler or the website. Then you have to create a binding for each database in wrangler.toml so that the database becomes accessible as a variable in your Workers code. Then you have to change your Worker source code to do something with that variable. Then you redeploy.

The issue is that Workers cannot create or list databases. There's no API for it.

Re:How Figma's databases team lived to tell the scale by ummonk on Friday March 15, 2024 @01:45PM (#39718537)
They have said they're working on some sort of solution (which they intend to have available by the time D1 exists beta) that will allow some sort of dynamic bindings specifically to address this use case.

In the meantime, though it's not a great solution, one can create and query databases through the REST API instead https://developers.cloudflare.com/api/operations/cloudflare-...

Re:How Figma's databases team lived to tell the scale by fauigerzigerk on Friday March 15, 2024 @03:54PM (#39719983)
>They have said they're working on some sort of solution

That's great to hear, thanks!