P
Prisma4mo ago
dhe128

Error: P3005 The database schema is not empty.

I want to initialize prisma in an existing supabase project. All schemas in datasource db.schemas are empty, and public._prisma_migrations does not exist. I have the initial migration in migrations/0_init/migration.sql, generated via https://www.prisma.io/docs/orm/prisma-migrate/workflows/baselining I'm getting Error: P3005 The database schema is not empty. with either prisma migrate dev and prisma migrate deploy. In addition prisma migrate reset also has the same error. How do I get the db into a state where I can deploy the initial migration?
2 Replies
jonfanz
jonfanz4mo ago
Are you using Supabase Auth in your project?
dhe128
dhe128OP4mo ago
yes I'm using multischema, and datasource db.schemas doesn't touch any existing schemas so not touching auth storage or public I'm connecting with a connection string - datasource db has both url and directUrl Maybe it's a caching issue?
npx prisma migrate diff \
--from-empty \
--to-schema-datamodel prisma/schema.prisma \
--script > prisma/migrations/0_init/migration.sql
npx prisma migrate diff \
--from-empty \
--to-schema-datamodel prisma/schema.prisma \
--script > prisma/migrations/0_init/migration.sql
generates a full initial migration even though the schema in db is initially empty I expect that command to generate an empty migration if the schemas in db are empty. Maybe I'm misunderstanding what it does?
Want results from more Discord servers?
Add your server