docs icon indicating copy to clipboard operation
docs copied to clipboard

Document switching from default to `relationMode=prisma`

Open Jolg42 opened this issue 2 years ago • 0 comments

This is about the referentialIntegrity preview feature.

Related https://github.com/prisma/prisma/issues/15225

When switching from default to relationMode=prisma you need to decide if you want and can keep the existing migration history for your use case.

  • fine when database is MySQL but want to remove foreign keys
  • not fine when database is Planetscale, as migrate dev or migrate deploy will try to apply existing migrations that contain Foreign Keys. The error would show like this
    	Database error code: 1317
    
    	Database error:
    	Foreign keys cannot be created on this database. Learn more how to handle this: https://pris.ly/d/migrate-no-foreign-keys
    
    • The easy solution will be to delete the current migrations directory and use npx prisma db push to keep the database in sync.
    • (Side comment: We actually discourage migrate dev for PlanetScale).

Jolg42 avatar Oct 11 '22 16:10 Jolg42