[database] Implement v2 support

2 jobs for 20_template_protocol in 7 minutes and 26 seconds (queued for 4 seconds)