Add API key database objects#21
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the auth database schema to support API key storage and change notifications, while removing a previously included schema-migration block for session refresh columns.
Changes:
- Added a new
auth.apikeytable (with a user lookup index) for API key metadata. - Added a statement-level notification trigger for
auth.apikeyto integrate with the existingnotify_table()mechanism. - Removed the idempotent migration block that added/backfilled
session.refresh_expires_atandsession.refresh_counter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the authentication schema by introducing a new
apikeytable to support API key management, along with an associated notification trigger. It also removes the previously used session refresh column migration logic. The most important changes are:API Key Management:
apikeytable (auth.apikey) with fields forhash,user,name,created_at,modified_at, andexpires_atto support storing and managing API keys. (auth/schema/objects.sql, auth/schema/objects.sqlL44-R59)usercolumn of the newapikeytable to optimize lookups by user. (auth/schema/objects.sql, auth/schema/objects.sqlL44-R59)Notification Triggers:
apikey_table_changes_notify) on theapikeytable to notify on insert, update, or delete operations, ensuring that changes to API keys are tracked and can be responded to by other parts of the system. (auth/schema/objects.sql, auth/schema/objects.sqlR140-R148)Session Table Migration Cleanup:
refresh_expires_atandrefresh_countercolumns in thesessiontable, indicating these columns are now assumed to be present in the base schema. (auth/schema/objects.sql, auth/schema/objects.sqlL44-R59)