{
  "id": 8048490,
  "title": "Why SQLite refuses your ALTER TABLE, and the twelve-step rebuild it wants instead",
  "url": "https://urgent.news/2026/09/17/why-sqlite-refuses-your-alter-table-and-the-twelve-step-rebuild-it",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-17T15:30:04.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bolvrk/why-sqlite-refuses-your-alter-table-and-the-twelve-step-rebuild-it-wants-instead-31eh"
  },
  "original_language": "en",
  "account": "SQLite's ALTER TABLE functionality is limited compared to other database systems. It allows renaming tables and columns, adding new columns with certain restrictions, and dropping columns but with additional limitations. There are no ALTER COLUMN, changing types, adding or dropping constraints, or adding primary keys to existing tables. The add-column restrictions require a constant default value and cannot include NOT NULL, UNIQUE, or a timestamp default. Dropping a column with an index, constraint, or view is also not permitted. The recommended solution for complex migrations is a twelve-step rebuild process involving creating a new table with the desired schema, copying data, dropping the old table, and renaming the new one. This process ensures data integrity and avoids potential issues with foreign keys, indexes, triggers, and views. The SQLite documentation provides a twelve-step rebuild procedure for migrations that ALTER TABLE cannot accomplish.",
  "summary": "Coming from Postgres, SQLite's ALTER TABLE feels broken. It is not. It is small on purpose, and the rules for what it refuses are consistent once you know them. The trouble is that the refusals happen at run time, and a migration that fails at run time fails in production too. What ALTER TABLE can do Rename a table. Rename a column. Add a column, with restrictions. Drop a column, since 3.35, with…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}