Add WorkspaceTokens model and table
Issue: Add workspace tokens table (#545068 - closed) • Chad Woolley • 18.1
What does this MR do and why?
Add WorkspaceTokens model and table.
Context - #522932 (comment 2500179163)
Add a new database table workspace_tokens on the lines of cluster_agent_tokens. There will be a 1:1 relationship between workspaces and workspace_tokens with cascade delete.
The fields of this table will be
- id
- created_at
- updated_at
- workspace_id (foreign key)
- token_encrypted
- project_id (sharding key, determined by workspaces's project_id)
When a workspace is stopped/terminated, the associated record in workspace_tokens will be deleted. The workspace_tokens will be created when the workspace is started. The docs/creation/deletion will be handled by a separate issue Handle creation/deletion of workspace tokens an... (#547320 - closed) • Chad Woolley • 18.2.
NOTE: Docs for this new token type at https://docs.gitlab.com/security/tokens (and other places listed in https://docs.gitlab.com/development/secure_coding_guidelines/#token-prefixes) will be added when logic is added to actually create the tokens, as part of Handle creation/deletion of workspace tokens an... (#547320 - closed) • Chad Woolley • 18.2
References
How to set up and validate locally
- Table is not used yet. Verify completeness of tests
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.