feat: mark generated and identity columns across writers and DBML

- 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
This commit is contained in:
2026-10-02 22:58:00 +02:00
parent 275424c605
commit bbab5ce936
21 changed files with 516 additions and 5 deletions
+3
View File
@@ -442,6 +442,7 @@ func (w *MigrationWriter) generateAlterTableScripts(schema *models.Schema, model
if !exists {
// Column doesn't exist, add it
_, defaultVal := formatColumnDefaultSQL(modelCol)
generated, identity := columnGenerationClauses(modelCol)
sql, err := w.executor.ExecuteAddColumn(AddColumnData{
SchemaName: schema.Name,
@@ -450,6 +451,8 @@ func (w *MigrationWriter) generateAlterTableScripts(schema *models.Schema, model
ColumnType: effectiveColumnSQLType(modelCol),
Default: defaultVal,
NotNull: modelCol.NotNull,
Generated: generated,
Identity: identity,
})
if err != nil {
return nil, err