rename_sql_object
MCP tools › Databases
Rename a table, view, column, index, routine, sequence or constraint: returns the statement in the connection's dialect and edits for every SQL reference in the given text or the project's .sql files. Files outside the project are listed as outside_project (changed only via include_outside); other-connection files and ambiguous places are listed, never changed. By default nothing runs or is written (needs read-schema); apply true runs the statement (needs modify-schema, refused on read-only connections) and writes the edits only if it succeeded. transaction says whether DDL rolls back; otherwise failed derived renames land in derived_errors. inverse_ddl (never run) undoes it.
Its results carry text from files, database: the client is told to treat that as data, never as instructions.
| Capability | database.rename_sql_object |
|---|---|
| Area | Databases |
| Access | changes files, database |
| Reaches | database, network |
| Rights | ssh, write, database-permission, trusted-project |
| Dry run | apply, on unless the call turns it off |
Arguments
| Argument | Type | Description |
|---|---|---|
connectionrequired | string | Connection name from list_connections. |
table | string | Table or view to rename, or whose column to rename (not needed for index or routine).default "" |
column | string | Column to rename (default: rename the table). |
index | string | Index to rename instead (SPEC-0164). |
routine | string | Function or procedure to rename instead (SPEC-0164). |
sequence | string | Sequence to rename instead (SPEC-0164 v3). |
constraint | string | Named constraint of table to rename instead (SPEC-0164 v3). |
new_namerequired | string | New name. |
sql | string | SQL text to rewrite (default: all .sql files of the workspace). |
apply | boolean | Run the ALTER TABLE statement and then write the workspace's .sql files (default false;
needs the modify-schema permission; not with sql). |
include_other_dialects | boolean | With apply: also change files of another dialect (default false; SPEC-0019 v2). |
rename_derived | boolean | With apply: also rename the offered constraints and indexes whose names embed the old
name (default true; SPEC-0019 v2). |
include_outside | array of integer | With apply: indexes into outside_project of the preview to change too: .sql files
that are not the project's own sources (a virtual environment, build output, excluded or
ignored files). None by default; a file of another dialect also needs
include_other_dialects (SPEC-0019 v4 behaviour 12). |
Call it from a shell
ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.
ferris-idea call ~/my-project rename_sql_object '{"connection":"<string>","new_name":"<string>"}'Input schema as JSON
{ "type": "object", "required": [ "connection", "new_name" ], "properties": { "connection": { "description": "Connection name from `list_connections`.", "type": "string" }, "table": { "description": "Table or view to rename, or whose column to rename (not needed for `index` or `routine`).", "type": "string", "default": "" }, "column": { "description": "Column to rename (default: rename the table).", "type": [ "string", "null" ] }, "index": { "description": "Index to rename instead (SPEC-0164).", "type": [ "string", "null" ] }, "routine": { "description": "Function or procedure to rename instead (SPEC-0164).", "type": [ "string", "null" ] }, "sequence": { "description": "Sequence to rename instead (SPEC-0164 v3).", "type": [ "string", "null" ] }, "constraint": { "description": "Named constraint of `table` to rename instead (SPEC-0164 v3).", "type": [ "string", "null" ] }, "new_name": { "description": "New name.", "type": "string" }, "sql": { "description": "SQL text to rewrite (default: all `.sql` files of the workspace).", "type": [ "string", "null" ] }, "apply": { "description": "Run the ALTER TABLE statement and then write the workspace's `.sql` files (default false;\nneeds the `modify-schema` permission; not with `sql`).", "type": [ "boolean", "null" ] }, "include_other_dialects": { "description": "With `apply`: also change files of another dialect (default false; SPEC-0019 v2).", "type": [ "boolean", "null" ] }, "rename_derived": { "description": "With `apply`: also rename the offered constraints and indexes whose names embed the old\nname (default true; SPEC-0019 v2).", "type": [ "boolean", "null" ] }, "include_outside": { "description": "With `apply`: indexes into `outside_project` of the preview to change too: `.sql` files\nthat are not the project's own sources (a virtual environment, build output, excluded or\nignored files). None by default; a file of another dialect also needs\n`include_other_dialects` (SPEC-0019 v4 behaviour 12).", "type": [ "array", "null" ], "items": { "type": "integer", "minimum": 0 } } }}