-- Add version field for optimistic locking -- This enables concurrent update detection to prevent lost updates -- Add version column to mpc_sessions table ALTER TABLE mpc_sessions ADD COLUMN version BIGINT NOT NULL DEFAULT 1; -- Add comment explaining the version field COMMENT ON COLUMN mpc_sessions.version IS 'Version number for optimistic locking - increments on each update to detect concurrent modifications'; -- Create index on version for better query performance (optional but recommended) CREATE INDEX idx_mpc_sessions_version ON mpc_sessions(id, version);