Tags: PX4/pyulog
Tags
db: add database migration tool Database setup required running ".read sql/setup_db.sql" manually, which was unintuitive when using pyulog as a library. This commit adds the ulog_migratedb console script to handle the database setup. A single SQL script isn't robust to future database changes. If there is a discovered issue with the current database schema, or there is a bug in the schema, then new changes might be needed, and we really don't want to lose data by accident. Hence, careful data migration might be needed. Other migration tools like "alembic" and "migrations" were considered, but the former was sqlalchemy-specific and the latter seemed to have little support. Hence a small migration script was created, migrate_db.py, which handles simple forward-migration. This might be overengineered, but the migration logic itself is only 50 lines or so, so it might be worth the future-proofing.
PreviousNext