Add trigger based versioning for PostgreSQL