Move trigger definitions into functions

Since we rewrite trigger functions every now and then it makes more
sense to have them in the functions.plsql file, as that is run on every
upgrade, rather than in ip_net.plsql which is only run when going
between database schema versions.

This will allow us to easily implement new triggers or remove current
ones in the future.
Merge branch 'db-stuff'