$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');
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);