-
Notifications
You must be signed in to change notification settings - Fork 53
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
v3: fix the migration mess #1211
Conversation
035aa93
to
236d4c2
Compare
Let's see if I understand. pre-script version N can be executed while the code version N-1 is running. Is the idea that procrastinate semantic versioning is at the programmatic API level and that any new version can possibly introduce database breaking changes as long as there is the ability to split them in pre-scripts and post-scripts to maintain blue-green deployments of the codebase? What are your thoughts about testing out that pre-migration script is backward compatible? I like it. |
Yep. I think this change removes some hurdles that make keeping blue-green possible (and sane) while the current state of affairs made it more confusing than it needed to be and harder to achieve. We can iterate on the tooling to make this actually easy in the future.
My ideas: |
DROP FUNCTION IF EXISTS procrastinate_sync_abort_requested_with_status_v1; | ||
|
||
-- Create a new enum type without 'aborting' | ||
CREATE TYPE procrastinate_job_status_v1 AS ENUM ( |
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.
Must this not be created in pre
? Some functions already use it there.
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 still think this is true. I will move it over to procrastinate/sql/migrations/03.00.00_01_pre_cancel_notification.sql
I think I get the idea now and also like it 🙂. The separation between |
I'm delighted by your answers. You're most probably right that we'll need to continue adjusting a few things. Given that we need v3+pre to work, we need v3's queries to work with pre, which means the new enum needs to be supported in pre. Post can only be used to clean the mess. |
@ewjoachim Do you need a helping hand here? I have some time left in the upcoming days and can take care of this issue (at least I could try). |
I probably won't have time to work on it Saturday, there might be a chance Sunday and then probably not for a few days, so I'd say: feel free to try something as long as we communicate where we're at. |
Alright, let's see how far I get. I am probably not yet fully aware of the extent of this PR. And yes, pair programming sounds fun (I have never done anything like this before), but it sounds more like you will be tutoring me then ;-) |
|
||
-- Recreate and update the functions | ||
CREATE OR REPLACE FUNCTION procrastinate_fetch_job( | ||
-- Recreate and update the functions to use the new column |
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 don't think this is necessary when just changing the column type (it is compatible with the new type). We have also already created those functions in procrastinate/sql/migrations/03.00.00_01_pre_cancel_notification.sql
.
Based on this one, I will work on a new PR (#1227). So we can throw mine away if I go in the wrong direction. |
procrastinate/sql/migrations/03.00.00_01_pre_cancel_notification.sql
236d4c2
to
b22458e
Compare
(closed in favor of #1227 ) |
Closes #1189
Warning
the word "mess" is is solely directed at the mess I created trhough unclear rules and overly complex processes, the work done so far by everyone has been amazing
Introduce a new migration process: pre-migrations and post-migrations.
So the idea is that:
(I'm 80% sure that I have missed a few corner cases)
Is it going in the right direction according to you @medihack @onlyann ?
Successful PR Checklist:
PR label(s):