Revert "DeletionTriggerGenerator: SELECT the gid, not the id"

This reverts commit b3bcdf502da37093f8a4c88e17d499649078b2f5.

That commit was a stupid idea because it would have helped in just
deleting entities related to the deleted one, but they do not need to be
deleted.

Conflicts:
	sir/trigger_generation.py
Extract writing triggers into methods
Save CreateTriggers.sql in a sql/ subdirectory
Add a note to CreateTriggers.sql that it's generated
Make the API docs more readable
Document the trigger_generation module a bit more