Skip to content
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

Refactor browser_session table #215

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Refactor browser_session table #215

merged 2 commits into from
Jun 13, 2024

Conversation

ncosta-ic
Copy link
Member

@ncosta-ic ncosta-ic commented Jun 10, 2024

This PR modifies the browser_session table to reflect new changes to the data structure.

  • The primary key no longer depends on the username or user_agent, as the session storage hook takes care of zombie entries before inserting new session data.
  • Added the additional descending order to the existing authenticated_at index.
  • Fixed index naming convention.
  • A new combined index has been added, which speeds up lookups that use both username and user_agent conditions.
  • The default expression for authenticated_at got removed, as the timestamp now gets supplied by the PHP daemon itself.

Fixes Icinga/icinga-notifications-web#194
Fixes Icinga/icinga-notifications-web#195

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Jun 10, 2024
@ncosta-ic ncosta-ic changed the title Refactor browser_session Refactor browser_session table Jun 10, 2024
@julianbrost
Copy link
Collaborator

Is that really due to that? Is there any remaining doubt that the username can be treated case-insensitive? To my current knowledge, there seems to be some inconsistency in Icinga Web there between MySQL/MariaDB and PostgreSQL, but neither allows you to have users whose names differ only in case.

@ncosta-ic
Copy link
Member Author

ncosta-ic commented Jun 12, 2024

Is that really due to that? Is there any remaining doubt that the username can be treated case-insensitive? To my current knowledge, there seems to be some inconsistency in Icinga Web there between MySQL/MariaDB and PostgreSQL, but neither allows you to have users whose names differ only in case.

That's correct. We don't support different usernames solely based on their case sensitivity.
However, I feel the introduction of citext should take place in a separate PR once everything's discussed about it.
I'd rather not include in the browser_session if that's not our standard yet.

@julianbrost
Copy link
Collaborator

#71 was merged earlier today so now there's a precedent for using citext to store the username.

@ncosta-ic
Copy link
Member Author

@julianbrost I rebased this PR and reverted the username changes.
Feel free to merge it, if that's fine for you now :)

schema/pgsql/upgrades/028.sql Outdated Show resolved Hide resolved
schema/pgsql/upgrades/028.sql Outdated Show resolved Hide resolved
schema/pgsql/schema.sql Show resolved Hide resolved
@julianbrost julianbrost merged commit 6b1a76b into main Jun 13, 2024
12 checks passed
@julianbrost julianbrost deleted the change-browser-session branch June 13, 2024 11:53
ncosta-ic added a commit to Icinga/icinga-notifications-web that referenced this pull request Jun 13, 2024
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
2 participants