Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/sql2pgroll/create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ func convertColumnDef(tableName string, col *pgq.ColumnDef) (*migrations.Column,
if foreignKey == nil {
return nil, nil
}
case pgq.ConstrType_CONSTR_GENERATED:
// Generated columns are not supported
return nil, nil
case pgq.ConstrType_CONSTR_IDENTITY:
// Identity columns are not supported
return nil, nil
}
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/sql2pgroll/create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ func TestUnconvertableCreateTableStatements(t *testing.T) {
"CREATE TABLE foo(a int CONSTRAINT foo_default DEFAULT 0)",
"CREATE TABLE foo(a int CONSTRAINT foo_null NULL)",
"CREATE TABLE foo(a int CONSTRAINT foo_notnull NOT NULL)",

// Generated columns are not supported
"CREATE TABLE foo(a int GENERATED ALWAYS AS (1) STORED)",
"CREATE TABLE foo(a int GENERATED ALWAYS AS IDENTITY)",
}

for _, sql := range tests {
Expand Down