Atlas now detects renames declaratively. Add renamed_from to a table, column, or index in HCL, or an -- atlas:renamed_from directive in SQL, and Atlas plans ALTER ... RENAME statements instead of DROP + CREATE. The interactive rename prompt is a human-only contract: agents cannot answer it. Making the intent part of the schema removes that blocker.
Atlas has historically detected renames at plan time by prompting interactively to confirm whether a removed object matched a newly added one. That contract is human-only: an autonomous agent running plan/apply non-interactively has no way to answer the prompt, so a renamed table or column falls back to DROP + CREATE and the data is lost.
The new renamed_from attribute makes the intent declarative. It lives next to the renamed resource, is reviewable in pull requests, and is resolved without prompts. The planner emits driver-native ALTER ... RENAME statements that preserve data.
HCL: renamed_from on Tables, Columns, and Indexes
Add renamed_from to the new resource and set it to the previous name. The same attribute works on tables, columns, and indexes:
table "accounts" {renamed_from = "users"column "email_address" {type = varchar(200)renamed_from = "email"}index "idx_email_new" {columns = [column.email_address]renamed_from = "idx_email"}}
SQL: the -- atlas:renamed_from Directive
In SQL schemas, add an -- atlas:renamed_from <prev> comment above the object. The directive can be statement-level (above a CREATE TABLE or CREATE INDEX) or inline (above a column or named-index line inside a CREATE TABLE body):
-- atlas:renamed_from usersCREATE TABLE accounts (id bigint NOT NULL,-- atlas:renamed_from emailemail_address varchar(200) NOT NULL,PRIMARY KEY (id));-- atlas:renamed_from idx_emailCREATE INDEX idx_email_new ON accounts (email_address);
What Atlas Emits
The planner produces driver-native rename statements rather than DROP + CREATE. Below are examples for the same set of renames (rename a column with a type change, rename a table, rename a column, rename an index) on MySQL and PostgreSQL:
-- Modify "posts" tableALTER TABLE `posts` CHANGE COLUMN `title` `headline` text NOT NULL;-- Rename a table from "users" to "accounts"RENAME TABLE `users` TO `accounts`;-- Modify "accounts" tableALTER TABLE `accounts` RENAME COLUMN `name` TO `first_name`, CHANGE COLUMN `email` `email_address` varchar(200) NOT NULL, RENAME INDEX `idx_email` TO `idx_email_new`;
On MySQL, when a single column has both a rename and a type change Atlas coalesces them into one CHANGE COLUMN <old> <new> <new-type> clause atomically (see the accounts.email column above). Multiple alterations to the same table are merged into a single ALTER TABLE statement.
-- Rename a column from "title" to "headline"ALTER TABLE "posts" RENAME COLUMN "title" TO "headline";-- Modify "posts" tableALTER TABLE "posts" ALTER COLUMN "headline" TYPE text;-- Rename a table from "users" to "accounts"ALTER TABLE "users" RENAME TO "accounts";-- Rename a column from "email" to "email_address"ALTER TABLE "accounts" RENAME COLUMN "email" TO "email_address";-- Rename a constraint from "users_pkey" to "accounts_pkey"ALTER TABLE "accounts" RENAME CONSTRAINT "users_pkey" TO "accounts_pkey";-- Rename an index from "idx_email" to "idx_email_new"ALTER INDEX "idx_email" RENAME TO "idx_email_new";
On PostgreSQL, every rename is its own statement (RENAME COLUMN, RENAME TO, RENAME CONSTRAINT, ALTER INDEX ... RENAME TO) and primary-key constraint renames are issued automatically alongside their table rename (see users_pkey → accounts_pkey above).
Why It Matters for Agents
Schema changes proposed by an agent now flow through the same review path as any other code change: the agent edits the schema (HCL or SQL), commits the diff (including renamed_from), and Atlas plans the migration without asking a human to disambiguate at the terminal. The contract between agent and planner is now entirely textual, which is what every other part of an agent-driven CI pipeline already expects.