Skip to content

Conversation

@wxing1292
Copy link
Contributor

What changed?

  • Fix SQL schema 1.1 bug, adding default value if possible

Why?
Schema upgrade error out due to missing default value

How did you test it?
Manually create schema & start server in 1.0.0 then upgrade schema to 1.2.x and start server for both MySQL and PostgreSQL

Potential risks
N/A

Comment on lines +1 to +2
ALTER TABLE cluster_metadata ADD data BYTEA NOT NULL DEFAULT '';
ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Proto3';
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

@wxing1292 wxing1292 merged commit d70e7d6 into temporalio:master Oct 27, 2020
@wxing1292 wxing1292 deleted the bugfix-1.1-schema branch October 27, 2020 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants