dcwatson / django-pgcrypto

Python and Django utilities for encrypted fields using pgcrypto.
BSD 2-Clause "Simplified" License
67 stars 22 forks source link

Deconstruct includes the key - this results in a new migration when the key is changed #15

Closed uzihs closed 8 years ago

uzihs commented 9 years ago

When you use different keys for development and production environments, running migrate in the production environment fails since Django migration identify a change in the schema that is not represented in the migrations.

dcwatson commented 8 years ago

I'm not entirely sure this is the right solution. On one hand, the migrations should have what they need to reconstruct a Field at any point in time. But this is a legitimate issue, and keys probably shouldn't be checked in to version control. I wonder if manually editing the migrations after you make them to use settings (or read from a file/environment, or however you're setting them) would work - it's a similar problem to third party app using AUTH_USER_MODEL and having to manually update the migrations.

In any case, I've stopped including the key in migrations for now. Would you mind making sure this solves your issue?