i'm trying to create view using migration followed documentation of prisma here I have followed all steps created migration using
npx prisma migrate dev --name create_views --create-only
and copied inside generated create_views\migration.sql
CREATE VIEW "Draft" AS
SELECT "published", "title", "email", "Post"."id"
FROM "Post", "User"
WHERE "published" = false AND "Post"."authorId" = "User"."id";
I successfully created the views
but after adding the model manually to schema.prisma
model Draft {
title String
id Int @unique
email String
published Boolean
}
I cannot use the command
npx prisma migrate dev
this command will create Draft migration and get failed with message Draft already exists
I want to query using prisma on Draft View using prisma inbuilt query and not raw query and also add more tables so npx prisma migrate dev command won't fail