Skip to content

Renaming deploy_requests to deploy_approval_requests

During development of another one of our projects, we needed to rename deploy_requests to deploy_approval_requests to better reflect the feature’s purpose. This refactoring spanned:

  • 31 files across multiple languages (Go, TypeScript, SQL, JSON, Markdown)
  • 607 content matches across 14 different case styles
  • 12 file renames
  • Database migrations, API schemas, handlers, and frontend components

A manual find-and-replace would take a lot of work, requiring careful attention to:

  • PascalCase types like DeployRequestDeployApprovalRequest
  • camelCase functions like getAdminDeployRequestsgetAdminDeployApprovalRequests
  • kebab-case routes like deploy-requestsdeploy-approval-requests
  • Database table names and indexes
  • Singular and plural variants

With Renamify, this complex refactoring became a single command:

Terminal window
renamify rename --include-styles space-separated \
deploy_requests deploy_approval_requests \
--dry-run --preview summary

The preview showed exactly what would change:

[PLAN SUMMARY]
Search: deploy_requests
Replace: deploy_approval_requests
Matches: 607
Files: 31
Paths: 12

Renamify automatically detected and transformed variants across multiple case styles:

Case StyleExampleTransformed To
snake_casedeploy_requestsdeploy_approval_requests
kebab-casedeploy-requestsdeploy-approval-requests
camelCasedeployRequestdeployApprovalRequest
PascalCaseDeployRequestDeployApprovalRequest
Title CaseDeploy RequestDeploy Approval Request
Sentence casedeploy requestdeploy approval request
Train-CaseDeploy-RequestsDeploy-Approval-Requests
lower sentencedeploy requestdeploy approval request

Beyond simple standalone matches, Renamify intelligently found and renamed identifiers embedded within larger compound names:

In TypeScript filenames and types:

  • handlersCreateDeployRequestRequest.tshandlersCreateDeployApprovalRequestRequest.ts
  • GetAdminDeployRequestsParamsGetAdminDeployApprovalRequestsParams
  • PostAdminDeployRequestsIdApproveResultPostAdminDeployApprovalRequestsIdApproveResult

In function and method names:

  • ListDeployRequestsListDeployApprovalRequests
  • getAdminDeployRequestsgetAdminDeployApprovalRequests
  • postAdminDeployRequestsIdApprovepostAdminDeployApprovalRequestsIdApprove
  • postDeployRequestspostDeployApprovalRequests

In SQL index names:

  • idx_deploy_requests_activeidx_deploy_approval_requests_active
  • idx_deploy_requests_message_activeidx_deploy_approval_requests_message_active

This context-aware matching means Renamify detects the identifier pattern regardless of where it appears, even when it’s part of a much larger compound word. It automatically adjusts the case transformation to fit the surrounding context, preserving the structure of complex identifiers like postAdminDeployRequestsIdApprove while correctly inserting “Approval” in the right place.

API Handler (Go):

internal/gateway/handlers/deploy_requests.go
// 116 matches across multiple case styles:
// - Deploy request: 5
// - DeployRequest: 66
// - DeployRequests: 7
// - ListDeployRequests: 3
// - deploy request: 13
// - deploy-request: 15
// - deploy-requests: 6

Database Migration (SQL):

-- 20251101090000_add_deploy_requests.sql
-- Handles table names, indexes, and comments:
-- - deploy_requests (table name)
-- - idx_deploy_requests_active
-- - idx_deploy_requests_token
-- - "Deploy requests" (in comments)

Frontend Components (TypeScript):

web/src/api/generated.ts
// 47 matches including complex generated types:
// - GetAdminDeployRequestsParams
// - PostAdminDeployRequestsIdApproveResult
// - getAdminDeployRequests()
// - postAdminDeployRequestsIdReject()

File Renames:

internal/gateway/db/deploy_requests.go
→ internal/gateway/db/deploy_approval_requests.go
web/src/api/schemas/getAdminDeployRequestsParams.ts
→ web/src/api/schemas/getAdminDeployApprovalRequestsParams.ts
web/src/pages/deploy-requests-page.tsx
→ web/src/pages/deploy-approval-requests-page.tsx

After reviewing the dry-run output, we performed the rename:

Terminal window
renamify rename --include-styles space-separated \
deploy_requests deploy_approval_requests
✓ Applied 607 replacements across 31 files
✓ Renamed 12 items
Undo with: renamify undo b52d614ba6a0a9a2

The entire refactoring was:

  • Atomic: All changes applied together or rolled back if any failed
  • Accurate: Every variant correctly transformed across all case styles
  • Reversible: Complete undo capability with a single command
  • Fast: Completed in under a second

This type of refactoring is exactly where Renamify shines, touching database schemas, API handlers, frontend components, and documentation. Instead of manually hunting through dozens of files and worrying about missing edge cases, we had confidence that every variant was caught and correctly transformed.

Here’s a screenshot of the complete preview in the terminal:

Renamify table preview showing 607 replacements across 31 files with 35 variants