Backend: Python 3.11 and Django 5.0.6
Database: PostgreSQL 15
Our app deals with reporting from the database. We don’t store report SQL queries in the codebase; instead, we store them in DB tables. However, developers change SQL queries from time to time. How can we track such changes made in the database, similar to using Git? For example, I want to see the query changes made in the database one year ago. How can I do that? Does anyone have any approach to do this?
I tried to set up Liquibase, but it lacks support/documentation for a Python + Django app.
Currently, what we are doing is we created a repo for the database, manually generating insert statements from the table and pushing them into the repo. But this is a hectic procedure. Some approaches that may work include using PostgreSQL triggers or logs. There are only some specific static tables that I want to track because some tables have data in the millions. If possible, I need an implementation similar to a version control tool like Git. Does anyone have a better approach to this problem?