Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix SQL 1.1 schema change #907

Merged
merged 2 commits into from
Oct 27, 2020

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_encoding VARCHAR(16) NOT NULL DEFAULT 'Proto3';
Copy link
Member

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
wxing1292 added a commit to wxing1292/temporal that referenced this pull request Oct 27, 2020
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.

None yet

4 participants