Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Migrate versions of GPKG-RTE
create table t1 as select * from gpkgext_relations;
drop table gpkgext_relations;
CREATE TABLE 'gpkgext_relations' (
id INTEGER PRIMARY KEY AUTOINCREMENT,
geospatial_table_name TEXT NOT NULL,
geospatial_primary_column TEXT NOT NULL DEFAULT 'id',
attributes_table_name TEXT NOT NULL,
attributes_primary_column TEXT NOT NULL DEFAULT 'id',
relation_name TEXT NOT NULL,
mapping_table_name TEXT NOT NULL UNIQUE,
cardinality TEXT NOT NULL CHECK( cardinality in ('many-to-many','many-to-one','one-to-many'))
);
insert into gpkgext_relations select id,
base_table_name as geospatial_table_name,
base_primary_column as geospatial_primary_column,
attribute_table_name as attributes_table_name,
attribute_primary_column as attributes_primary_column,
relation_name, mapping_table_name, cardinality
from t1;
create table t1 as select * from cats_mapping;
drop table cats_mapping;
create table cats_mapping (
geospatial_id INTEGER NOT NULL,
attributes_id INTEGER NOT NULL
);
insert into cats_mapping select base_id as geospatial_id,
attribute_id as attributes_id from t1;
drop table t1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.