Skip to content
Back to skills

Rename Sql Table

ASecurity

TRIGGER when user asks to rename the database table used by a SQL CRUD microservice. Creates a SQL migration and updates all table references.

  • 172 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
databasesgosqldatabase

Security analysis

A100/100

Scanned June 6, 2026

npx -y skills add microbus-io/fabric --skill rename-sql-table --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rename Sql Table?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rename Sql Table
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/microbus-io-rename-sql-table/badge)](https://www.skillsdirectory.com/skills/microbus-io-rename-sql-table)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rename-sql-table
description: TRIGGER when user asks to rename the database table used by a SQL CRUD microservice. Creates a SQL migration and updates all table references.
---

**CRITICAL**: Read and analyze this microservice before starting. Do NOT explore or analyze other microservices unless explicitly instructed to do so. The instructions in this skill are self-contained to this microservice.

**IMPORTANT**: `old_table_name` and `new_table_name` are placeholders for the actual old and new table names.

## Workflow

Copy this checklist and track your progress:

```
Renaming the database table:
- [ ] Step 1: Update Table Name Const
- [ ] Step 2: Update Database Schema
- [ ] Step 3: Housekeeping
```

#### Step 1: Update Table Name Const

Update the `tableName` const in `service.go` to the new table name. Do NOT change the `sequenceName`.

```go
const (
	tableName        = "new_table_name"
	sequenceName     = "old_table_name@0f7ce540" // Do not change
	// ...
)
```

#### Step 2: Update Database Schema

Create a new migration script file in `resources/sql` with an incremental file name. **IMPORTANT**: Do not edit an existing migration file.

```sql
-- DRIVER: mysql
RENAME TABLE old_table_name TO new_table_name;

-- DRIVER: pgx
ALTER TABLE old_table_name RENAME TO new_table_name;

-- DRIVER: mssql
EXEC sp_rename 'old_table_name', 'new_table_name';
```

Refer to the older `.sql` migration files to identify what if any indices were associated with the old table name. Append statements to the migration script to rename these indices, replacing the old table name with the new one.

```sql
-- DRIVER: mysql
ALTER TABLE new_table_name RENAME INDEX old_table_name_idx_field TO new_table_name_idx_field;

-- DRIVER: pgx
ALTER INDEX old_table_name_idx_field RENAME TO new_table_name_idx_field;

-- DRIVER: mssql
EXEC sp_rename 'old_table_name_idx_field', 'new_table_name_idx_field', 'INDEX';
```

#### Step 3: Housekeeping

Follow the `housekeeping` skill. Skip the manifest, topology and tidy up steps.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.