You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2021/02/16 19:16:49 UTC

[trafficcontrol] branch 5.1.x updated (91f8b71 -> d0ce67f)

This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a change to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.


    from 91f8b71  Add Traffic Ops Client Minor Fallback (#5430)
     new 363b982  Update to DB migration server_id_primary_key.sql (#5509)
     new d0ce67f  Update add_deleted_tables.sql (#5511)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG.md                                                      | 2 ++
 .../app/db/migrations/2020062923101648_add_deleted_tables.sql     | 2 +-
 .../app/db/migrations/2020082700000000_server_id_primary_key.sql  | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)


[trafficcontrol] 01/02: Update to DB migration server_id_primary_key.sql (#5509)

Posted by oc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 363b9824c4167c223473e8ea465a63db17514988
Author: Hank Beatty <hb...@users.noreply.github.com>
AuthorDate: Thu Feb 11 18:40:28 2021 -0500

    Update to DB migration server_id_primary_key.sql (#5509)
    
    I was unable to run the dbadmin upgrade because this update was trying to add 2 primary keys (one for each schema).
    
    I encountered this while trying to upgrade from 4.1.1 to 5.0.0.
    
    Co-authored-by: Hank Beatty <hb...@dev4.atl-priv.kabletown.test>
    (cherry picked from commit 46b4fd19b449823a7c76dd4bf2fa7b743a2cbde2)
---
 CHANGELOG.md                                                      | 1 +
 .../app/db/migrations/2020082700000000_server_id_primary_key.sql  | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6524f04..9d6b40e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -44,6 +44,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#5339](https://github.com/apache/trafficcontrol/issues/5339) - Ensure Changelog entries for SSL key changes
 - [#5461](https://github.com/apache/trafficcontrol/issues/5461) - Fixed steering endpoint to be ordered consistently
 - [#5395](https://github.com/apache/trafficcontrol/issues/5395) - Added validation to prevent changing the Type any Cache Group that is in use by a Topology
+- Fixed an issue with 2020082700000000_server_id_primary_key.sql trying to create multiple primary keys when there are multiple schemas.
 
 ### Changed
 - Refactored the Traffic Ops Go client internals so that all public methods have a consistent behavior/implementation
diff --git a/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql b/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql
index 3e4ed77..7581a11 100644
--- a/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql
+++ b/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql
@@ -18,9 +18,9 @@ DECLARE r record;
 BEGIN
   FOR r IN (SELECT indexname FROM pg_indexes WHERE tablename = 'server' AND indexname LIKE '%primary%')
   LOOP
-    EXECUTE 'ALTER TABLE server DROP CONSTRAINT '|| quote_ident(r.indexname) || ';';
-    EXECUTE 'ALTER TABLE ONLY server ADD CONSTRAINT '|| quote_ident(r.indexname) || ' PRIMARY KEY (id);';
+    EXECUTE 'ALTER TABLE server DROP CONSTRAINT IF EXISTS '|| quote_ident(r.indexname) || ';';
   END LOOP;
+  EXECUTE 'ALTER TABLE ONLY server ADD CONSTRAINT '|| quote_ident(r.indexname) || ' PRIMARY KEY (id);';
 END
 $$ LANGUAGE plpgsql;
 -- +goose StatementEnd
@@ -33,9 +33,9 @@ DECLARE r record;
 BEGIN
   FOR r IN (SELECT indexname FROM pg_indexes WHERE tablename = 'server' AND indexname LIKE '%primary%')
   LOOP
-    EXECUTE 'ALTER TABLE server DROP CONSTRAINT '|| quote_ident(r.indexname) || ';';
-    EXECUTE 'ALTER TABLE ONLY server ADD CONSTRAINT '|| quote_ident(r.indexname) || ' PRIMARY KEY (id, cachegroup, type, status, profile);';
+    EXECUTE 'ALTER TABLE server DROP CONSTRAINT IF EXISTS '|| quote_ident(r.indexname) || ';';
   END LOOP;
+  EXECUTE 'ALTER TABLE ONLY server ADD CONSTRAINT '|| quote_ident(r.indexname) || ' PRIMARY KEY (id, cachegroup, type, status, profile);';
 END
 $$ LANGUAGE plpgsql;
 -- +goose StatementEnd


[trafficcontrol] 02/02: Update add_deleted_tables.sql (#5511)

Posted by oc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit d0ce67f37130e2f8027573c0411a42f31ef12652
Author: Hank Beatty <hb...@users.noreply.github.com>
AuthorDate: Thu Feb 11 18:54:25 2021 -0500

    Update add_deleted_tables.sql (#5511)
    
    The create function call was not adding the function to the public schema
    which was causing the subsequent "ALTER FUNCTION" call to fail.
    
    Co-authored-by: Hank Beatty <hb...@dev4.atl-priv.kabletown.test>
    (cherry picked from commit 0271247fb903fba3163b3d6025f72678b32ce724)
---
 CHANGELOG.md                                                          | 1 +
 traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d6b40e..54716ef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,6 +45,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#5461](https://github.com/apache/trafficcontrol/issues/5461) - Fixed steering endpoint to be ordered consistently
 - [#5395](https://github.com/apache/trafficcontrol/issues/5395) - Added validation to prevent changing the Type any Cache Group that is in use by a Topology
 - Fixed an issue with 2020082700000000_server_id_primary_key.sql trying to create multiple primary keys when there are multiple schemas.
+- Fix for public schema in 2020062923101648_add_deleted_tables.sql
 
 ### Changed
 - Refactored the Traffic Ops Go client internals so that all public methods have a consistent behavior/implementation
diff --git a/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql b/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql
index c22a042..4f15b05 100644
--- a/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql
+++ b/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql
@@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS last_deleted (
 --
 -- Name: on_delete_current_timestamp_last_updated(); Type: FUNCTION; Schema: public; Owner: traffic_ops
 --
-CREATE OR REPLACE FUNCTION on_delete_current_timestamp_last_updated()
+CREATE OR REPLACE FUNCTION public.on_delete_current_timestamp_last_updated()
     RETURNS trigger
     AS $$
 BEGIN