Skip to content

Migration 100 guided#3356

Open
peb-adr wants to merge 42 commits intoOpenSlides:mainfrom
peb-adr:migration-100-guided
Open

Migration 100 guided#3356
peb-adr wants to merge 42 commits intoOpenSlides:mainfrom
peb-adr:migration-100-guided

Conversation

@peb-adr
Copy link
Copy Markdown
Member

@peb-adr peb-adr commented Feb 23, 2026

No description provided.

@peb-adr peb-adr marked this pull request as draft February 23, 2026 17:14
Copy link
Copy Markdown
Member

@hjanott hjanott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the general approach and have some suggestions. :)


#raise MigrationException(
# f"pre check for migration {module_name} failed."
#)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would honestly expect the modules function to already do so. No need for the flag.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it so that a string with all errors is returned from the prerequisites check and thrown if truthy.

Comment thread openslides_backend/migrations/migrations/0100_init_reldb.py Outdated
Comment on lines +74 to +76
# TODO: removed commented out lines after review
# MigrationHelper.write_line is hardly usable when only the last
# line is output.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change this, but we would need to empty the streams buffer each time reading with truncate(0) and seek(0).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it so that all lines are read since last time reading. Reads the same block again if nothing new was written.

peb-adr added 2 commits March 16, 2026 16:14
Still open:
- StringIO stream: replace `getvalue` with appropriate `read` / `truncate`
- Replace LINK
@peb-adr
Copy link
Copy Markdown
Member Author

peb-adr commented Mar 17, 2026

The PR for documentation of the Update to 4.3.0 is now open in main repo

https://github.com/OpenSlides/OpenSlides/pull/7091/changes

It Includes the file UPDATE_TO_4.3.md.
So LINK can presumably be replaced with https://github.com/OpenSlides/OpenSlides/blob/main/UPDATE_TO_4.3.md.

After that the only remaining TODO is:

  • StringIO stream: replace getvalue with appropriate read / truncate
  • reset route: return 501 Not Implemented

@peb-adr
Copy link
Copy Markdown
Member Author

peb-adr commented Mar 20, 2026

When calling migrate and the pre-check (check_prerequisites function) fails, this will already cause all subsequent requests to be answered with internal server error.

Originally I was intending to do the pre-check early enough so this wouldn't happen.
Maybe this is connected to the exception thrown, but I am not sure about this.

@hjanott if you find a way for pre-check to fail more gracefully, such that one could just add the missing env vars and call migrate again, that would be awesome.
Because currently you would have to completely reset the DB and re-import the dump, which is not very user-friendly.

@rrenkert
Copy link
Copy Markdown
Member

Please ping @m-schieder if this gets merged.

@rrenkert
Copy link
Copy Markdown
Member

rrenkert commented Apr 8, 2026

@peb-adr Because of OpenSlides/openslides-client#5949 (comment) we need to set the timezone for the orga an d meetings. Can we use the ENV variables used here to fill the fields?

@peb-adr
Copy link
Copy Markdown
Member Author

peb-adr commented Apr 8, 2026

Can we use the ENV variables used here to fill the fields?

Basically, yes we can.

But if we want to have a more readable timezone string in those fields and not just a numeric UTC offset (though it should be an allowed value I think), we should rename MIG0100_UTC_OFFSET to MIG0100_UTC_TIMEZONE.

If still necessary (not sure at the moment) we can then derive the UTC offset from that.

@hjanott
Copy link
Copy Markdown
Member

hjanott commented Apr 10, 2026

If still necessary (not sure at the moment) we can then derive the UTC offset from that.

Yes we could do that easily. But that must mean that the system was operating in UTC+00. We could also look at the systems time zone and then derive the offset from that. Or as a third option allow to override the calculation by the env variable MIG0100_UTC_OFFSET. It could be that I'm describing it wrongly.
As far as I can see there are two factors to consider. The time zone the OS operated in and the time zone the organization wants to operate in.

@rrenkert rrenkert marked this pull request as ready for review April 17, 2026 14:31
Copy link
Copy Markdown
Member Author

@peb-adr peb-adr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked over the changes since 04e723c and documented some thoughts I had.
In general it looks good.
I will test the migration later.

pass


class InternalNotImplemented(HTTPException, BaseNotImplemented):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the regular NotImplemented exception?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is werkzeug.exceptions.NotImplemented.
I'm strictly following the pattern of how the other Exceptions are created here.

Comment thread openslides_backend/migrations/migrations/0100_init_reldb.py
"""
Resets the migrations currently in progress and restores the state before the migration.
"""
raise CommandNotImplemented("The reset route is not implemented yet.")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another type of "not implemented". Are there good reasons for it?

Copy link
Copy Markdown
Member

@hjanott hjanott Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/OpenSlides/openslides-backend/pull/3356/changes#r3117186039 This one just holds the error code checked during error handling.
Also I didn't want to name it exactly like the "normal" one, overriding it.

@peb-adr peb-adr requested a review from hjanott April 24, 2026 14:58
Copy link
Copy Markdown
Member

@hjanott hjanott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you for the fix.

@peb-adr peb-adr force-pushed the migration-100-guided branch 2 times, most recently from ff93013 to f51d62f Compare April 24, 2026 17:54
@peb-adr
Copy link
Copy Markdown
Member Author

peb-adr commented Apr 24, 2026

Force-pushed back to f51d62f

I didn't think the rest through. Probably will open a new PR next week ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants