Skip to content

Commit e4cae93

Browse files
committed
materialize-*: update column migration to process in batches
1 parent 3e809f9 commit e4cae93

File tree

16 files changed

+159
-188
lines changed

16 files changed

+159
-188
lines changed

materialize-bigquery/.snapshots/TestValidateAndApplyMigrations

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Base Initial Constraints:
77
{"Field":"flow_published_at","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
88
{"Field":"int64","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
99
{"Field":"intWidenedToJson","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
10-
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"All Locations that are part of the collections key are required"}
10+
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"The first collection key component is required to be included for standard updates"}
1111
{"Field":"multiple","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"This field is able to be materialized"}
1212
{"Field":"nonScalarValue","Type":4,"TypeString":"FIELD_OPTIONAL","Reason":"Object fields may be materialized"}
1313
{"Field":"nullValue","Type":5,"TypeString":"FIELD_FORBIDDEN","Reason":"Cannot materialize a field where the only possible type is 'null'"}

materialize-bigquery/client.go

+10-40
Original file line numberDiff line numberDiff line change
@@ -126,44 +126,16 @@ func (c *client) DeleteTable(ctx context.Context, path []string) (string, boiler
126126
}
127127

128128
var columnMigrationSteps = []sql.ColumnMigrationStep{
129-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, tempColumnIdentifier string) (string, error) {
130-
return fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s %s;",
131-
table.Identifier,
132-
tempColumnIdentifier,
133-
// Always create these new columns as nullable
134-
migration.NullableDDL,
135-
), nil
136-
},
137-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, tempColumnIdentifier string) (string, error) {
138-
return fmt.Sprintf(
139-
// The WHERE filter is required by some warehouses (bigquery)
140-
"UPDATE %s SET %s = %s WHERE true;",
141-
table.Identifier,
142-
tempColumnIdentifier,
143-
migration.CastSQL(migration),
144-
), nil
145-
},
146-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, _ string) (string, error) {
147-
return fmt.Sprintf(
148-
"ALTER TABLE %s DROP COLUMN %s;",
149-
table.Identifier,
150-
migration.Identifier,
151-
), nil
152-
},
153-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, tempColumnIdentifier string) (string, error) {
154-
return fmt.Sprintf(
155-
"ALTER TABLE %s RENAME COLUMN %s TO %s;",
156-
table.Identifier,
157-
tempColumnIdentifier,
158-
migration.Identifier,
159-
), nil
160-
},
161-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, _ string) (string, error) {
129+
sql.StdMigrationSteps[0],
130+
sql.StdMigrationSteps[1],
131+
sql.StdMigrationSteps[2],
132+
sql.StdMigrationSteps[3],
133+
func(dialect sql.Dialect, table sql.Table, instructions ...sql.MigrationInstruction) ([]string, error) {
162134
// BigQuery does not support making a column REQUIRED when it is NULLABLE
163135
// TODO: do we prefer to backfill in these instances for BigQuery, or just continue
164136
// with this no-op as-is?
165137

166-
return "", nil
138+
return []string{}, nil
167139
},
168140
}
169141

@@ -186,12 +158,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
186158
}
187159

188160
if len(ta.ColumnTypeChanges) > 0 {
189-
for _, m := range ta.ColumnTypeChanges {
190-
if steps, err := sql.StdColumnTypeMigration(ctx, c.ep.Dialect, ta.Table, m, columnMigrationSteps...); err != nil {
191-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
192-
} else {
193-
stmts = append(stmts, steps...)
194-
}
161+
if steps, err := sql.StdColumnTypeMigrations(ctx, c.ep.Dialect, ta.Table, ta.ColumnTypeChanges, columnMigrationSteps...); err != nil {
162+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
163+
} else {
164+
stmts = append(stmts, steps...)
195165
}
196166
}
197167

materialize-cratedb/client.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
153153
}
154154

155155
if len(ta.ColumnTypeChanges) > 0 {
156-
for _, m := range ta.ColumnTypeChanges {
157-
if steps, err := sql.StdColumnTypeMigration(ctx, crateDialect, ta.Table, m); err != nil {
158-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
159-
} else {
160-
stmts = append(stmts, steps...)
161-
}
156+
if steps, err := sql.StdColumnTypeMigrations(ctx, crateDialect, ta.Table, ta.ColumnTypeChanges); err != nil {
157+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
158+
} else {
159+
stmts = append(stmts, steps...)
162160
}
163161
}
164162

materialize-databricks/.snapshots/TestValidateAndApplyMigrations

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Base Initial Constraints:
77
{"Field":"flow_published_at","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
88
{"Field":"int64","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
99
{"Field":"intWidenedToJson","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
10-
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"All Locations that are part of the collections key are required"}
10+
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"The first collection key component is required to be included for standard updates"}
1111
{"Field":"multiple","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"This field is able to be materialized"}
1212
{"Field":"nonScalarValue","Type":4,"TypeString":"FIELD_OPTIONAL","Reason":"Object fields may be materialized"}
1313
{"Field":"nullValue","Type":5,"TypeString":"FIELD_FORBIDDEN","Reason":"Cannot materialize a field where the only possible type is 'null'"}

materialize-databricks/client.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
158158
}
159159

160160
if len(ta.ColumnTypeChanges) > 0 {
161-
for _, m := range ta.ColumnTypeChanges {
162-
if steps, err := sql.StdColumnTypeMigration(ctx, c.ep.Dialect, ta.Table, m); err != nil {
163-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
164-
} else {
165-
stmts = append(stmts, steps...)
166-
}
161+
if steps, err := sql.StdColumnTypeMigrations(ctx, c.ep.Dialect, ta.Table, ta.ColumnTypeChanges); err != nil {
162+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
163+
} else {
164+
stmts = append(stmts, steps...)
167165
}
168166
}
169167

materialize-motherduck/client.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
8383
}
8484

8585
if len(ta.ColumnTypeChanges) > 0 {
86-
for _, m := range ta.ColumnTypeChanges {
87-
if steps, err := sql.StdColumnTypeMigration(ctx, c.ep.Dialect, ta.Table, m); err != nil {
88-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
89-
} else {
90-
stmts = append(stmts, steps...)
91-
}
86+
if steps, err := sql.StdColumnTypeMigrations(ctx, c.ep.Dialect, ta.Table, ta.ColumnTypeChanges); err != nil {
87+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
88+
} else {
89+
stmts = append(stmts, steps...)
9290
}
9391
}
9492

materialize-mysql/.snapshots/TestValidateAndApplyMigrations

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Base Initial Constraints:
77
{"Field":"flow_published_at","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
88
{"Field":"int64","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
99
{"Field":"intWidenedToJson","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
10-
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"All Locations that are part of the collections key are required"}
10+
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"The first collection key component is required to be included for standard updates"}
1111
{"Field":"multiple","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"This field is able to be materialized"}
1212
{"Field":"nonScalarValue","Type":4,"TypeString":"FIELD_OPTIONAL","Reason":"Object fields may be materialized"}
1313
{"Field":"nullValue","Type":5,"TypeString":"FIELD_FORBIDDEN","Reason":"Cannot materialize a field where the only possible type is 'null'"}

materialize-mysql/.snapshots/TestValidateAndApplyMigrationsMariaDB

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Base Initial Constraints:
77
{"Field":"flow_published_at","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
88
{"Field":"int64","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
99
{"Field":"intWidenedToJson","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
10-
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"All Locations that are part of the collections key are required"}
10+
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"The first collection key component is required to be included for standard updates"}
1111
{"Field":"multiple","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"This field is able to be materialized"}
1212
{"Field":"nonScalarValue","Type":4,"TypeString":"FIELD_OPTIONAL","Reason":"Object fields may be materialized"}
1313
{"Field":"nullValue","Type":5,"TypeString":"FIELD_FORBIDDEN","Reason":"Cannot materialize a field where the only possible type is 'null'"}
@@ -71,7 +71,7 @@ Migratable Changes Applied Schema:
7171
{"Name":"datetimeValue","Nullable":"YES","Type":"longtext"}
7272
{"Name":"flow_document","Nullable":"NO","Type":"longtext"}
7373
{"Name":"flow_published_at","Nullable":"NO","Type":"datetime"}
74-
{"Name":"int64","Nullable":"YES","Type":"bigint"}
74+
{"Name":"int64","Nullable":"YES","Type":"decimal"}
7575
{"Name":"intWidenedToJson","Nullable":"YES","Type":"longtext"}
7676
{"Name":"key","Nullable":"NO","Type":"varchar"}
7777
{"Name":"multiple","Nullable":"YES","Type":"longtext"}
@@ -85,6 +85,6 @@ Migratable Changes Applied Schema:
8585

8686

8787
Migratable Changes Applied Data:
88-
key (VARCHAR), _meta/flow_truncated (TINYINT), boolWidenedToJson (TINYINT), flow_published_at (DATETIME), int64 (BIGINT), multiple (TEXT), nonScalarValue (TEXT), optional (TEXT), scalarValue (TEXT), stringWidenedToJson (TEXT), flow_document (TEXT), dateValue (TEXT), datetimeValue (TEXT), intWidenedToJson (TEXT), numericString (TEXT), requiredNumeric (TEXT), timeValue (TEXT)
89-
1, 0, 1, 2024-09-13 01:01:01.000000, 1, <nil>, <nil>, <nil>, test, hello, {}, 2024-01-01, 2024-01-01T01:01:01.111111Z, 999, 123, 456, 01:01:01.000000
88+
key (VARCHAR), _meta/flow_truncated (TINYINT), boolWidenedToJson (TINYINT), flow_published_at (DATETIME), multiple (TEXT), nonScalarValue (TEXT), optional (TEXT), scalarValue (TEXT), stringWidenedToJson (TEXT), flow_document (TEXT), dateValue (TEXT), datetimeValue (TEXT), int64 (DECIMAL), intWidenedToJson (TEXT), numericString (TEXT), requiredNumeric (TEXT), timeValue (TEXT)
89+
1, 0, 1, 2024-09-13 01:01:01.000000, <nil>, <nil>, <nil>, test, hello, {}, 2024-01-01, 2024-01-01T01:01:01.111111Z, 1, 999, 123, 456, 01:01:01.000000
9090

materialize-mysql/client.go

+38-46
Original file line numberDiff line numberDiff line change
@@ -103,49 +103,43 @@ func (c *client) InfoSchema(ctx context.Context, resourcePaths [][]string) (is *
103103
}
104104

105105
var migrationSteps = []sql.ColumnMigrationStep{
106-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, tempColumnIdentifier string) (string, error) {
107-
return fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s %s;",
108-
table.Identifier,
109-
tempColumnIdentifier,
110-
migration.NullableDDL,
111-
), nil
112-
},
113-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, tempColumnIdentifier string) (string, error) {
114-
return fmt.Sprintf(
115-
"UPDATE %s SET %s = %s;",
116-
table.Identifier,
117-
tempColumnIdentifier,
118-
migration.CastSQL(migration),
119-
), nil
120-
},
121-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, _ string) (string, error) {
122-
return fmt.Sprintf(
123-
"ALTER TABLE %s DROP COLUMN %s;",
124-
table.Identifier,
125-
migration.Identifier,
126-
), nil
127-
},
128-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, tempColumnIdentifier string) (string, error) {
129-
return fmt.Sprintf(
130-
"ALTER TABLE %s CHANGE COLUMN %s %s %s;",
131-
table.Identifier,
132-
tempColumnIdentifier,
133-
migration.Identifier,
134-
migration.DDL,
135-
), nil
106+
sql.StdMigrationSteps[0],
107+
sql.StdMigrationSteps[1],
108+
sql.StdMigrationSteps[2],
109+
func(dialect sql.Dialect, table sql.Table, instructions ...sql.MigrationInstruction) ([]string, error) {
110+
var queries []string
111+
for _, ins := range instructions {
112+
queries = append(
113+
queries,
114+
fmt.Sprintf(
115+
"ALTER TABLE %s CHANGE COLUMN %s %s %s;",
116+
table.Identifier,
117+
ins.TempColumnIdentifier,
118+
ins.TypeMigration.Identifier,
119+
ins.TypeMigration.DDL,
120+
),
121+
)
122+
}
123+
124+
return queries, nil
136125
},
137-
func(dialect sql.Dialect, table sql.Table, migration sql.ColumnTypeMigration, _ string) (string, error) {
138-
// If column was originally not nullable, we fix its DDL
139-
if migration.NullableDDL == migration.DDL {
140-
return "", nil
126+
func(dialect sql.Dialect, table sql.Table, instructions ...sql.MigrationInstruction) ([]string, error) {
127+
var queries []string
128+
129+
for _, ins := range instructions {
130+
if ins.TypeMigration.NullableDDL != ins.TypeMigration.DDL {
131+
queries = append(
132+
queries,
133+
fmt.Sprintf("ALTER TABLE %s MODIFY %s %s;",
134+
table.Identifier,
135+
ins.TypeMigration.Identifier,
136+
ins.TypeMigration.DDL,
137+
),
138+
)
139+
}
141140
}
142141

143-
return fmt.Sprintf(
144-
"ALTER TABLE %s MODIFY %s %s;",
145-
table.Identifier,
146-
migration.Identifier,
147-
migration.DDL,
148-
), nil
142+
return queries, nil
149143
},
150144
}
151145

@@ -205,12 +199,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
205199
}
206200

207201
if len(ta.ColumnTypeChanges) > 0 {
208-
for _, m := range ta.ColumnTypeChanges {
209-
if steps, err := sql.StdColumnTypeMigration(ctx, c.ep.Dialect, ta.Table, m, migrationSteps...); err != nil {
210-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
211-
} else {
212-
stmts = append(stmts, steps...)
213-
}
202+
if steps, err := sql.StdColumnTypeMigrations(ctx, c.ep.Dialect, ta.Table, ta.ColumnTypeChanges, migrationSteps...); err != nil {
203+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
204+
} else {
205+
stmts = append(stmts, steps...)
214206
}
215207
}
216208

materialize-postgres/.snapshots/TestValidateAndApplyMigrations

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Base Initial Constraints:
77
{"Field":"flow_published_at","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
88
{"Field":"int64","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
99
{"Field":"intWidenedToJson","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
10-
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"All Locations that are part of the collections key are required"}
10+
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"The first collection key component is required to be included for standard updates"}
1111
{"Field":"multiple","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"This field is able to be materialized"}
1212
{"Field":"nonScalarValue","Type":4,"TypeString":"FIELD_OPTIONAL","Reason":"Object fields may be materialized"}
1313
{"Field":"nullValue","Type":5,"TypeString":"FIELD_FORBIDDEN","Reason":"Cannot materialize a field where the only possible type is 'null'"}

materialize-postgres/client.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
148148
}
149149

150150
if len(ta.ColumnTypeChanges) > 0 {
151-
for _, m := range ta.ColumnTypeChanges {
152-
if steps, err := sql.StdColumnTypeMigration(ctx, pgDialect, ta.Table, m); err != nil {
153-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
154-
} else {
155-
stmts = append(stmts, steps...)
156-
}
151+
if steps, err := sql.StdColumnTypeMigrations(ctx, pgDialect, ta.Table, ta.ColumnTypeChanges); err != nil {
152+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
153+
} else {
154+
stmts = append(stmts, steps...)
157155
}
158156
}
159157

materialize-redshift/client.go

+8-10
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
8585
return "", nil, fmt.Errorf("redshift cannot drop nullability constraints but got %d DropNotNulls for table %s", len(ta.DropNotNulls), ta.Identifier)
8686
}
8787

88-
statements := []string{}
88+
stmts := []string{}
8989
for _, c := range ta.AddColumns {
90-
statements = append(statements, fmt.Sprintf(
90+
stmts = append(stmts, fmt.Sprintf(
9191
"ALTER TABLE %s ADD COLUMN %s %s;",
9292
ta.Identifier,
9393
c.Identifier,
@@ -96,17 +96,15 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
9696
}
9797

9898
if len(ta.ColumnTypeChanges) > 0 {
99-
for _, m := range ta.ColumnTypeChanges {
100-
if steps, err := sql.StdColumnTypeMigration(ctx, c.ep.Dialect, ta.Table, m); err != nil {
101-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
102-
} else {
103-
statements = append(statements, steps...)
104-
}
99+
if steps, err := sql.StdColumnTypeMigrations(ctx, c.ep.Dialect, ta.Table, ta.ColumnTypeChanges); err != nil {
100+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
101+
} else {
102+
stmts = append(stmts, steps...)
105103
}
106104
}
107105

108-
return strings.Join(statements, "\n"), func(ctx context.Context) error {
109-
for _, stmt := range statements {
106+
return strings.Join(stmts, "\n"), func(ctx context.Context) error {
107+
for _, stmt := range stmts {
110108
_, err := c.db.ExecContext(ctx, stmt)
111109
if err != nil {
112110
return err

materialize-snowflake/.snapshots/TestValidateAndApplyMigrations

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Base Initial Constraints:
77
{"Field":"flow_published_at","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
88
{"Field":"int64","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
99
{"Field":"intWidenedToJson","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"The projection has a single scalar type"}
10-
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"All Locations that are part of the collections key are required"}
10+
{"Field":"key","Type":2,"TypeString":"LOCATION_REQUIRED","Reason":"The first collection key component is required to be included for standard updates"}
1111
{"Field":"multiple","Type":3,"TypeString":"LOCATION_RECOMMENDED","Reason":"This field is able to be materialized"}
1212
{"Field":"nonScalarValue","Type":4,"TypeString":"FIELD_OPTIONAL","Reason":"Object fields may be materialized"}
1313
{"Field":"nullValue","Type":5,"TypeString":"FIELD_FORBIDDEN","Reason":"Cannot materialize a field where the only possible type is 'null'"}

materialize-snowflake/client.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
9797
}
9898

9999
if len(ta.ColumnTypeChanges) > 0 {
100-
for _, m := range ta.ColumnTypeChanges {
101-
if steps, err := sql.StdColumnTypeMigration(ctx, c.ep.Dialect, ta.Table, m); err != nil {
102-
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
103-
} else {
104-
stmts = append(stmts, steps...)
105-
}
100+
if steps, err := sql.StdColumnTypeMigrations(ctx, c.ep.Dialect, ta.Table, ta.ColumnTypeChanges); err != nil {
101+
return "", nil, fmt.Errorf("rendering column migration steps: %w", err)
102+
} else {
103+
stmts = append(stmts, steps...)
106104
}
107105
}
108106

0 commit comments

Comments
 (0)