feat: hard-delete instead of soft-delete; rename app/account secret tables#8
Merged
Conversation
…ables Drop DeletedAt from Account/Application/AppSecret/Secret and switch all deletes to actual row removals (gorm `Delete`). Cascade Account->Secret deletes in a transaction the same way Application->AppSecret already does. Rename the secret tables for consistency with their owner: vault_secret -> vault_account_secret, vault_app_secret -> vault_application_secret. Tables that already match the convention (vault_account, vault_application) are unchanged. Pre-deploy SQL migration is in the PR body.
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.
DeletedAtfromAccount,Application,AppSecret,SecretUpdates({deleted_at: now})) to actualgorm.DeleteAND deleted_at IS NULLfilter (no longer meaningful)Account→ childSecretrows in a transaction (mirrors the existingApplication→AppSecretcascade)entityIDargs fromDeleteAccount(WithAudit)/DeleteApplication/DeleteAppSecret/DeleteSecret(the audit-log struct already carries actor info)idx_application_name_live,idx_app_secret_application_key_live— only enforced wheredeleted_at IS NULL) to plainuniqueIndex— this is what unblocks re-creating something with the same namevault_secret→vault_account_secret,vault_app_secret→vault_application_secret.vault_account+vault_applicationalready match the conventionPre-deploy SQL migration
Run against
gr-postgres.gauchoracing.com/ dbvaultBEFORE rolling out the new image, otherwise AutoMigrate will create emptyvault_account_secret/vault_application_secrettables and leave the live data orphaned in the old names.After this,
AutoMigrateon the next deploy adds the newuniqueIndexonvault_application(name)andvault_application_secret(application_id, key).