studio icon indicating copy to clipboard operation
studio copied to clipboard

Provide easy way to reset all data in database

Open schickling opened this issue 6 years ago • 6 comments

schickling avatar Oct 17 '19 14:10 schickling

Here's an initial design proposal. It's not clear to me yet where the best location for this feature would be but this should get the ball rolling and unblock users. As part of #265 we should rethink this further.

image

Important: When clicking the button, the user should be prompted with a confirmation pop up.

schickling avatar Nov 01 '19 14:11 schickling

@madebysid can you implement the functionality for this yourself or does this depend on some (missing) SDK functionality?

schickling avatar Nov 01 '19 14:11 schickling

It is possible, I'll run a deleteMany on all models.

sdnts avatar Nov 01 '19 14:11 sdnts

Please make sure that the need to put this somewhere more safe and hidden is tracked. Super scary, even if it needs 5 confirmations.

janpio avatar Nov 01 '19 18:11 janpio

Personally, I'd prefer if we handle this in the CLI today with a workflow like prisma truncate <models...>

Then when we go for it, we have the following UI:

image

Something to improve Soren's workflow is exporting the models from @prisma/client:

import { PrismaClient, models } from "@prisma/client"
const prisma = new PrismaClient()

for (let model of models) {
  await prisma[model].deleteMany()
}

I also think with Migrate will cover this use case better.


I'd very much prefer to leave this until post-Beta given that we have so many other fish to fry related to the databrowser.

matthewmueller avatar Mar 17 '20 12:03 matthewmueller

This still open!!! We need a clearAllTables method.

anasouardini avatar Aug 25 '24 09:08 anasouardini

Hey :wave:

Prisma ORM 7 introduces a brand new standalone Studio, built from the ground up to work everywhere, with or without Prisma ORM. Consequently, all "old Studio" issues are being closed as there won't be any further work on it. :mega:

The new Studio is also available in the Prisma VS Code extension and in the Prisma Console application. :electric_plug:

Help shape, improve and fix the new Studio with us in this repository by submitting bug reports and feature requests. :construction_worker:

igalklebanov avatar Nov 20 '25 01:11 igalklebanov