Author: tmckay
Date: 2013-03-15 18:10:29 +0000 (Fri, 15 Mar 2013)
New Revision: 5740
Added:
trunk/cumin/model/upgrades/1.3a_to_1.4
Modified:
trunk/cumin/model/rosemary.xml
trunk/cumin/python/cumin/admin.py
Log:
Add schema upgrade script to 1.4
Modified: trunk/cumin/model/rosemary.xml
===================================================================
--- trunk/cumin/model/rosemary.xml 2013-03-14 16:04:56 UTC (rev 5739)
+++ trunk/cumin/model/rosemary.xml 2013-03-15 18:10:29 UTC (rev 5740)
@@ -159,6 +159,7 @@
<package name="com.redhat.sesame">
<class name="Sysimage">
<title>System</title>
+ <index name="nodeName" attributes="nodeName"/>
<object>
<title>%(nodeName)s</title>
Added: trunk/cumin/model/upgrades/1.3a_to_1.4
===================================================================
--- trunk/cumin/model/upgrades/1.3a_to_1.4 (rev 0)
+++ trunk/cumin/model/upgrades/1.3a_to_1.4 2013-03-15 18:10:29 UTC (rev 5740)
@@ -0,0 +1,129 @@
+#!/bin/bash
+
+function run {
+ su - postgres -c "echo $1 | psql -d cumin"
+}
+
+# Here is a query to list current com.redhat schemas
+# select distinct schemaname from pg_tables where schemaname like 'com.redhat%';
+
+# Here is one to give all the tables in a schema
+# select "tablename","schemaname" from pg_tables where schemaname
like 'com.redhat%' order by "schemaname";
+
+# You can use select to generate set set of queries for you...
+
+# select 'drop sequence "' || schemaname || '"."' ||
tablename || '_id_seq"'
+# from pg_tables
+# where schemaname = 'org.apache.qpid.cluster';
+
+run 'drop sequence
\"com.redhat.cumin.messaging\".\"BrokerGroup_id_seq\"'
+run 'drop sequence
\"com.redhat.cumin.messaging\".\"BrokerGroupMapping_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"ManagementSetupState_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"System_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Agent_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Exchange_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Binding_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Subscription_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Link_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Bridge_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Vhost_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Connection_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Session_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Queue_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.broker\".\"Broker_id_seq\"'
+run 'drop sequence
\"org.apache.qpid.cluster\".\"Cluster_id_seq\"'
+run 'drop sequence \"org.apache.qpid.acl\".\"Acl_id_seq\"'
+run 'drop sequence
\"com.redhat.rhm.store\".\"Store_id_seq\"'
+run 'drop sequence
\"com.redhat.rhm.store\".\"Journal_id_seq\"'
+
+# select 'drop table if exists "' || schemaname || '"."'
|| tablename || '" cascade'
+# from pg_tables
+# where schemaname = 'org.apache.qpid.cluster';
+
+run 'drop table if exists
\"com.redhat.cumin.messaging\".\"BrokerGroup_samples\" cascade'
+run 'drop table if exists
\"com.redhat.cumin.messaging\".\"BrokerGroupMapping_samples\"
cascade'
+run 'drop table if exists
\"com.redhat.cumin.messaging\".\"BrokerGroup\" cascade'
+run 'drop table if exists
\"com.redhat.cumin.messaging\".\"BrokerGroupMapping\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"System_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Broker_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Agent_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Vhost_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Queue_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Exchange_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Binding_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Subscription_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Connection_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Link_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Bridge_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Session_samples\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"ManagementSetupState\" cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"ManagementSetupState_samples\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"System\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Agent\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Exchange\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Binding\"
cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Subscription\" cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Link\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Bridge\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Vhost\"
cascade'
+run 'drop table if exists
\"org.apache.qpid.broker\".\"Connection\" cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Session\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Queue\"
cascade'
+run 'drop table if exists \"org.apache.qpid.broker\".\"Broker\"
cascade'
+run 'drop table if exists
\"org.apache.qpid.cluster\".\"Cluster_samples\" cascade'
+run 'drop table if exists \"org.apache.qpid.cluster\".\"Cluster\"
cascade'
+run 'drop table if exists \"org.apache.qpid.acl\".\"Acl_samples\"
cascade'
+run 'drop table if exists \"org.apache.qpid.acl\".\"Acl\"
cascade'
+
+# select 'drop table if exists "' || schemaname || '"."'
|| tablename || '" cascade'
+# from pg_tables
+# where schemaname = 'com.redhat.rhm.store';
+
+run 'drop table if exists
\"com.redhat.rhm.store\".\"Store_samples\" cascade'
+run 'drop table if exists
\"com.redhat.rhm.store\".\"Journal_samples\" cascade'
+run 'drop table if exists \"com.redhat.rhm.store\".\"Store\"
cascade'
+run 'drop table if exists \"com.redhat.rhm.store\".\"Journal\"
cascade'
+
+# select 'alter table "' || schemaname || '"."' ||
tablename || '" drop column "_qmf_create_time" cascade' from
pg_tables where
+# schemaname like 'com.redhat%' order by "schemaname";
+
+run 'alter table \"com.redhat.cumin\".\"Info\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin\".\"UserRoleMapping\" drop
column \"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin\".\"Role\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin\".\"User\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"Node\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"Limit\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"Quota\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"JobSummary\" drop
column \"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Master\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Collector\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Negotiator\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Slot\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Submitter\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"JobServer\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Scheduler\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Submission\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Grid\" drop column
\"_qmf_create_time\" cascade'
+run 'alter table \"com.redhat.sesame\".\"Sysimage\" drop column
\"_qmf_create_time\" cascade'
+
+run 'alter table \"com.redhat.cumin\".\"Info\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin\".\"UserRoleMapping\" drop
column \"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin\".\"Role\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin\".\"User\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"Node\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"Limit\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"Quota\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.cumin.grid\".\"JobSummary\" drop
column \"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Master\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Collector\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Negotiator\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Slot\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Submitter\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"JobServer\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Scheduler\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Submission\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.grid\".\"Grid\" drop column
\"_qmf_delete_time\" cascade'
+run 'alter table \"com.redhat.sesame\".\"Sysimage\" drop column
\"_qmf_delete_time\" cascade'
+
+run 'create index \"Sysimage_nodeName_idx\" on
\"com.redhat.sesame\".\"Sysimage\" \(\"nodeName\"\)'
+run 'alter table \"com.redhat.sesame\".\"Sysimage\" drop column
uuid cascade'
\ No newline at end of file
Property changes on: trunk/cumin/model/upgrades/1.3a_to_1.4
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/cumin/python/cumin/admin.py
===================================================================
--- trunk/cumin/python/cumin/admin.py 2013-03-14 16:04:56 UTC (rev 5739)
+++ trunk/cumin/python/cumin/admin.py 2013-03-15 18:10:29 UTC (rev 5740)
@@ -7,7 +7,7 @@
log = logging.getLogger("cumin.admin")
-schema_version = "1.3a"
+schema_version = "1.4"
class SchemaMissing(Exception):
pass
Show replies by date