Skip to content

Commit

Permalink
refactor(desktop-notifications): changed browser identifier, introduc…
Browse files Browse the repository at this point in the history
…ed proper case-insensitive type
  • Loading branch information
ncosta-ic committed Feb 27, 2024
1 parent fdb0808 commit 735bcb2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions schema/pgsql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,21 @@ CREATE TABLE incident_history (
CONSTRAINT pk_incident_history PRIMARY KEY (id),
FOREIGN KEY (incident_id, rule_escalation_id) REFERENCES incident_rule_escalation_state(incident_id, rule_escalation_id)
);

CREATE EXTENSION IF NOT EXISTS citext;

CREATE TABLE browser_session
(
php_session_id VARCHAR(256) NOT NULL,
username CITEXT NOT NULL,
user_agent TEXT NOT NULL,
authenticated_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000),

CONSTRAINT pk_session PRIMARY KEY (php_session_id, username, user_agent)
);

CREATE INDEX browser_session_authenticated_at_idx
ON browser_session (
authenticated_at
)
;
17 changes: 17 additions & 0 deletions schema/pgsql/upgrades/022.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE EXTENSION IF NOT EXISTS citext;

CREATE TABLE browser_session
(
php_session_id VARCHAR(256) NOT NULL,
username CITEXT NOT NULL,
user_agent TEXT NOT NULL,
authenticated_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000),

CONSTRAINT pk_session PRIMARY KEY (php_session_id, username, user_agent)
);

CREATE INDEX browser_session_authenticated_at_idx
ON browser_session (
authenticated_at
)
;

0 comments on commit 735bcb2

Please sign in to comment.