Closed Watchwolf closed 4 years ago
I have an example of this in the test cases, check it out at https://github.com/georgemarshall/django-cryptography/tree/master/tests/fields/test_migrations_normal_to_encrypted, hopefully that helps.
Facing the same issue here. Did you manage to do it ?
Follow django fernet procedure. It worked for me https://django-fernet-fields.readthedocs.io/en/latest/#migrations
Here is the migration template I cooked up for doing exactly this: https://gist.github.com/thismatters/53787f2d021fa5a1df640cd7b98d1185
If I find the time I'll make a django command to automatically produce these migrations.
NOTE: This didn't actually work when running against PostresSQL, I had to split up the data migrations and the table alterations into separate migration files.
Documentation has been added to cover this.
https://django-cryptography.readthedocs.io/en/latest/migrating.html
Hello,
Have you an idea how I can migrate an existing database in order to user django-cryptography ?
I am planning to use it in a existing database. Currently the migration only convert charfield to blob but do not encrypt the data.
I am searching to do it manually but right now I do not have a solution.