From 90b67165efabce5451181533b5221cb75a7a0a59 Mon Sep 17 00:00:00 2001
From: Joao Afonso <joao.afonso@cern.ch>
Date: Wed, 7 Dec 2022 16:32:27 +0100
Subject: [PATCH] Start with same values in both Oracle and Postgres sequences

---
 ReleaseNotes.md                                | 1 +
 catalogue/13.0/postgres_catalogue_schema.sql   | 4 ++--
 catalogue/AllCatalogueSchema.hpp               | 4 ++--
 catalogue/postgres_catalogue_schema_header.sql | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index 6e377fcfab..4428b7a35d 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -5,6 +5,7 @@
 ### Catalogue Schema
 - cta/CTA#175 - Adding UPPERCASE constraint to TAPE VID
 - cta/CTA#124 - Add column IS_ACCESSIBLE to table TAPE_FILE
+- cta/CTA#236 - Start with the same values in both Oracle and Postgres sequences
 
 # v4.8.1-1
 
diff --git a/catalogue/13.0/postgres_catalogue_schema.sql b/catalogue/13.0/postgres_catalogue_schema.sql
index d6ec0e8f61..66ebd0f506 100644
--- a/catalogue/13.0/postgres_catalogue_schema.sql
+++ b/catalogue/13.0/postgres_catalogue_schema.sql
@@ -1,6 +1,6 @@
 CREATE SEQUENCE ARCHIVE_FILE_ID_SEQ
   INCREMENT BY 1
-  START WITH 1
+  START WITH 4294967296
   NO MAXVALUE
   MINVALUE 1
   NO CYCLE
@@ -21,7 +21,7 @@ CREATE SEQUENCE MEDIA_TYPE_ID_SEQ
   CACHE 20;
 CREATE SEQUENCE STORAGE_CLASS_ID_SEQ
   INCREMENT BY 1
-  START WITH 1
+  START WITH 10000
   NO MAXVALUE
   MINVALUE 1
   NO CYCLE
diff --git a/catalogue/AllCatalogueSchema.hpp b/catalogue/AllCatalogueSchema.hpp
index dbdd34b1ce..9e2af773b2 100644
--- a/catalogue/AllCatalogueSchema.hpp
+++ b/catalogue/AllCatalogueSchema.hpp
@@ -7451,7 +7451,7 @@ namespace catalogue{
       },
   {"postgres",  "CREATE SEQUENCE ARCHIVE_FILE_ID_SEQ"
   "  INCREMENT BY 1"
-  "  START WITH 1"
+  "  START WITH 4294967296"
   "  NO MAXVALUE"
   "  MINVALUE 1"
   "  NO CYCLE"
@@ -7472,7 +7472,7 @@ namespace catalogue{
   "  CACHE 20;"
   "CREATE SEQUENCE STORAGE_CLASS_ID_SEQ"
   "  INCREMENT BY 1"
-  "  START WITH 1"
+  "  START WITH 10000"
   "  NO MAXVALUE"
   "  MINVALUE 1"
   "  NO CYCLE"
diff --git a/catalogue/postgres_catalogue_schema_header.sql b/catalogue/postgres_catalogue_schema_header.sql
index 082ddae99a..1086a88af2 100644
--- a/catalogue/postgres_catalogue_schema_header.sql
+++ b/catalogue/postgres_catalogue_schema_header.sql
@@ -1,6 +1,6 @@
 CREATE SEQUENCE ARCHIVE_FILE_ID_SEQ
   INCREMENT BY 1
-  START WITH 1
+  START WITH 4294967296
   NO MAXVALUE
   MINVALUE 1
   NO CYCLE
@@ -21,7 +21,7 @@ CREATE SEQUENCE MEDIA_TYPE_ID_SEQ
   CACHE 20;
 CREATE SEQUENCE STORAGE_CLASS_ID_SEQ
   INCREMENT BY 1
-  START WITH 1
+  START WITH 10000
   NO MAXVALUE
   MINVALUE 1
   NO CYCLE
-- 
GitLab