]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/setup/SetupClass.php
fix indent
[nominatim.git] / lib / setup / SetupClass.php
index 640f387005db6caefada0ffba48230fe5b09fa1b..bf44e04b299068e47f4992f947dcd967f26fb098 100755 (executable)
@@ -235,6 +235,16 @@ class SetupFunctions
         $oAlParser->createTable($this->oDB, 'address_levels');
     }
 
+    public function createTableTriggers()
+    {
+        info('Create Tables');
+
+        $sTemplate = file_get_contents(CONST_BasePath.'/sql/table-triggers.sql');
+        $sTemplate = $this->replaceSqlPatterns($sTemplate);
+
+        $this->pgsqlRunScript($sTemplate, false);
+    }
+
     public function createPartitionTables()
     {
         info('Create Partition Tables');
@@ -649,11 +659,20 @@ class SetupFunctions
     private function createSqlFunctions()
     {
         $sBasePath = CONST_BasePath.'/sql/functions/';
-        $sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql');
+        $sTemplate = file_get_contents($sBasePath.'utils.sql');
         $sTemplate .= file_get_contents($sBasePath.'normalization.sql');
         $sTemplate .= file_get_contents($sBasePath.'importance.sql');
         $sTemplate .= file_get_contents($sBasePath.'address_lookup.sql');
         $sTemplate .= file_get_contents($sBasePath.'interpolation.sql');
+        if ($this->oDB->tableExists('place')) {
+            $sTemplate .= file_get_contents($sBasePath.'place_triggers.sql');
+        }
+        if ($this->oDB->tableExists('placex')) {
+            $sTemplate .= file_get_contents($sBasePath.'placex_triggers.sql');
+        }
+        if ($this->oDB->tableExists('location_postcode')) {
+            $sTemplate .= file_get_contents($sBasePath.'postcode_triggers.sql');
+        }
         $sTemplate = str_replace('{modulepath}', $this->sModulePath, $sTemplate);
         if ($this->bEnableDiffUpdates) {
             $sTemplate = str_replace('RETURN NEW; -- %DIFFUPDATES%', '--', $sTemplate);