Skip to content

Commit

Permalink
schema.sql, 025.sql: make style consistent
Browse files Browse the repository at this point in the history
Mainly adapt spacing and character case to be consistent with the rest. Also do
the CREATE EXTENSION at the top of the schema file, it may be used elsewhere in
the future as well. One functional change: rename the primary key constraint to
be consistent with pk_${table_name} used in the rest of the file.
  • Loading branch information
julianbrost committed May 29, 2024
1 parent 1204ecc commit b6b4a75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
23 changes: 9 additions & 14 deletions schema/pgsql/schema.sql
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
19 changes: 7 additions & 12 deletions schema/pgsql/upgrades/025.sql
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit b6b4a75

Please sign in to comment.