Skip to content

Conversation

@jrauh01
Copy link
Contributor

@jrauh01 jrauh01 commented Oct 27, 2025

Add a column to store the timezone the schedule is created for.

Draft until the following PR is merged:

  • Blocked by: Proper timezone handling for schedules icinga-notifications-web#369 (This schema change is solely needed for Notification Web, so no need to merge this earlier than the corresponding PR there. On the other hand, the schema change breaks Notifications Web without that PR as is couldn't insert rows anymore as it doesn't yet know of the required column.)

@jrauh01 jrauh01 self-assigned this Oct 27, 2025
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Oct 27, 2025
Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

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

Schema upgrade files are also required. Please consider some useful default for migration.

Please take a look at #324, where such files are already being created.

@nilmerg
Copy link
Member

nilmerg commented Oct 27, 2025

The default an be inferred from the first timeperiod_entry.timezone.

@jrauh01
Copy link
Contributor Author

jrauh01 commented Oct 27, 2025

@nilmerg not sure if I understand this right, but the timeperiod_entry.timezone does not have a default.

Edit: Or do you mean to select the timezone value from the first timeperiod_entry that relates to the schedule and use the selected value as default for the migration?

@nilmerg
Copy link
Member

nilmerg commented Oct 27, 2025

select the timezone value from the first timeperiod_entry that relates to the schedule and use the selected value as default for the migration?

Exactly.

@jrauh01 jrauh01 force-pushed the add-schedule-timezone-column branch from 51a9f85 to 1cc5e6d Compare October 28, 2025 09:44
@jrauh01 jrauh01 requested a review from oxzi October 28, 2025 09:45
@julianbrost julianbrost added this to the 0.2.0 milestone Oct 28, 2025
The value must not be null, so we have to set a default when
upgrading the schema. For that we look for the first
`timeperiod_entry` and use it's `timezone` column. If no entry
exists, the fallback is **'UTC'**.
@jrauh01 jrauh01 force-pushed the add-schedule-timezone-column branch from 1cc5e6d to d974095 Compare October 29, 2025 11:06
@jrauh01 jrauh01 requested a review from julianbrost October 29, 2025 11:07
@julianbrost julianbrost marked this pull request as draft October 29, 2025 13:23
Copy link
Collaborator

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

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

This PR is fine and can be merged any time the corresponding Notifications Web PR is ready. Though it probably shouldn't merged earlier as the added column is required without a default, hence without the corresponding change in Notifications Web, older version can't insert new rows anymore.

Thus, I've converted the PR to a draft for the moment (so there's a hint that it maybe shouldn't be merged immediately despite this approval) with a corresponding note in the PR description.

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

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants