Skip to content

Commit

Permalink
Bugfix SQL 1.1 schema change (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxing1292 committed Oct 27, 2020
1 parent e92adc0 commit c87f156
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions schema/mysql/v57/temporal/versioned/v1.1/cluster_metadata.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ALTER TABLE cluster_metadata ADD data BLOB NOT NULL;
ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL;
ALTER TABLE cluster_metadata ADD version BIGINT DEFAULT 1 NOT NULL;
ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Proto3';
ALTER TABLE cluster_metadata ADD version BIGINT NOT NULL DEFAULT 1;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ALTER TABLE cluster_metadata ADD data BYTEA NOT NULL;
ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL;
ALTER TABLE cluster_metadata ADD version BIGINT DEFAULT 1 NOT NULL;
ALTER TABLE cluster_metadata ADD data BYTEA NOT NULL DEFAULT '';
ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Proto3';
ALTER TABLE cluster_metadata ADD version BIGINT NOT NULL DEFAULT 1;
6 changes: 3 additions & 3 deletions tools/common/schema/updatetask.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (task *UpdateTask) executeUpdates(currVer string, updates []changeSet) erro

for _, cs := range updates {

err := task.execCQLStmts(cs.version, cs.cqlStmts)
err := task.execStmts(cs.version, cs.cqlStmts)
if err != nil {
return err
}
Expand All @@ -144,13 +144,13 @@ func (task *UpdateTask) executeUpdates(currVer string, updates []changeSet) erro
return nil
}

func (task *UpdateTask) execCQLStmts(ver string, stmts []string) error {
func (task *UpdateTask) execStmts(ver string, stmts []string) error {
log.Printf("---- Executing updates for version %v ----\n", ver)
for _, stmt := range stmts {
log.Println(rmspaceRegex.ReplaceAllString(stmt, " "))
e := task.db.Exec(stmt)
if e != nil {
return fmt.Errorf("error executing CQL statement:%v", e)
return fmt.Errorf("error executing statement:%v", e)
}
}
log.Printf("---- Done ----\n")
Expand Down

0 comments on commit c87f156

Please sign in to comment.