Databases
Rename or remove a column without losing data
A simple rename can break the live app or wipe a column for good.
- What you get
- The change split into safe steps, each one deployable and reversible.
- Paste it into
- Your AI tool, in your project
The prompt
I want to make this database change: [describe it, for example rename a column or split a table]. Don't do it in one step. Plan it so the live app keeps working throughout: add the new structure, write to both old and new, copy existing data across, switch reads, and only then remove the old one in a later release. For each step give me the migration, the code change that goes with it, how to check it worked, and how to undo it. Tell me which step is the point of no return and what backup to take before it. Estimate how long the copy will take on my data and whether it locks the table.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in. Replace the parts in [brackets] with your own details first.
More in Databases
Let the database reject bad data
Duplicates, empty fields and orphaned rows creep in because only the form checks them.
Delete a user and everything they own
Someone asks you to delete their account, and their data is scattered across tables and services.
Fill your local app with realistic test data
Your local database is empty, so you test against production or three rows named “test”.
Design your tables before you build
The AI invents a new table every time you add a feature, and nothing lines up.