Menu
Squawk LogoSquawk LogoSquawkDocsRules
PlaygroundQuick StartGitHub
Squawk LogoSquawk LogoSquawk
  • Docs
  • Rules
  • Playground
  • Quick Start
  • GitHub
  • General
    • Quick Start
    • Applying migrations safely
    • CLI
    • GitHub Integration
    • Web Frameworks
    • Postgres locks and further reading
    • Troubleshooting
  • Rules
    • Rules Overview
    • adding-field-with-default
    • adding-foreign-key-constraint
    • adding-not-nullable-field
    • adding-required-field
    • adding-serial-primary-key-field
    • ban-char-field
    • ban-concurrent-index-creation-in-transaction
    • ban-drop-column
    • ban-drop-database
    • ban-drop-not-null
    • ban-drop-table
    • changing-column-type
    • constraint-missing-not-valid
    • disallowed-unique-constraint
    • prefer-bigint-over-int
    • prefer-bigint-over-smallint
    • prefer-identity
    • prefer-robust-stmts
    • prefer-text-field
    • prefer-timestamptz
    • renaming-column
    • renaming-table
    • require-concurrent-index-creation
    • require-concurrent-index-deletion
    • transaction-nesting
    • ban-create-domain-with-constraint
    • ban-alter-domain-with-add-constraint
    • ban-truncate-cascade

renaming-column

problem#

Renaming a column may break existing clients.

solution#

There isn't an easy way to rename a column.

If you're using an ORM (object relational mapper), you can rename the field in your application level struct while leaving the column name unchanged.

A more complicated solution using a new column with triggers and backfill to sync the two columns may work.

Edit this page
Previous
« prefer-timestamptz
Next
renaming-table »
  • problem
  • solution

Docs

  • Quick Start
  • Rules

More

  • GitHub
  • Changelog
  • Help
Copyright © 2025 Squawk Authors.