This repository has been archived by the owner on Dec 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sfomuseumbot
committed
Mar 11, 2024
1 parent
4d86279
commit 45ab89d
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TABLE IF NOT EXISTS geojson ( | ||
id BIGINT UNSIGNED, | ||
alt VARCHAR(255) NOT NULL, | ||
body LONGBLOB NOT NULL, | ||
lastmodified INT NOT NULL, | ||
UNIQUE KEY id_alt (id, alt), | ||
KEY lastmodified (lastmodified) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package tables | ||
|
||
const WHOSONFIRST_TABLE_NAME string = "whosonfirst" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE IF NOT EXISTS whosonfirst ( | ||
id BIGINT UNSIGNED PRIMARY KEY, | ||
properties JSON NOT NULL, | ||
geometry GEOMETRY NOT NULL, | ||
centroid POINT NOT NULL COMMENT 'This is not necessary a math centroid', | ||
lastmodified INT NOT NULL, | ||
parent_id BIGINT GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(properties,'$."wof:parent_id"'))) VIRTUAL, | ||
placetype VARCHAR(64) GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(properties,'$."wof:placetype"'))) VIRTUAL, | ||
is_current TINYINT GENERATED ALWAYS AS (JSON_CONTAINS_PATH(properties, 'one', '$."mz:is_current"') AND JSON_UNQUOTE(JSON_EXTRACT(properties,'$."mz:is_current"'))) VIRTUAL, | ||
is_nullisland TINYINT GENERATED ALWAYS AS (JSON_CONTAINS_PATH(properties, 'one', '$."mz:is_nullisland"') AND JSON_LENGTH(JSON_EXTRACT(properties, '$."mz:is_nullisland"'))) VIRTUAL, | ||
is_approximate TINYINT GENERATED ALWAYS AS (JSON_CONTAINS_PATH(properties, 'one', '$."mz:is_approximate"') AND JSON_LENGTH(JSON_EXTRACT(properties, '$."mz:is_approximate"'))) VIRTUAL, | ||
is_ceased TINYINT GENERATED ALWAYS AS (JSON_CONTAINS_PATH(properties, 'one', '$."edtf:cessation"') AND JSON_UNQUOTE(JSON_EXTRACT(properties,'$."edtf:cessation"')) != "" AND JSON_UNQUOTE(JSON_EXTRACT(properties,'$."edtf:cessation"')) != "open" AND json_unquote(json_extract(properties,'$."edtf:cessation"')) != "uuuu") VIRTUAL, | ||
is_deprecated TINYINT GENERATED ALWAYS AS (JSON_CONTAINS_PATH(properties, 'one', '$."edtf:deprecated"') AND JSON_UNQUOTE(JSON_EXTRACT(properties,'$."edtf:deprecated"')) != "" AND json_unquote(json_extract(properties,'$."edtf:deprecated"')) != "uuuu") VIRTUAL, | ||
is_superseded TINYINT GENERATED ALWAYS AS (JSON_LENGTH(JSON_EXTRACT(properties, '$."wof:superseded_by"')) > 0) VIRTUAL, | ||
is_superseding TINYINT GENERATED ALWAYS AS (JSON_LENGTH(JSON_EXTRACT(properties, '$."wof:supersedes"')) > 0) VIRTUAL, | ||
date_upper DATE GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(properties, '$."date:cessation_upper"'))) VIRTUAL, | ||
date_lower DATE GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(properties, '$."date:inception_lower"'))) VIRTUAL, | ||
KEY parent_id (parent_id), | ||
KEY placetype (placetype), | ||
KEY is_current (is_current), | ||
KEY is_nullisland (is_nullisland), | ||
KEY is_approximate (is_approximate), | ||
KEY is_deprecated (is_deprecated), | ||
KEY is_superseded (is_superseded), | ||
KEY is_superseding (is_superseding), | ||
KEY date_upper (date_upper), | ||
KEY date_lower (date_lower), | ||
SPATIAL KEY idx_geometry (geometry), | ||
SPATIAL KEY idx_centroid (centroid) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |