I'm getting a P3003 error and the page it links to...
# prisma-migrate
t
I'm getting a P3003 error and the page it links to in the documentation is dead - https://www.prisma.io/docs/reference/api-reference/error-reference#p3003
r
It redirects to baselining your migrations. Somehow the migrations in your system have changed and it’s conflicting.
t
Hey @Ryan I've made some progress since I posted that, but not much in the way of a solution. When I manually deleted the incomplete migration and ran it again, it gave me this database error
Copy code
Error: Database error
11:57:09.507  	Error querying the database: db error: ERROR: current transaction is aborted, commands ignored until end of transaction block
I found that there is no way to find out which query caused this, and can't rollback migrations without resetting the database. Locally it works fine, except that it resets. I'm considering setting a CI flow to reset and seed the database in case of this specific error in production. Is there a better way though?
r
Could you share the latest migration file that might have caused this? We would like to know what was the statement that failed the migration.
t
Oh, I think I got it
Copy code
/*
  Warnings:
  - The values [Admin] on the enum `user_role` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "user_role_new" AS ENUM ('CISO', 'DPO', 'Audit', 'Security', 'Owner', 'Viewer', 'Responder', 'Vendor');
ALTER TABLE "users" ALTER COLUMN "role" TYPE "user_role_new" USING ("role"::text::"user_role_new");
ALTER TYPE "user_role" RENAME TO "user_role_old";
ALTER TYPE "user_role_new" RENAME TO "user_role";
DROP TYPE "user_role_old";
COMMIT;

-- AlterTable
ALTER TABLE "companies" ADD COLUMN     "is_vendor" BOOLEAN DEFAULT false,
ADD COLUMN     "risk_level" TEXT,
ADD COLUMN     "status" TEXT;
It's probably because of how it's doing the enum here?
Yeah, that was it
It worked after I commented out that part
r
It’s possible there might be a default value or a row still using the removed enum value. Could you check if any rows are still using that? If it’s still not working, event if there’s no data left on any row regarding the enum, I would suggest opening an issue here so that we can investigate 🙂
t
There is no default value on that, and the role I removed was redundant anyway, so I'm sure it wasn't being used anywhere. I will try recreating this in a separate environment and open an issue if it occurs again @Ryan
r
Sounds great! Thanks 🙂