← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16645: Script

 

------------------------------------------------------------
revno: 16645
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-09-07 23:15:42 -0400
message:
  Script
modified:
  resources/sql/div.sql


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'resources/sql/div.sql'
--- resources/sql/div.sql	2014-03-12 16:49:52 +0000
+++ resources/sql/div.sql	2014-09-08 03:15:42 +0000
@@ -218,10 +218,24 @@
 created = (created + interval '1 year'),
 lastupdated = (lastupdated + interval '1 year');
 
--- Replace first digit in invalid uid with letter a
+-- (Write) Replace first digit in invalid uid with letter a
 
 update organisationunit set uid = regexp_replace(uid,'\d','a') where uid SIMILAR TO '[0-9]%';
 
+-- (Write) Delete validation rules and clean up expressions
+
+delete from validationrule where name = 'abc';
+delete from expressiondataelement where expressionid not in (
+  select leftexpressionid from validationrule
+  union all
+  select rightexpressionid from validationrule
+);
+delete from expression where expressionid not in (
+  select leftexpressionid from validationrule
+  union all
+  select rightexpressionid from validationrule
+);
+
 -- (Write) Insert random org unit codes
 
 create function setrandomcode() returns integer AS $$