-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommendations for data migrations #29
Comments
Another option would be to define a schema in the migration to use with a schema query? |
I agree that there should be documentation on how to migrate existing data. I think this would consist of calling the |
Guidance will be coming for this in the upcoming |
For what it's worth I went with defining a schema in my migration that worked well. Ideally this probably shouldn't even be in a migration, probably makes more sense in a mix task. I'm looking forward to see what solution Cloak takes though. Thanks for the update! |
@tielur this is the guide that will be included in Cloak 0.7: https://github.com/danielberkompas/cloak/blob/master/guides/how_to/encrypt_existing_data.md |
@danielberkompas Awesome looks good. I like keeping that in a mix task as well. 👍 |
So I recently started using cloak in a project with existing data. I'm in the process of figuring out the best way to migrate that data to it's encrypted version. I ran into a few things and I'm looking for recommendations that might be worth documenting for other users. Here's a few things:
I originally went the route of #1 and just wrote a query to fetch data and then update it so that Cloak would encrypt the data. This worked ok but because it's using Schema queries if you want to update the model in the future like I am doing now, the migration will fail. This lead me down the route of schemaless queries to be used in migrations. Which everyone seems to be using anyways for this reason.
So if we go with schemaless queries, I don't think I can go the route of just updating the data and expecting Cloak to encrypt it. Here's where I need a suggestion on how to handle the encryption. Do I just use the manual
encrypt
methods to handle that?Is this a common enough problem that maybe Cloak should include an example of how to handle this?
The text was updated successfully, but these errors were encountered: