X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f0af5c5643d6fb69859f00e55cb52e77c3c87476..c74fcda86bdad5ecd0f7e0a12fca953acaee82cb:/lib/setup/SetupClass.php diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index b96b186b..bf44e04b 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -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'); @@ -654,9 +664,15 @@ class SetupFunctions $sTemplate .= file_get_contents($sBasePath.'importance.sql'); $sTemplate .= file_get_contents($sBasePath.'address_lookup.sql'); $sTemplate .= file_get_contents($sBasePath.'interpolation.sql'); - $sTemplate .= file_get_contents($sBasePath.'place_triggers.sql'); - $sTemplate .= file_get_contents($sBasePath.'placex_triggers.sql'); - $sTemplate .= file_get_contents($sBasePath.'postcode_triggers.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);