Skip to content

feat: add credits migration script to migrate legacy key credits to credits table#4204

Closed
Flo4604 wants to merge 4 commits intofeat/identity-credits-dashboardfrom
feat/identity-credits-migration
Closed

feat: add credits migration script to migrate legacy key credits to credits table#4204
Flo4604 wants to merge 4 commits intofeat/identity-credits-dashboardfrom
feat/identity-credits-migration

Conversation

@Flo4604
Copy link
Member

@Flo4604 Flo4604 commented Oct 29, 2025

What does this PR do?

Adds a new migration command into our cli to migrate the keys from the old schema to the new schema.
This can be run whenever we want, worst case we just rollback the code without too many issues.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

Create keys using our old structure best case in main before switching to this branch.

Then run the script and check if you can validate the key and use all the endpoints and see the correct credit data in all endpoints e.g listKeys getKey whoAmi verifyKey and so on.

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

@vercel
Copy link

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
dashboard Ready Ready Preview Comment Nov 4, 2025 5:16pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
engineering Ignored Ignored Preview Nov 4, 2025 5:16pm

@changeset-bot
Copy link

changeset-bot bot commented Oct 29, 2025

⚠️ No Changeset found

Latest commit: 34b0fb2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member Author

Flo4604 commented Oct 29, 2025

@vercel vercel bot temporarily deployed to Preview – engineering October 29, 2025 14:52 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard October 29, 2025 14:52 Inactive
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/identity-credits-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 8c3d739 to 43322af Compare October 29, 2025 15:52
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from 07b1b0b to b1449b6 Compare October 29, 2025 15:52
@vercel vercel bot temporarily deployed to Preview – engineering October 29, 2025 15:53 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard October 29, 2025 15:53 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from b1449b6 to 97202cd Compare October 29, 2025 16:23
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 43322af to 475c6ce Compare October 29, 2025 16:23
@vercel vercel bot temporarily deployed to Preview – engineering October 29, 2025 16:24 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard October 29, 2025 16:24 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 475c6ce to 77f0ca0 Compare October 29, 2025 16:34
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from 97202cd to 18f9cf3 Compare October 29, 2025 16:34
@vercel vercel bot temporarily deployed to Preview – engineering October 29, 2025 16:35 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard October 29, 2025 16:35 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from 18f9cf3 to ac07622 Compare October 29, 2025 18:01
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 77f0ca0 to 4d23c59 Compare October 29, 2025 18:01
@vercel vercel bot temporarily deployed to Preview – engineering October 29, 2025 18:02 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 4d23c59 to fec5c12 Compare October 29, 2025 18:04
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from ac07622 to 5f876ec Compare October 29, 2025 18:04
@vercel vercel bot temporarily deployed to Preview – engineering October 29, 2025 18:04 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch 2 times, most recently from 949e664 to 854a9d8 Compare October 30, 2025 17:15
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 6288066 to 35cc3af Compare October 30, 2025 17:15
@vercel vercel bot temporarily deployed to Preview – engineering October 30, 2025 17:30 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard October 30, 2025 17:30 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from 854a9d8 to f23495e Compare November 3, 2025 09:49
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 35cc3af to 7aa05e8 Compare November 3, 2025 09:49
@vercel vercel bot temporarily deployed to Preview – engineering November 3, 2025 09:50 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard November 3, 2025 09:50 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 7aa05e8 to 247e377 Compare November 3, 2025 11:32
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from f23495e to e68d34a Compare November 3, 2025 11:32
@vercel vercel bot temporarily deployed to Preview – engineering November 3, 2025 11:33 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard November 3, 2025 11:33 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 247e377 to 571dab2 Compare November 3, 2025 11:49
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from e68d34a to 59b2e5c Compare November 3, 2025 11:49
@vercel vercel bot temporarily deployed to Preview – engineering November 3, 2025 11:49 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard November 3, 2025 11:49 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from 571dab2 to f4cc6c1 Compare November 3, 2025 11:59
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from 59b2e5c to 8a05519 Compare November 3, 2025 11:59
@vercel vercel bot temporarily deployed to Preview – engineering November 3, 2025 12:00 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard November 3, 2025 12:00 Inactive
@Flo4604 Flo4604 force-pushed the feat/identity-credits-dashboard branch from 8a05519 to db83b87 Compare November 3, 2025 12:07
@Flo4604 Flo4604 force-pushed the feat/identity-credits-migration branch from f4cc6c1 to 32fb7e1 Compare November 3, 2025 12:07
@vercel vercel bot temporarily deployed to Preview – engineering November 3, 2025 12:08 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard November 3, 2025 12:08 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Thank you for following the naming conventions for pull request titles! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant