From 4943904d94e076c563953e286d4f69e7b5505642 Mon Sep 17 00:00:00 2001 From: Tiago Mota Date: Thu, 11 Nov 2021 14:18:41 +0000 Subject: [PATCH] Prefer IDENTITY column to SERIAL --- .../test/resources/schema/postgres/nested-partitions-schema.sql | 2 +- core/src/test/resources/schema/postgres/partitioned-schema.sql | 2 +- core/src/test/resources/schema/postgres/plain-schema.sql | 2 +- .../persistence/postgres/migration/journal/JournalSchema.scala | 2 +- .../migration-0.6.0/1-create-journal-persistence-ids-table.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/test/resources/schema/postgres/nested-partitions-schema.sql b/core/src/test/resources/schema/postgres/nested-partitions-schema.sql index 952e5fdb..ce110fa6 100644 --- a/core/src/test/resources/schema/postgres/nested-partitions-schema.sql +++ b/core/src/test/resources/schema/postgres/nested-partitions-schema.sql @@ -72,7 +72,7 @@ DROP FUNCTION IF EXISTS public.update_journal_persistence_ids(); DROP TABLE IF EXISTS public.journal_persistence_ids; CREATE TABLE public.journal_persistence_ids( - id BIGSERIAL, + id BIGINT GENERATED ALWAYS AS IDENTITY, persistence_id TEXT NOT NULL, max_sequence_number BIGINT NOT NULL, min_ordering BIGINT NOT NULL, diff --git a/core/src/test/resources/schema/postgres/partitioned-schema.sql b/core/src/test/resources/schema/postgres/partitioned-schema.sql index 875dfa70..68f66015 100644 --- a/core/src/test/resources/schema/postgres/partitioned-schema.sql +++ b/core/src/test/resources/schema/postgres/partitioned-schema.sql @@ -73,7 +73,7 @@ DROP FUNCTION IF EXISTS public.update_journal_persistence_ids(); DROP TABLE IF EXISTS public.journal_persistence_ids; CREATE TABLE public.journal_persistence_ids( - id BIGSERIAL, + id BIGINT GENERATED ALWAYS AS IDENTITY, persistence_id TEXT NOT NULL, max_sequence_number BIGINT NOT NULL, min_ordering BIGINT NOT NULL, diff --git a/core/src/test/resources/schema/postgres/plain-schema.sql b/core/src/test/resources/schema/postgres/plain-schema.sql index 81b7fdf3..66953e47 100644 --- a/core/src/test/resources/schema/postgres/plain-schema.sql +++ b/core/src/test/resources/schema/postgres/plain-schema.sql @@ -46,7 +46,7 @@ DROP FUNCTION IF EXISTS public.update_journal_persistence_ids(); DROP TABLE IF EXISTS public.journal_persistence_ids; CREATE TABLE public.journal_persistence_ids( - id BIGSERIAL, + id BIGINT GENERATED ALWAYS AS IDENTITY, persistence_id TEXT NOT NULL, max_sequence_number BIGINT NOT NULL, min_ordering BIGINT NOT NULL, diff --git a/migration/src/main/scala/akka/persistence/postgres/migration/journal/JournalSchema.scala b/migration/src/main/scala/akka/persistence/postgres/migration/journal/JournalSchema.scala index 3e4555e2..0f5dd7e8 100644 --- a/migration/src/main/scala/akka/persistence/postgres/migration/journal/JournalSchema.scala +++ b/migration/src/main/scala/akka/persistence/postgres/migration/journal/JournalSchema.scala @@ -32,7 +32,7 @@ private[journal] trait JournalSchema { import journalPersistenceIdsTableCfg.columnNames._ for { _ <- sqlu"""CREATE TABLE #$fullTableName ( - #$id BIGSERIAL, + #$id BIGINT GENERATED ALWAYS AS IDENTITY, #$persistenceId TEXT NOT NULL, #$maxSequenceNumber BIGINT NOT NULL, #$maxOrdering BIGINT NOT NULL, diff --git a/scripts/migration-0.6.0/1-create-journal-persistence-ids-table.sql b/scripts/migration-0.6.0/1-create-journal-persistence-ids-table.sql index e5322534..1b86a521 100644 --- a/scripts/migration-0.6.0/1-create-journal-persistence-ids-table.sql +++ b/scripts/migration-0.6.0/1-create-journal-persistence-ids-table.sql @@ -20,7 +20,7 @@ BEGIN sql := 'CREATE TABLE IF NOT EXISTS ' || jpi_table || '(' || - jpi_id_column || ' BIGSERIAL, ' || + jpi_id_column || ' BIGINT GENERATED ALWAYS AS IDENTITY, ' || jpi_persistence_id_column || ' TEXT NOT NULL, ' || jpi_max_sequence_number_column || ' BIGINT NOT NULL, ' || jpi_max_ordering_column || ' BIGINT NOT NULL, ' ||