Migration Framework
This script provides a easier, faster and safer way to do migration on the manifests.
How to use
- Create a new file and implement the
AbstractMigrationclass. - Implement
migratemethod. This method will be called when the migration is executed. - Override
filtermethod. Use this function if you do not want to run the migration on all manifests. - Run your class using this method:
async def main():
migration = CustomMigration(
"https://deployment-portal-backend.np.navi-tech.in",
"<x-auth-token>",
)
await migration.run()
if __name__ == "__main__":
asyncio.run(main())
Refer to example_migration.py for a sample migration.
Set up environment
- It is advisable to use a virtual environment to run the migration script. To set up the environment, run the following commands:
cd scripts/_migration_framework python3 -m venv venv source venv/bin/activate pip install -r requirements.txt - Run the migration script
python example.py - To deactivate the virtual environment, run the following command:
deactivate