django-cryptography icon indicating copy to clipboard operation
django-cryptography copied to clipboard

Remove encryption

Open marianobrc opened this issue 5 years ago • 1 comments

Hello, We've been using this package in the fields of a model, but we want to remove encryption from some fields now cause we need to do search lookups. I'm wondering which is the best way to do this. Would it be enough just removing encrypt() from model fields and run makemigrations/migrate? I Guess data will remain encrypted into the DB.

I was thinking in writting some custom migrations like this: 1.- Given field_x is encrypted, add another field field_x_text to the model 2.- Read data from field_x to get unencrypted value and write it in field_x_text 3- Remove field_x 4.- Rename field_x_text to field_x

Any advice would be appreciated. Thanks

marianobrc avatar Jul 24 '19 12:07 marianobrc

Some of the comments in another issue might help you get this migration complete.

You have basically the right workflow written out. Be sure to backup your database before starting :)

thismatters avatar Jul 24 '19 17:07 thismatters