refactoring playbook postgresql