Comments (21)
Found an interesting alternative to D1 on top of sqlite https://dqlite.io/, shout out to @freeekanayaka for creating it
from webstudio.
I would at least for now go with Postgres for a couple of reasons
- Support in Prisma is slightly better
- there's a lot of options to have these databases
- when using it with supabase we could also use their storage and auth and that would be a super huge deal to get into beta and allow people to upload fonts and images
- i am not sure about workers but codesandbox used Postgres with live and we didn't have any issues whatsoever with it
- SQlite is nice but it has to be deployed with docker has you need write accessto the file system and vercel/heroku do not give you that
from webstudio.
What just dropped https://blog.cloudflare.com/introducing-d1/ 🔥
from webstudio.
Given d1 is based on sqlite, maybe we should start with migrating to sqlite using any type of hosting for now and then start using d1 once available
from webstudio.
On it! Will start the migation across this repo and the SDK one
from webstudio.
Can you assign it to me?
from webstudio.
This is taking longer than expected for two reasons:
- No other database supports JSON as a tye in the database so I am at least for now stringifying everything
- Types in mongo had to be transformed to new models and so small calls like these:
await prisma.breakpoints.create({ data });
Have to be transformed into a massive call like so:
const all = breakpoints.map(
async (breakpoint: Breakpoint) =>
await prisma.breakpoints.update({
where: { treeId },
data: {
values: {
create: breakpoint,
},
},
})
);
Since sqlite also does not support createMany
from webstudio.
Oh we should migrate to a schema, that JSON type was a workaround because prisma didn't support nested documents types
from webstudio.
Since sqlite also does not support createMany
Yeah, we should create a helper utility that does the same thing as createMany by running multiple queries in parallel. D1 has a batching function that does this faster by sending all queries to the database at once so we can extend our function later to use D1's batching.
My guess is that sqlite never needed batching because it runs close to the server that sends the requests, which is the case if we run it in a container next to the server as well, so that won't be a perf problem in this case
from webstudio.
ThG would be perfect in the future, for now we have will have to have a map
Will love to know if we actually have the format of that JSON
Will push both branches today so you can take a look
from webstudio.
that map looks like it won't be running those in parallel
from webstudio.
Oh, this is just a test before actually making a decent MR
I was gonna use something like: https://www.npmjs.com/package/p-all that we use at remote
from webstudio.
This actually looks better
https://github.com/sindresorhus/p-map
from webstudio.
Do we need to control the concurrency? I would have thought you want to run them in parallel always, so there is no need for an abstraction, its just javascript tm:
await Promise.all([
prisma.breakpoints.update(...)
])
Note how there is no await before prisma.breakpoints.update
But actually we should use Prisma transaction I think it is the exactly right API for this, I don know why I even used Promise.all for this
from webstudio.
- Btw. lets also create a document for contributors on how to work with the db, basics with links to full docs.
from webstudio.
Another sqlite based alternative https://github.com/rqlite/rqlite, shout out to @otoolep
from webstudio.
Streaming replication for SQLIte https://litestream.io/
from webstudio.
Check out the PR's pls
from webstudio.
Btw where should we host temporarily as long as the D1 from cloudflare is not available? I would have picked fly.io
from webstudio.
Fly sounds perfect!
from webstudio.
Also should we migrate all the sites from mongo, the once created from the landing by clicking "try" ? If its too much work we should only migrate the landing. If that's too much work too, we can keep the landing the way it is in alpha and freeze it until beta
from webstudio.
Related Issues (20)
- Ask user if they want to create a breakpoint on paste HOT 2
- Social preview card in whatsapp requires an extra attribute
- Visiting Marketplace template URL throws unexpected error for unauthenticated users HOT 1
- Add gradient UI for generating gradients
- Exclude from Marketplace setting not being respected HOT 1
- Allow `show/hide` for layers in filters, backdrop-filters
- Add index variable generated by Collection
- Allow deleting instances that were inserted and have no component backing them
- Create a new page and mark it as home in the same step
- Default Collection box can't have components inserted HOT 1
- Tooltip delay removed when doing things other than hovering over tooltip trigger HOT 4
- Pathless link navigates to home (query string and fragments)
- Creating Resource creates duplicate
- Render an error in collection when data is not an array
- Support Markdown as Content Embed
- Resolve a duplicate token when pasting
- Make an instance readonly / locked
- Set canonical link
- Image Manager Click on the picture doesn't work as expected
- Use current date by default in time component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webstudio.