Let imposm3 handle cascade delete tables #397

pull/398/head
lukasmartinelli 2016-08-12 10:55:52 +02:00
rodzic 4bcfaf6a4f
commit 0a7774e1fd
3 zmienionych plików z 1 dodań i 21 usunięć

Wyświetl plik

@ -15,7 +15,7 @@ WORKDIR $GOPATH/src/github.com/omniscale/imposm3
RUN go get github.com/tools/godep \
&& git clone https://github.com/osm2vectortiles/imposm3 \
$GOPATH/src/github.com/omniscale/imposm3 \
&& git reset --hard 060f4111fcaf459e8b09a0351836dfe8eb4dc943 \
&& git reset --hard 93537a867246322f2d249da86c854f66d85dabc7 \
&& go get \
&& go install

Wyświetl plik

@ -26,7 +26,6 @@ function download_pbf() {
function import_pbf() {
local pbf_file="$1"
drop_tables
create_timestamp_history
if [ "$DIFFS" = true ]; then
echo "Importing in diff mode"
@ -133,12 +132,6 @@ function create_tracking_triggers() {
exec_sql "SELECT create_tracking_triggers()"
}
function drop_tables() {
# if drop function does not exist
# the tables don't exist yet as well
exec_sql "SELECT drop_tables()" || true
}
function cleanup_osm_changes() {
exec_sql "SELECT cleanup_osm_tracking_tables()"
}

Wyświetl plik

@ -141,16 +141,3 @@ BEGIN
END LOOP;
END;
$$ language plpgsql;
CREATE OR REPLACE FUNCTION drop_tables() returns VOID AS $$
DECLARE t osm_tables%ROWTYPE;
BEGIN
FOR t IN
SELECT * FROM osm_tables
UNION
SELECT * FROM osm_tables_delete
LOOP
EXECUTE format('DROP TABLE IF EXISTS %I CASCADE', t.table_name);
END LOOP;
END;
$$ language plpgsql;