Skip to main content

Transaction usage

Prisma supports explicit transactions via $transaction. MUZE uses transactions in critical multi-step operations:

Order placement and approval

Order placement wraps the employee row lock, entitlement preview, order and item creation, store-order batch linking, and number reservation in a single transaction so concurrent submissions cannot over-allocate entitlement.

Employee CSV import

Imports are partial-failure tolerant, so rows are committed individually rather than one big transaction:
Invalid rows are skipped and reported in the ImportBatch record; valid rows are not rolled back.

Transaction patterns

Migration process

Development workflow

Production deployment

Migrations run as part of the Render start command before the server boots, so the schema is always current when new code goes live. See Deployment.

Migration safety rules

Connection management

Prisma connects through the URLs configured in the schema: The directUrl (without pooling) is used only for migrations, because PgBouncer transaction pooling does not handle DDL statements. Backup and recovery procedures are covered in Backups and recovery.