[ARVADOS] created: 02a3aa9016f4d4fc46eb11a56e121eb4ea0e3453

git at public.curoverse.com git at public.curoverse.com
Fri Jun 26 02:57:56 EDT 2015


        at  02a3aa9016f4d4fc46eb11a56e121eb4ea0e3453 (commit)


commit 02a3aa9016f4d4fc46eb11a56e121eb4ea0e3453
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 26 02:54:31 2015 -0400

    5677: Edit structure.sql after db:structure:dump: avoid warnings when loading, and editwars when committing.

diff --git a/services/api/Rakefile b/services/api/Rakefile
index 22b2531..fbbf53e 100644
--- a/services/api/Rakefile
+++ b/services/api/Rakefile
@@ -32,3 +32,34 @@ namespace :test do
     end
   end
 end
+
+namespace :db do
+  namespace :structure do
+    task :dump do
+      require 'tempfile'
+      origfnm = File.expand_path('../db/structure.sql', __FILE__)
+      tmpfnm = Tempfile.new 'structure.sql', File.expand_path('..', origfnm)
+      begin
+        tmpfile = File.new tmpfnm, 'w'
+        origfile = File.new origfnm
+        origfile.each_line do |line|
+          if /^SET lock_timeout = 0;/ =~ line
+            # Avoid edit wars between versions that do/don't write this line.
+            next
+          elsif /^COMMENT ON EXTENSION/ =~ line
+            # Avoid warning message when loading:
+            # "structure.sql:22: ERROR:  must be owner of extension plpgsql"
+            tmpfile.write "-- "
+          end
+          tmpfile.write line
+        end
+        origfile.close
+        tmpfile.close
+        File.rename tmpfnm, origfnm
+        tmpfnm = false
+      ensure
+        File.unlink tmpfnm if tmpfnm
+      end
+    end
+  end
+end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index 0eef6b4..01bb417 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -19,7 +19,7 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
 --
 
-COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
+-- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
 
 
 SET search_path = public, pg_catalog;

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list