adding trigger methods to cascade update foreign id when creating new data in the database