-
Notifications
You must be signed in to change notification settings - Fork 1
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
Change checkpoint's table DDL, set column measured_by_atum_agent to h… #319
Conversation
…ave NOT NULL constraint with DEFAULT FALSE #242 Made changes: 1. Changed the value of measured_by_atum_agent in Checkpoints DDL to NOT NULL. 2. Changed the value of measured_by_atum_agent in Checkpoints DDL to DEFAULT FALSE. 3. Changed the value of measured_by_atum_agent in Write Checkpoints to DEFAULT FALSE. 4. Changed the tests to accommodate this change, it has been tested successfully.
@@ -159,7 +159,7 @@ class WriteCheckpointIntegrationTests extends DBTestSuite { | |||
.setParam("i_process_start_time", startTime) | |||
.setParam("i_process_end_time", endTime) | |||
.setParam("i_measurements", CustomDBType(measurements, "JSONB[]")) | |||
.setParam("i_measured_by_atum_agent", false) | |||
//.setParam("i_measured_by_atum_agent", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have simply commented this out to test the if default works. And it does.
I can always change it back or remove the comment altogether.
@@ -235,7 +235,7 @@ class WriteCheckpointIntegrationTests extends DBTestSuite { | |||
.add("checkpoint_name", "I came before") | |||
.add("process_start_time", now()) | |||
.add("process_end_time", now()) | |||
.add("measured_by_atum_agent", false) | |||
//.add("measured_by_atum_agent", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have simply commented this out to test the if default works. And it does.
I can always change it back or remove the comment altogether.
@@ -161,7 +161,7 @@ class WriteCheckpointOverloadedIntegrationTests extends DBTestSuite { | |||
.setParam("i_process_start_time", startTime) | |||
.setParam("i_process_end_time", endTime) | |||
.setParam("i_measurements", CustomDBType(measurements, "JSONB[]")) | |||
.setParam("i_measured_by_atum_agent", false) | |||
//.setParam("i_measured_by_atum_agent", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have simply commented this out to test the if default works. And it does.
I can always change it back or remove the comment altogether.
@@ -237,7 +237,7 @@ class WriteCheckpointOverloadedIntegrationTests extends DBTestSuite { | |||
.add("checkpoint_name", "I came before") | |||
.add("process_start_time", now()) | |||
.add("process_end_time", now()) | |||
.add("measured_by_atum_agent", false) | |||
//.add("measured_by_atum_agent", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have simply commented this out to test the if default works. And it does.
I can always change it back or remove the comment altogether.
…ave NOT NULL constraint with DEFAULT FALSE #242 Made changes: 1. Changed the value of measured_by_atum_agent in Checkpoints DDL to NOT NULL. 2. Changed the value of measured_by_atum_agent in Checkpoints DDL to DEFAULT FALSE. 3. Changed the value of measured_by_atum_agent in Write Checkpoints to DEFAULT FALSE. 4. Changed the tests to accommodate this change, it has been tested successfully. 5. Made changes to the WriteCheckpoint.scala files.
JaCoCo model module code coverage report - scala 2.13.11
|
JaCoCo agent module code coverage report - scala 2.13.11
|
JaCoCo reader module code coverage report - scala 2.13.11
|
JaCoCo server module code coverage report - scala 2.13.11
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, you went far behind what was needed and actually desired.
All that is needed is in runs.checkpoints
measured_by_atum_agent BOOLEAN NOT NULL
, default is not needed, but that I leave up to your discretion.
So please roll back all the other changes.
Unfortunately the table change cannot be done the way how you did it either. FLyway is a migration tool. It's sequence of DB modification scripts. And on each deploy it records and remembers where in the sequence it has ended. Therefor it's not possible (working) to change the previous item in the sequence. You have to create a new one that alters the state of the object in its most recent version.
The new script should be from the range of V0.4.0.
…ave NOT NULL constraint with DEFAULT FALSE #242 Made changes: 1. Changed the value of measured_by_atum_agent in Checkpoints DDL to NOT NULL. 2. Changed the value of measured_by_atum_agent in Checkpoints DDL to DEFAULT FALSE as according to the issue request.
@benedeki I have kept the |
@@ -20,7 +20,7 @@ CREATE TABLE runs.checkpoints | |||
checkpoint_name TEXT NOT NULL, | |||
process_start_time TIMESTAMP WITH TIME ZONE NOT NULL, | |||
process_end_time TIMESTAMP WITH TIME ZONE, | |||
measured_by_atum_agent BOOLEAN, | |||
measured_by_atum_agent BOOLEAN NOT NULL DEFAULT FALSE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this will work like this with Flyway (please familiarze yourself with it: https://documentation.red-gate.com/flyway/getting-started-with-flyway and https://github.com/sbt/flyway-sbt) - this file V0.1.0.32 was already applied on the DB, and we should always implement increments. I propose to use ALTER TABLE
statement in a new sql file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, just out of curiosity, did you or someone check the DB on DEV, UAT, and PROD to see if there are, by any chance records with empty values for this column? If yes we have to deal with it (there might not be any such records)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lsulak This is useful to know. I will add a seperate sql file with alter table.
No I have not checked the DBs.
Added SQL file with alter table, added the NOT NULL constraint to measured_by_atum_agent.
* limitations under the License. | ||
*/ | ||
|
||
ALTER TABLE runs.checkpoints ALTER COLUMN measured_by_atum_agent SET NOT NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for nitpicking and mentioning it earlier. Would be the safest to update the field value to 'false
wherever it's NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also what do you think about default FALSE? I think I'm slightly more inclined to it but we can leave it up to table's 'users' to define basically. I just think that false is a good candidate here also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have taken these comments into account. I am not sure if what I have done is correct, specfically adding an update table query.
Made amendments to SQL code mentioned by PR. - Added Update table - Added Default false to table
UPDATE runs.checkpoints | ||
SET measured_by_atum_agent = FALSE | ||
WHERE measured_by_atum_agent IS NULL; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very unsure about having an update function in this SQL. Please correct me as needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, it's exactly what I was after.
This way it won't fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay now, I'd like the opinion of @benedeki before merging ideally though
Closes #242
Release Notes:
measured_by_atum_agent
fromBOOLEAN
toBOOLEAN NOT NULL