diff --git a/schema/pgsql/schema.sql b/schema/pgsql/schema.sql index fe692df3..2d5e3ce2 100644 --- a/schema/pgsql/schema.sql +++ b/schema/pgsql/schema.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS citext; + CREATE TYPE boolenum AS ENUM ( 'n', 'y' ); CREATE TYPE incident_history_event_type AS ENUM ( -- Order to be honored for events with identical microsecond timestamps. @@ -318,20 +320,13 @@ CREATE TABLE incident_history ( CREATE INDEX idx_incident_history_time_type ON incident_history(time, type); COMMENT ON INDEX idx_incident_history_time_type IS 'Incident History ordered by time/type'; -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), +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) + CONSTRAINT pk_browser_session PRIMARY KEY (php_session_id, username, user_agent) ); -CREATE INDEX browser_session_authenticated_at_idx - ON browser_session ( - authenticated_at - ) -; +CREATE INDEX browser_session_authenticated_at_idx ON browser_session (authenticated_at); diff --git a/schema/pgsql/upgrades/025.sql b/schema/pgsql/upgrades/025.sql index f1e8994c..a28376d9 100644 --- a/schema/pgsql/upgrades/025.sql +++ b/schema/pgsql/upgrades/025.sql @@ -1,17 +1,12 @@ 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), +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) + CONSTRAINT pk_browser_session PRIMARY KEY (php_session_id, username, user_agent) ); -CREATE INDEX browser_session_authenticated_at_idx - ON browser_session ( - authenticated_at - ) -; +CREATE INDEX browser_session_authenticated_at_idx ON browser_session (authenticated_at);