UpdateDatabase.php
authorAlan Knowles <alan@roojs.com>
Tue, 7 Oct 2014 06:16:23 +0000 (14:16 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 7 Oct 2014 06:16:23 +0000 (14:16 +0800)
UpdateDatabase.php

index 3b1d5d6..6ac8cad 100644 (file)
@@ -120,6 +120,40 @@ class Pman_Xtuple_UpdateDatabase extends Pman_Core_UpdateDatabase
     function importModuleSQL()
     {
         
+            echo "Importing SQL from module $m\n";
+            
+            $dirmethod = 'importpgsqldir';
+            
+            // if init has been called
+            // look in pgsql.ini
+            if (!empty($this->opts['init'])) {
+                $this->{$dirmethod}($dburl, $this->rootDir. "/Pman/$m/{$dbtype}.init");
+                
+            }
+            
+            
+            
+            $fd = $this->rootDir. "/Pman/$m/DataObjects";
+            
+            $this->{$dirmethod}($dburl, $fd);
+            
+            // new -- sql directory..
+            // new style will not support migrate ... they have to go into mysql-migrate.... directories..
+            // new style will not support pg.sql etc.. naming - that's what the direcotries are for..
+            
+            $this->{$dirmethod}($dburl, $this->rootDir. "/Pman/$m/sql");
+            $this->{$dirmethod}($dburl, $this->rootDir. "/Pman/$m/{$dbtype}");
+            
+            
+            
+            if (!empty($this->opts['init']) && file_exists($this->rootDir. "/Pman/$m/{$dbtype}.initdata")) {
+                HTML_FlexyFramework::get()->generateDataobjectsCache(true);
+                
+                $this->{$dirmethod}($dburl, $this->rootDir. "/Pman/$m/{$dbtype}.initdata");
+                $this->{'fixSequences'. $dbtype}();
+                
+            }
+              
     }