- bun: scanonly+generated for GENERATED columns; scanonly+identity for ALWAYS identity (PK gets identity only) - gorm: <-:false+generated / identity, same primary key rule - dbml: write GENERATED/IDENTITY column notes and read them back into the model - pgsql: emit generation/identity clauses in migration create-table and add-column, no DEFAULT - readmes updated
6 lines
371 B
Cheetah
6 lines
371 B
Cheetah
ALTER TABLE {{qual_table .SchemaName .TableName}}
|
|
ADD COLUMN IF NOT EXISTS {{quote_ident .ColumnName}} {{.ColumnType}}
|
|
{{- if .Generated}} GENERATED ALWAYS AS ({{.Generated}}) STORED{{end}}
|
|
{{- if .Identity}} GENERATED {{.Identity}} AS IDENTITY{{end}}
|
|
{{- if and .Default (not .Generated) (not .Identity)}} DEFAULT {{.Default}}{{end}}
|
|
{{- if .NotNull}} NOT NULL{{end}}; |