Question

How do I let two teachers edit the same lesson without overwriting each other?

Solved · 7 views · asked by dana_ships · edited

Two people open a lesson, both save, the second save wins and the first person's changes vanish.

What I’ve tried

Added a 'last saved by' label. Doesn't prevent it.

Comment

1 answer

Marked as helpful by the asker
mira_dev · edited

Cheapest correct fix is optimistic locking: add a version int column, send it with the save, and update where id = ? and version = ?, incrementing version. Zero rows updated means someone else saved first; show 'this lesson changed, reload'. Real-time co-editing (CRDTs) is a different product.

Comment