PersonalAccessTokens can have associated projects
We're extending access tokens so they can be restricted to individual projects for #20993.
What does this MR do?
TokenResource model to personal access tokens can be linked to projects in the database, and allows these to be set from the controller.
What this MR doesn't do
This MR doesn't enforce the per project restriction/scoping. This functionality is being prototyped in gitlab-ee!6235 and will have it's own MR.
The frontend for this feature will also be in a separate MR and has it's own issue in #47865
Why the separate MR?
Smaller MRs and better iteration
By splitting out db/model changes here we can have an isolated review and merge to master early so we don't keep having to rebase later. This will also allow the frontend development to take place off of master, and if we choose to place the frontend behind a feature flag we'll be able to merge and iterate without needed the feature to be perfected first.
When adding migrations:
downmethod so the migration can be reverted
- Added the output of the migration(s) to the MR body
When adding tables:
- Ordered columns based on the Ordering Table Columns guidelines
- Added foreign keys to any columns pointing to data in other tables
- Added indexes for fields that are used in statements such as WHERE, ORDER BY, GROUP BY, and JOINs
== 20180622054732 CreateTokenResources: migrating ============================= -- create_table(:token_resources) -> 0.0201s == 20180622054732 CreateTokenResources: migrated (0.0203s) ====================
- Changelog entry added, if necessary
- Documentation created/updated
- API support added
- Tests added for this feature/bug
- Conform by the code review guidelines
- Has been reviewed by a Backend maintainer
- Has been reviewed by a Database specialist
- Internationalization required/considered
End-to-end tests pass (
package-and-qamanual pipeline job)