Add foreign key constraint check