Spencer
Spencer
PPrisma
Created by Spencer on 4/11/2025 in #help-and-questions
Parallel Table Names using MuliSchema feature
I'm in the process of deploying some parallel models to new schemas so that we have a sandbox schema to work with until we're ready to do some data migration. I've learned that using the multischema feature doesn't include the schema name as part of the contraint names, so I've had to go through and use the map() function to rename all of my contraints so that they're namespaced to my new schema (e.g. {tablename}_{column_names}_fkey --> {schemaName}_{tablename}_{column_names}_fkey this has allowed me to deploy the parallel tables in a new schema, however when i reun npx prisma migrate dev i still have some outstanding changes that it's trying to apply and I can't figure out what i'm doing wrong or how to rememdy the issue. Curious if anybody has encountered issues with somethign like this
Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

[*] Changed the `AccountProvider` table
[-] Removed foreign key on columns (organizationId)
[-] Removed unique index on columns (issuer)
[-] Removed unique index on columns (issuer)
[-] Dropped the primary key on columns (id)
[-] Dropped the primary key on columns (id)

[*] Changed the `EmailVerification` table
[-] Removed foreign key on columns (userId)
[-] Removed index on columns (token, email)
[-] Removed unique index on columns (token)
[-] Dropped the primary key on columns (id)

[*] Changed the `Module` table
[+] Added foreign key on columns (templateId)

[*] Changed the `ModuleExtension` table
[+] Added primary key on columns (moduleId)
)

We need to reset the following schemas: "dbo, deploy, module, user"
Drift detected: Your database schema is not in sync with your migration history.

The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

It should be understood as the set of changes to get from the expected schema to the actual schema.

[*] Changed the `AccountProvider` table
[-] Removed foreign key on columns (organizationId)
[-] Removed unique index on columns (issuer)
[-] Removed unique index on columns (issuer)
[-] Dropped the primary key on columns (id)
[-] Dropped the primary key on columns (id)

[*] Changed the `EmailVerification` table
[-] Removed foreign key on columns (userId)
[-] Removed index on columns (token, email)
[-] Removed unique index on columns (token)
[-] Dropped the primary key on columns (id)

[*] Changed the `Module` table
[+] Added foreign key on columns (templateId)

[*] Changed the `ModuleExtension` table
[+] Added primary key on columns (moduleId)
)

We need to reset the following schemas: "dbo, deploy, module, user"
it still seems to continue to get confused with tables with the same name but in different schemas
11 replies