Skip to content

Commit b6b4a75

Browse files
committed
schema.sql, 025.sql: make style consistent
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.
1 parent 1204ecc commit b6b4a75

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

schema/pgsql/schema.sql

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
CREATE EXTENSION IF NOT EXISTS citext;
2+
13
CREATE TYPE boolenum AS ENUM ( 'n', 'y' );
24
CREATE TYPE incident_history_event_type AS ENUM (
35
-- Order to be honored for events with identical microsecond timestamps.
@@ -318,20 +320,13 @@ CREATE TABLE incident_history (
318320
CREATE INDEX idx_incident_history_time_type ON incident_history(time, type);
319321
COMMENT ON INDEX idx_incident_history_time_type IS 'Incident History ordered by time/type';
320322

321-
CREATE EXTENSION IF NOT EXISTS citext;
322-
323-
CREATE TABLE browser_session
324-
(
325-
php_session_id VARCHAR(256) NOT NULL,
326-
username CITEXT NOT NULL,
327-
user_agent TEXT NOT NULL,
328-
authenticated_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000),
323+
CREATE TABLE browser_session (
324+
php_session_id varchar(256) NOT NULL,
325+
username citext NOT NULL,
326+
user_agent text NOT NULL,
327+
authenticated_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000),
329328

330-
CONSTRAINT pk_session PRIMARY KEY (php_session_id, username, user_agent)
329+
CONSTRAINT pk_browser_session PRIMARY KEY (php_session_id, username, user_agent)
331330
);
332331

333-
CREATE INDEX browser_session_authenticated_at_idx
334-
ON browser_session (
335-
authenticated_at
336-
)
337-
;
332+
CREATE INDEX browser_session_authenticated_at_idx ON browser_session (authenticated_at);

schema/pgsql/upgrades/025.sql

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
CREATE EXTENSION IF NOT EXISTS citext;
22

3-
CREATE TABLE browser_session
4-
(
5-
php_session_id VARCHAR(256) NOT NULL,
6-
username CITEXT NOT NULL,
7-
user_agent TEXT NOT NULL,
8-
authenticated_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000),
3+
CREATE TABLE browser_session (
4+
php_session_id varchar(256) NOT NULL,
5+
username citext NOT NULL,
6+
user_agent text NOT NULL,
7+
authenticated_at bigint NOT NULL DEFAULT (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000),
98

10-
CONSTRAINT pk_session PRIMARY KEY (php_session_id, username, user_agent)
9+
CONSTRAINT pk_browser_session PRIMARY KEY (php_session_id, username, user_agent)
1110
);
1211

13-
CREATE INDEX browser_session_authenticated_at_idx
14-
ON browser_session (
15-
authenticated_at
16-
)
17-
;
12+
CREATE INDEX browser_session_authenticated_at_idx ON browser_session (authenticated_at);

0 commit comments

Comments
 (0)