mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
move trigger creation later in setup
This commit is contained in:
@@ -235,7 +235,17 @@ class SetupFunctions
|
|||||||
$oAlParser->createTable($this->oDB, 'address_levels');
|
$oAlParser->createTable($this->oDB, 'address_levels');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createPartitionTables()
|
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');
|
info('Create Partition Tables');
|
||||||
|
|
||||||
@@ -654,9 +664,15 @@ class SetupFunctions
|
|||||||
$sTemplate .= file_get_contents($sBasePath.'importance.sql');
|
$sTemplate .= file_get_contents($sBasePath.'importance.sql');
|
||||||
$sTemplate .= file_get_contents($sBasePath.'address_lookup.sql');
|
$sTemplate .= file_get_contents($sBasePath.'address_lookup.sql');
|
||||||
$sTemplate .= file_get_contents($sBasePath.'interpolation.sql');
|
$sTemplate .= file_get_contents($sBasePath.'interpolation.sql');
|
||||||
$sTemplate .= file_get_contents($sBasePath.'place_triggers.sql');
|
if ($this->oDB->tableExists('place')) {
|
||||||
$sTemplate .= file_get_contents($sBasePath.'placex_triggers.sql');
|
$sTemplate .= file_get_contents($sBasePath.'place_triggers.sql');
|
||||||
$sTemplate .= file_get_contents($sBasePath.'postcode_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);
|
$sTemplate = str_replace('{modulepath}', $this->sModulePath, $sTemplate);
|
||||||
if ($this->bEnableDiffUpdates) {
|
if ($this->bEnableDiffUpdates) {
|
||||||
$sTemplate = str_replace('RETURN NEW; -- %DIFFUPDATES%', '--', $sTemplate);
|
$sTemplate = str_replace('RETURN NEW; -- %DIFFUPDATES%', '--', $sTemplate);
|
||||||
|
|||||||
@@ -188,26 +188,6 @@ GRANT SELECT ON planet_osm_ways to "{www-user}" ;
|
|||||||
GRANT SELECT ON planet_osm_rels to "{www-user}" ;
|
GRANT SELECT ON planet_osm_rels to "{www-user}" ;
|
||||||
GRANT SELECT on location_area to "{www-user}" ;
|
GRANT SELECT on location_area to "{www-user}" ;
|
||||||
|
|
||||||
-- insert creates the location tables, creates location indexes if indexed == true
|
|
||||||
CREATE TRIGGER placex_before_insert BEFORE INSERT ON placex
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE placex_insert();
|
|
||||||
CREATE TRIGGER osmline_before_insert BEFORE INSERT ON location_property_osmline
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE osmline_insert();
|
|
||||||
|
|
||||||
-- update insert creates the location tables
|
|
||||||
CREATE TRIGGER placex_before_update BEFORE UPDATE ON placex
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE placex_update();
|
|
||||||
CREATE TRIGGER osmline_before_update BEFORE UPDATE ON location_property_osmline
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE osmline_update();
|
|
||||||
|
|
||||||
-- diff update triggers
|
|
||||||
CREATE TRIGGER placex_before_delete AFTER DELETE ON placex
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE placex_delete();
|
|
||||||
CREATE TRIGGER place_before_delete BEFORE DELETE ON place
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE place_delete();
|
|
||||||
CREATE TRIGGER place_before_insert BEFORE INSERT ON place
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE place_insert();
|
|
||||||
|
|
||||||
-- Table for synthetic postcodes.
|
-- Table for synthetic postcodes.
|
||||||
DROP TABLE IF EXISTS location_postcode;
|
DROP TABLE IF EXISTS location_postcode;
|
||||||
CREATE TABLE location_postcode (
|
CREATE TABLE location_postcode (
|
||||||
@@ -224,9 +204,6 @@ CREATE TABLE location_postcode (
|
|||||||
CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry) {ts:address-index};
|
CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry) {ts:address-index};
|
||||||
GRANT SELECT ON location_postcode TO "{www-user}" ;
|
GRANT SELECT ON location_postcode TO "{www-user}" ;
|
||||||
|
|
||||||
CREATE TRIGGER location_postcode_before_update BEFORE UPDATE ON location_postcode
|
|
||||||
FOR EACH ROW EXECUTE PROCEDURE postcode_update();
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS import_polygon_error;
|
DROP TABLE IF EXISTS import_polygon_error;
|
||||||
CREATE TABLE import_polygon_error (
|
CREATE TABLE import_polygon_error (
|
||||||
osm_id BIGINT,
|
osm_id BIGINT,
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ if ($aCMDResult['create-tables'] || $aCMDResult['all']) {
|
|||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
$oSetup->createTables($aCMDResult['reverse-only']);
|
$oSetup->createTables($aCMDResult['reverse-only']);
|
||||||
$oSetup->createFunctions();
|
$oSetup->createFunctions();
|
||||||
|
$oSetup->createTableTriggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-partition-tables'] || $aCMDResult['all']) {
|
if ($aCMDResult['create-partition-tables'] || $aCMDResult['all']) {
|
||||||
|
|||||||
Reference in New Issue
Block a user