Modified the database constraints to improve error checking when copying events.