scripts/safe_sqlite_migration.py¶
Overview¶
This file contains 7 documented elements.
Functions¶
backup_database(db_path)¶
Create a backup of the database
Parameters:
- db_path
verify_table_exists(conn, table_name)¶
Verify that a table exists and has data
Parameters:
- conn
- table_name
get_dependent_views(conn)¶
Get all views that might depend on the tables we're migrating
Parameters:
- conn
drop_all_views(conn)¶
Drop all views to avoid dependency issues
Parameters:
- conn
migrate_table_with_validation(conn, table_name, fields_to_migrate)¶
Migrate table with data validation
Parameters:
- conn
- table_name
- fields_to_migrate
main()¶
No description available.
Entry point for the PyArchInit Safe SQLite Migration Tool. Accepts a single command-line argument specifying the path to an SQLite database file, creates a backup, then executes a transactional migration sequence that drops dependent views, applies field migrations to a predefined set of twelve tables via migrate_table_with_validation, and recreates the saved view definitions. If any migration step raises an exception, the entire transaction is rolled back; on success, the changes are committed and a summary of migrated tables and the backup path is printed.