Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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';
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @vitarb didn't add these defaults intentionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @vitarb didn't add these defaults intentionally.

without it, it will be broken during schema upgrade

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sequence to break (postgresql):

  1. checkout 1.0.0
  2. create DB & schema
  3. start server
  4. checkout 1.1 or 1.2
  5. upgrade schema -> break
2020/10/27 12:46:57 ---- Executing updates for version 1.1 ----
2020/10/27 12:46:57 ALTER TABLE cluster_metadata ADD data BYTEA NOT NULL;
2020/10/27 12:46:58 error executing CQL statement:pq: null value in column "data" violates not-null constraint

ALTER TABLE cluster_metadata ADD version BIGINT NOT NULL DEFAULT 1;
2 changes: 1 addition & 1 deletion tools/common/schema/updatetask.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (task *UpdateTask) execCQLStmts(ver string, stmts []string) error {
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