rel-eng/packages/spacewalk-schema
| 2
schema/spacewalk/spacewalk-schema.spec
| 5
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/035-rhn_org.pkb.sql.postgresql
| 69 ++++++----
3 files changed, 49 insertions(+), 27 deletions(-)
New commits:
commit bebb87edbc56d3cbabd3c3dca19922240bbe2c40
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Apr 30 17:05:34 2012 +0200
Automatic commit of package [spacewalk-schema] release [1.8.27-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index d86129f..d748599 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.8.26-1 schema/spacewalk/
+1.8.27-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec
b/schema/spacewalk/spacewalk-schema.spec
index 6596eda..6171e4b 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -2,7 +2,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 1.8.26
+Version: 1.8.27
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -69,6 +69,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Mon Apr 30 2012 Jan Pazdziora 1.8.27-1
+- Using PostgreSQL version of rhn_org.delete_org in upgrade scripts.
+
* Mon Apr 30 2012 Miroslav Suchý <msuchy(a)redhat.com> 1.8.26-1
- 719609 - make arm channels compatible with noarch packages
commit 6c233fa195ce033829a8752945884d800e4e5a06
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Apr 30 16:58:01 2012 +0200
Using PostgreSQL version of rhn_org.delete_org in upgrade scripts.
UPDATE 0
psql:/var/log/spacewalk/schema-upgrade/20120430-102926-script.sql:5737: ERROR: syntax
error at or near "procedure"
LINE 2: procedure delete_org (
^
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/035-rhn_org.pkb.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/035-rhn_org.pkb.sql.postgresql
index bc3c148..3fd1f35 100644
---
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/035-rhn_org.pkb.sql.postgresql
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/035-rhn_org.pkb.sql.postgresql
@@ -1,58 +1,75 @@
-- oracle equivalent source sha1 48f766d7e2ec61890c48645c66978f81eab2cdbe
-
---update pg_setting
+--
+-- Copyright (c) 2008--2012 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+--
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+-- create schema rhn_org;
+
+-- setup search_path so that these functions are created in appropriate schema.
update pg_settings set setting = 'rhn_org,' || setting where name =
'search_path';
-create or replace
- procedure delete_org (
- org_id_in in number
- )
- is
- cursor users is
+create or replace function delete_org (
+ org_id_in in numeric
+ ) returns void
+ as
+ $$
+ declare
+ users cursor for
select id
from web_contact
where org_id = org_id_in;
- cursor servers(org_id_in in number) is
- select id
+ servers cursor (org_id_in numeric) for
+ select id
from rhnServer
- where org_id = org_id_in;
+ where org_id = org_id_in;
- cursor config_channels is
+ config_channels cursor for
select id
from rhnConfigChannel
where org_id = org_id_in;
- cursor custom_channels is
- select id
+ custom_channels cursor for
+ select id
from rhnChannel
- where org_id = org_id_in;
+ where org_id = org_id_in;
- cursor errata is
- select id
+ errata cursor for
+ select id
from rhnErrata
- where org_id = org_id_in;
+ where org_id = org_id_in;
begin
if org_id_in = 1 then
- rhn_exception.raise_exception('cannot_delete_base_org');
+ perform rhn_exception.raise_exception('cannot_delete_base_org');
end if;
-- Delete all users.
for u in users loop
- rhn_org.delete_user(u.id, 1);
+ perform rhn_org.delete_user(u.id, 1);
end loop;
-- Delete all servers.
for s in servers(org_id_in) loop
- delete_server(s.id);
+ perform delete_server(s.id);
end loop;
-- Delete all config channels.
for c in config_channels loop
- rhn_config.delete_channel(c.id);
+ perform rhn_config.delete_channel(c.id);
end loop;
-- Delete all custom channels.
@@ -70,7 +87,7 @@ create or replace
end loop;
-- Give the org's entitlements back to the main org.
- rhn_entitlements.remove_org_entitlements(org_id_in);
+ perform rhn_entitlements.remove_org_entitlements(org_id_in);
-- Clean up tables where we don't have a cascading delete.
delete from rhnChannel where org_id = org_id_in;
@@ -91,8 +108,10 @@ create or replace
-- Delete the org.
delete from web_customer where id = org_id_in;
- end delete_org;
+ end;
+ $$
+ language plpgsql;
-- restore the original setting
-update pg_settings set setting = overlay( setting placing '' from 1 for
(length('rhn_channel')+1) ) where name = 'search_path';
+update pg_settings set setting = overlay( setting placing '' from 1 for
(length('rhn_org')+1) ) where name = 'search_path';