Open midgleyc opened 3 years ago
Hi @midgleyc, thanks for this featre request! We will very likely build something like this very soon! We ourselves have a use case for this as well. Details are still hazy, but I'll keep you updated!
Hey guys, Studio is a great tool to view your DB data. I like the simple nice UI, just feels great.
The only thing I am concern is about how fragile is, by easy way to edit/add/remove something. Like @midgleyc suggested, can we have a read-only view, so we can't break things in production just that easily?
The thing is I have a cat called Munja 🐱 which often likes to type random things on my mechanical keyboard, so I wanna prevent him from breaking my production app.
Jokes at the side, this would be a really useful feature.
Peace,
I achieved this by having a read-only replica of the server. Now whenever I try to save anything to db from studio, it throws me a nice error. Although I had to migrate data fromnormal database to a master-slave database, which was a bit of pain for sure :D.
Are there any updates on this request? Thanks!
Hi @midgleyc, thanks for this featre request! We will very likely build something like this very soon! We ourselves have a use case for this as well. Details are still hazy, but I'll keep you updated!
Have you all been able to look into this further? We are in need of this functionality for our support team
Hey, the Prisma Data Platform lets you do exactly that, have you given that a shot?
I wonder if changing the .env
for DATABASE_URL
would work? Then you could flip back and forth.
Would obviously require a read only user or read only follower.
@sdnts any update to this? It's been years since last comment.
Sorry about that, I don't work on Studio anymore, but @janpio should be able to speak to this.
No concrete plans right now.
Besides using a read-only replica of your database as @entrptaher suggested, you could also create a database user that can only read data but not create, update or delete and use that in the connection string for Prisma Studio to achieve the same.
But I understand that built-in support would probably be nicer. How would you expect this to be selected or configured? CLI paramater --read-only
or similar? Something else?
@janpio I suggest reading from env variable, something like PRISMA_STUDIO_MODE="read"
or so, then it can be overrided by a --mode="read"
param from CLI, if none of them are present then go with default all
mode, that way devs have a good level of flexibility and control.
I'd like to use studio with a user which only has SELECT permissions, as a very good graphical tool for viewing databases with a web UI. Because of this permission structure, any calls to add a record or update fields will fail. Would it be possible to add an option to not show the "add record" button, or allow any fields to be changed?
A simple workaround is for me to tell anybody using this that trying to edit anything will fail, so they shouldn't try ;)
For more information around the use-case: I'm working with an old database that doesn't have e.g. cascaded updates, so any updates outside its management interface could possibly leave the database in an inconsistent state (leading to problems in other parts of the application). Because of this I'd like access outside the management interface to use a read-only user.