From 4f0e426a12aadc6a7249e6a8d6fe62cdb0579cd7 Mon Sep 17 00:00:00 2001 From: Stu Tomlinson Date: Thu, 19 Jan 2023 23:33:46 +0000 Subject: [PATCH] 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. --- sql/pg.new.sql | 10 +++++----- sql/pg.sql | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sql/pg.new.sql b/sql/pg.new.sql index 32246d3f6..ba0dc31dd 100644 --- a/sql/pg.new.sql +++ b/sql/pg.new.sql @@ -244,7 +244,7 @@ CREATE TABLE spool ( username text NOT NULL, server_host text NOT NULL, xml text NOT NULL, - seq SERIAL, + seq BIGSERIAL, created_at TIMESTAMP NOT NULL DEFAULT now() ); @@ -258,7 +258,7 @@ CREATE TABLE archive ( bare_peer text NOT NULL, xml text NOT NULL, txt text, - id SERIAL, + id BIGSERIAL, kind text, nick text, created_at TIMESTAMP NOT NULL DEFAULT now() @@ -339,7 +339,7 @@ CREATE TABLE privacy_list ( username text NOT NULL, server_host text NOT NULL, name text NOT NULL, - id SERIAL UNIQUE, + id BIGSERIAL UNIQUE, created_at TIMESTAMP NOT NULL DEFAULT now() ); @@ -394,7 +394,7 @@ CREATE TABLE pubsub_node ( node text NOT NULL, parent text NOT NULL DEFAULT '', plugin text NOT NULL, - nodeid SERIAL UNIQUE + nodeid BIGSERIAL UNIQUE ); CREATE INDEX i_pubsub_node_parent ON pubsub_node USING btree (parent); CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node USING btree (host, node); @@ -417,7 +417,7 @@ CREATE TABLE pubsub_state ( jid text NOT NULL, affiliation character(1), subscriptions text NOT NULL DEFAULT '', - stateid SERIAL UNIQUE + stateid BIGSERIAL UNIQUE ); CREATE INDEX i_pubsub_state_jid ON pubsub_state USING btree (jid); CREATE UNIQUE INDEX i_pubsub_state_tuple ON pubsub_state USING btree (nodeid, jid); diff --git a/sql/pg.sql b/sql/pg.sql index fe244c757..813e690dd 100644 --- a/sql/pg.sql +++ b/sql/pg.sql @@ -82,7 +82,7 @@ CREATE INDEX i_sr_user_grp ON sr_user USING btree (grp); CREATE TABLE spool ( username text NOT NULL, xml text NOT NULL, - seq SERIAL, + seq BIGSERIAL, created_at TIMESTAMP NOT NULL DEFAULT now() ); @@ -95,7 +95,7 @@ CREATE TABLE archive ( bare_peer text NOT NULL, xml text NOT NULL, txt text, - id SERIAL, + id BIGSERIAL, kind text, nick text, created_at TIMESTAMP NOT NULL DEFAULT now() @@ -167,7 +167,7 @@ CREATE TABLE privacy_default_list ( CREATE TABLE privacy_list ( username text NOT NULL, name text NOT NULL, - id SERIAL UNIQUE, + id BIGSERIAL UNIQUE, created_at TIMESTAMP NOT NULL DEFAULT now() ); @@ -220,7 +220,7 @@ CREATE TABLE pubsub_node ( node text NOT NULL, parent text NOT NULL DEFAULT '', plugin text NOT NULL, - nodeid SERIAL UNIQUE + nodeid BIGSERIAL UNIQUE ); CREATE INDEX i_pubsub_node_parent ON pubsub_node USING btree (parent); CREATE UNIQUE INDEX i_pubsub_node_tuple ON pubsub_node USING btree (host, node); @@ -243,7 +243,7 @@ CREATE TABLE pubsub_state ( jid text NOT NULL, affiliation character(1), subscriptions text NOT NULL DEFAULT '', - stateid SERIAL UNIQUE + stateid BIGSERIAL UNIQUE ); CREATE INDEX i_pubsub_state_jid ON pubsub_state USING btree (jid); CREATE UNIQUE INDEX i_pubsub_state_tuple ON pubsub_state USING btree (nodeid, jid);