Managing index locking during zero-downtime migrations
0 reputation · 17 Feb 2023, 16:20 UTC
When migrating a small application using Prisma, a multi-phase deployment is often required to ensure high availability. While the prisma migrate dev workflow allows for manual SQL review, the actual execution of schema changes can still trigger table locks depending on the database engine.
The primary concern is how Prisma handles the creation of new indices on large tables. If the generated migration script uses a standard CREATE INDEX statement, the database may lock the table for writes until the operation completes, potentially causing downtime that contradicts the goal of a zero-downtime transition.
Does Prisma support the native generation of CONCURRENTLY index creation for PostgreSQL within its migration files? Are there specific configurations in the schema.prisma that prevent the engine from locking tables during these operations?