Skip to content
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

add created timestamp to tokens table #10573

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

chris48s
Copy link
Member

@chris48s chris48s commented Oct 1, 2024

One of the things that has come out of https://github.com/badges/shields-ops/issues/38 is: It would be quite useful to know how long we've held a given token for in a more explicit way then relying on the id sequence. In some ways I'm a bit late to the party, but better late than never.

This PR creates a migration that adds a column called created to the github_user_tokens table. We'll need to manually run this migration on production after deploying it.

The created column defaults to CURRENT_TIMESTAMP which means:

  • When we apply the migration it will set the created timestamp to now when we apply the migration for any existing records
  • The existing code can run with or without this migration applied
  • When we add new tokens they'll automatically be timestamped at INSERT time with no code changes

@chris48s chris48s added the core Server, BaseService, GitHub auth, Shared helpers label Oct 1, 2024
Copy link
Contributor

github-actions bot commented Oct 1, 2024

Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against d85a116

@chris48s chris48s added this pull request to the merge queue Oct 12, 2024
Merged via the queue into badges:master with commit b85cfc7 Oct 12, 2024
24 checks passed
@chris48s chris48s deleted the token_timestamps branch October 12, 2024 08:12
@chris48s
Copy link
Member Author

migration is now applied in prod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth, Shared helpers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants