Implement optimistic locking to handle concurrent updates safely
Implement optimistic locking for: Database: [PostgreSQL/MySQL/MongoDB] ORM/Framework: [Prisma/TypeORM/Mongoose/etc.] Entities: [LIST ENTITIES NEEDING LOCKING] Concurrency Scenario: [DESCRIBE THE CONCURRENT ACCESS PATTERN] Requirements: - Conflict resolution: [LAST-WRITE-WINS/MERGE/USER-DECIDES] - Retry strategy: [AUTO-RETRY/FAIL-FAST] - Client notification: [HOW TO INFORM USERS] Please provide: 1. Version column/field implementation 2. Update query with version check 3. Conflict detection code 4. Conflict resolution strategies 5. Client-side handling recommendations 6. Testing concurrent updates
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[LIST ENTITIES NEEDING LOCKING][DESCRIBE THE CONCURRENT ACCESS PATTERN][HOW TO INFORM USERS]