unkey icon indicating copy to clipboard operation
unkey copied to clipboard

One Click migration paths

Open ErrolFernandes opened this issue 1 year ago • 2 comments

Preliminary Checks

  • [X] I have reviewed https://unkey.dev/docs for existing features that would solve my problem

  • [X] I have searched for existing feature requests: https://github.com/unkeyed/unkey/issues

  • [X] This issue is not a question, general help request, or anything other than a feature request directly related to Unkey. Please ask questions in our Discord community: https://unkey.dev/discord.

Is your feature request related to a problem? Please describe.

There is no one migration paths available

Describe the solution

Provide a 1 click migration option

Describe alternatives you have considered (if any)

No response

Additional context

No response

ErrolFernandes avatar Dec 23 '23 17:12 ErrolFernandes

My previous thoughts about this:


  1. We will add a new table migrations (migrationId, workspaceId, keyAuthId, encoding, algorithm)
  2. When a customer wants to migrate, we add a row to start a migration, we ask them what hashing algorithm they used and how they're encoding their keys (eg. base64)
  3. we will add a new column migrationId to keysand add all of their keys while specifying the migrationId, as hash we use whatever they had previously
  4. during migration, the customer will send the Unkey-Migration with their migration id along with every request
  5. if this header is present, we first check the key as usual but if it is not found, we hash and encode the key using the customer's instructions. If the key is now found, we rehash with our own instructions, update the hash and remove the migrationId. The key is now fully migrated.
  6. Eventually all or enough keys are moved and the customer can stop sending the header

Considerations:

Maybe a separate (almost duplicated) table for keys that need migration would be better, I'm not sure yet

chronark avatar Dec 23 '23 17:12 chronark