postgres

D5.0

PostgreSQL generated columns are computed automatically from other columns. In Rails migrations, use `:virtual` with `stored: true`:

intermediateCreativity & Designcreativityclaude-skill
Get This Skill on GitHub

Overview


name: postgres description: Contains guides on how we use PostgreSQL. Use whenever working with PostgreSQL in any way.

Stored Generated Columns

PostgreSQL generated columns are computed automatically from other columns. In Rails migrations, use :virtual with stored: true:

add_column :orders, :total_cents, :virtual, type: :integer,
  as: "quantity * price_cents",
  stored: true
add_index :orders, :total_cents

The as: value is a PostgreSQL expression. These columns auto-update when source columns change.

Ready to use this skill?

Visit the original repository to get the full skill configuration and installation instructions.

View on GitHub

Related Skills