Skip to content

Commit 4f0e426

Browse files
committed
Change PostgreSQL SERIAL to BIGSERIAL columns
This is consistent with other schemas, internally consistent with foreign keys, and allows for > 2B records in these tables.
1 parent d5bf051 commit 4f0e426

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

sql/pg.new.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ CREATE TABLE spool (
244244
username text NOT NULL,
245245
server_host text NOT NULL,
246246
xml text NOT NULL,
247-
seq SERIAL,
247+
seq BIGSERIAL,
248248
created_at TIMESTAMP NOT NULL DEFAULT now()
249249
);
250250

@@ -258,7 +258,7 @@ CREATE TABLE archive (
258258
bare_peer text NOT NULL,
259259
xml text NOT NULL,
260260
txt text,
261-
id SERIAL,
261+
id BIGSERIAL,
262262
kind text,
263263
nick text,
264264
created_at TIMESTAMP NOT NULL DEFAULT now()
@@ -339,7 +339,7 @@ CREATE TABLE privacy_list (
339339
username text NOT NULL,
340340
server_host text NOT NULL,
341341
name text NOT NULL,
342-
id SERIAL UNIQUE,
342+
id BIGSERIAL UNIQUE,
343343
created_at TIMESTAMP NOT NULL DEFAULT now()
344344
);
345345

@@ -394,7 +394,7 @@ CREATE TABLE pubsub_node (
394394
node text NOT NULL,
395395
parent text NOT NULL DEFAULT '',
396396
plugin text NOT NULL,
397-
nodeid SERIAL UNIQUE
397+
nodeid BIGSERIAL UNIQUE
398398
);
399399
CREATE INDEX i_pubsub_node_parent ON pubsub_node USING btree (parent);
400400
CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node USING btree (host, node);
@@ -417,7 +417,7 @@ CREATE TABLE pubsub_state (
417417
jid text NOT NULL,
418418
affiliation character(1),
419419
subscriptions text NOT NULL DEFAULT '',
420-
stateid SERIAL UNIQUE
420+
stateid BIGSERIAL UNIQUE
421421
);
422422
CREATE INDEX i_pubsub_state_jid ON pubsub_state USING btree (jid);
423423
CREATE UNIQUE INDEX i_pubsub_state_tuple ON pubsub_state USING btree (nodeid, jid);

sql/pg.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ CREATE INDEX i_sr_user_grp ON sr_user USING btree (grp);
8282
CREATE TABLE spool (
8383
username text NOT NULL,
8484
xml text NOT NULL,
85-
seq SERIAL,
85+
seq BIGSERIAL,
8686
created_at TIMESTAMP NOT NULL DEFAULT now()
8787
);
8888

@@ -95,7 +95,7 @@ CREATE TABLE archive (
9595
bare_peer text NOT NULL,
9696
xml text NOT NULL,
9797
txt text,
98-
id SERIAL,
98+
id BIGSERIAL,
9999
kind text,
100100
nick text,
101101
created_at TIMESTAMP NOT NULL DEFAULT now()
@@ -167,7 +167,7 @@ CREATE TABLE privacy_default_list (
167167
CREATE TABLE privacy_list (
168168
username text NOT NULL,
169169
name text NOT NULL,
170-
id SERIAL UNIQUE,
170+
id BIGSERIAL UNIQUE,
171171
created_at TIMESTAMP NOT NULL DEFAULT now()
172172
);
173173

@@ -220,7 +220,7 @@ CREATE TABLE pubsub_node (
220220
node text NOT NULL,
221221
parent text NOT NULL DEFAULT '',
222222
plugin text NOT NULL,
223-
nodeid SERIAL UNIQUE
223+
nodeid BIGSERIAL UNIQUE
224224
);
225225
CREATE INDEX i_pubsub_node_parent ON pubsub_node USING btree (parent);
226226
CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node USING btree (host, node);
@@ -243,7 +243,7 @@ CREATE TABLE pubsub_state (
243243
jid text NOT NULL,
244244
affiliation character(1),
245245
subscriptions text NOT NULL DEFAULT '',
246-
stateid SERIAL UNIQUE
246+
stateid BIGSERIAL UNIQUE
247247
);
248248
CREATE INDEX i_pubsub_state_jid ON pubsub_state USING btree (jid);
249249
CREATE UNIQUE INDEX i_pubsub_state_tuple ON pubsub_state USING btree (nodeid, jid);

0 commit comments

Comments
 (0)