]> git.openstreetmap.org Git - nominatim.git/blob - wikidata/create.sql
recompile installation instructions
[nominatim.git] / wikidata / create.sql
1 DROP TABLE entity;
2 DROP TABLE entity_label;
3 DROP TABLE entity_description;
4 DROP TABLE entity_alias;
5 DROP TABLE entity_link;
6 DROP TABLE entity_property;
7
8 CREATE TABLE entity (
9     entity_id           bigint,
10     title               text,
11     pid                 bigint,
12     qid                 bigint,
13     datatype            text,
14     CONSTRAINT pk_entity PRIMARY KEY(entity_id)
15 );
16
17 CREATE TABLE entity_label  (
18     entity_id           bigint,
19     language            text,
20     label               text,
21     CONSTRAINT pk_entity_label PRIMARY KEY(entity_id,language)
22 );
23
24 CREATE TABLE entity_description  (
25     entity_id           bigint,
26     language            text,
27     description         text,
28     CONSTRAINT pk_entity_description PRIMARY KEY(entity_id,language)
29 );
30
31 CREATE TABLE entity_alias  (
32     entity_id           bigint,
33     language            text,
34     alias               text,
35     CONSTRAINT pk_entity_alias PRIMARY KEY(entity_id,language,alias)
36 );
37
38 CREATE TABLE entity_link  (
39     entity_id           bigint,
40     target              text,
41     value               text,
42     CONSTRAINT pk_entity_link PRIMARY KEY(entity_id,target)
43 );
44
45 CREATE TABLE entity_link_hit  (
46     entity_id           bigint,
47     target              text,
48     value               text,
49     hits                bigint,
50     CONSTRAINT pk_entity_link_hit PRIMARY KEY(entity_id,target)
51 );
52
53 CREATE TABLE link_hit  (
54     target              text,
55     value               text,
56     hits                bigint,
57     CONSTRAINT pk_link_hit PRIMARY KEY(target,value)
58 );
59
60 CREATE TABLE entity_property  (
61     entity_id           bigint,
62     order_id            bigint,
63     pid                 bigint,
64     string              text,
65     toqid               bigint,
66     location            geometry,
67     datetime            timestamp with time zone,
68     CONSTRAINT pk_entity_property PRIMARY KEY(entity_id, order_id)
69 );
70
71 CREATE TABLE import_link_hit  (
72     target              text,
73     value               text,
74     hits                bigint
75 );