DB migrations
tomaszmrugalski opened this issue · 3 comments
Our current approach to migrations is a bit primitive. Consider using something similar to: https://pypi.org/project/yoyo-migrations/ or https://pypi.org/project/raw-sql-migrate/
Few useful links:
- Raw SQL migration - Python package
- Yoyo migrations - Python package
- Simply migration script - based on Fabric and sqlwitch, but we can change it for use another background.
I prepared migration script - migrate-db.py
. It uses schema
table to recognize DB version.
Migration files should be in db
directory in .psql
. You need to use name convention:
satnogs-XX.psql
where XX is schema version. Solution isn't limited to range 00-99. It means that you can use satnogs-9999.psql
and it will work correctly.
In migration script you need to include query for increment (set) version
column in schema
. In this way you have a possibility to perform migration manually without Python script.
Thanks for writing this. I've tested that script and it works well. I think this can be closed now.