-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
bug(scheduler): Fix controller id length check #2226
Conversation
The job_run table has a foreign key to the server_controller private_id. While this column is called a prviate_id it does not implement the wt_private_id postgres domain type, and therefore does not have a minimum length of 10 characters.
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.
LGTM
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.
Looks good; would you mind starting a new Changelog section for 0.9.1?
6dd1718
to
3f40f46
Compare
add constraint controller_id_must_not_be_empty | ||
check( | ||
length(trim(controller_id)) > 0 | ||
); |
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.
This constraint should also be on the server_controller
table since controller_id
is a foreign key. Can we create a domain type for this constraint and then change the column types in the server_controller
and job_run
tables to use the new domain type?
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 was not sure on what the domain type should be, so I went with wt_not_empty
let me know what you think, otherwise I can make it specific to the controller private id. wt controller_id
alter table job_run | ||
alter column controller_id type wt_not_empty; |
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.
Can we combine the changes to the job_run
table into one alter table
statement since they are related?
alter table job_run | ||
drop constraint controller_id_must_be_at_least_10_characters; | ||
|
||
create domain wt_not_empty as text |
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 wt_controller_id
would be a clearer name and it would allow us to alter the checks or add new ones without changing the name of the domain type.
alter table job_run | ||
drop constraint controller_id_must_be_at_least_10_characters; | ||
|
||
create domain wt_not_empty as text |
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.
Can we add sql tests for this?
The job_run table has a foreign key to the server_controller private_id.
While this column is called a prviate_id it does not implement the wt_private_id
postgres domain type, and therefore does not have a minimum length of 10 characters.