Skip to content

Commit

Permalink
gemini: Avoid DDL operations for a table with MV (#235)
Browse files Browse the repository at this point in the history
Scylla does not allow dropping a column that is part of a materialized
view. Let's avoid doing DDL operations altogether for such cases to be
safe.

Fixes #230
  • Loading branch information
penberg authored Apr 16, 2020
1 parent 35101f9 commit 035ddb9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/gemini/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func ddl(ctx context.Context, schema *gemini.Schema, sc *gemini.SchemaConfig, ta
return
}
table.Lock()
if len(table.MaterializedViews) > 0 {
// Scylla does not allow changing the DDL of a table with materialized views.
return
}
defer table.Unlock()
ddlStmts, postStmtHook, err := schema.GenDDLStmt(table, r, p, sc)
if err != nil {
Expand Down

0 comments on commit 035ddb9

Please sign in to comment.