source: trunk/models/base/base_structure.sql @ 26

Revision 20, 10.5 KB checked in by lucsch, 12 years ago (diff)

Data model is now updated to version 225

RevLine 
[7]1-- DATABASE STRUCTURE --
2-- dmn_attribut_value --
3CREATE TABLE `dmn_attribut_value` (
4  `ATTRIBUT_ID` int(11) NOT NULL,
5  `CATALOG_ID` int(11) NOT NULL,
6  PRIMARY KEY (`ATTRIBUT_ID`,`CATALOG_ID`)
[18]7) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]8
9-- dmn_catalog --
10CREATE TABLE `dmn_catalog` (
11  `CATALOG_ID` int(11) NOT NULL AUTO_INCREMENT,
12  `CODE` varchar(50) DEFAULT NULL,
13  `DESCRIPTION_0` varchar(255) DEFAULT NULL,
14  `DESCRIPTION_1` varchar(255) DEFAULT NULL,
15  `DESCRIPTION_2` varchar(255) DEFAULT NULL,
16  `DESCRIPTION_3` varchar(255) DEFAULT NULL,
17  `DESCRIPTION_4` varchar(255) DEFAULT NULL,
18  PRIMARY KEY (`CATALOG_ID`)
[18]19) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]20
21-- dmn_layer_attribut --
22CREATE TABLE `dmn_layer_attribut` (
23  `ATTRIBUT_ID` int(11) NOT NULL AUTO_INCREMENT,
24  `LAYER_INDEX` int(11) NOT NULL,
25  `ATTRIBUT_NAME` varchar(100) DEFAULT NULL,
26  PRIMARY KEY (`ATTRIBUT_ID`,`LAYER_INDEX`)
[18]27) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]28
29-- dmn_layer_object --
30CREATE TABLE `dmn_layer_object` (
31  `OBJECT_ID` bigint(20) NOT NULL AUTO_INCREMENT,
[20]32  `OBJECT_CD` varchar(50) NULL COMMENT 'Feature code',
[7]33  `OBJECT_TYPE_CD` int(10) unsigned NOT NULL COMMENT 'Spatial object code',
34  `THEMATIC_LAYERS_LAYER_INDEX` int(10) unsigned NOT NULL COMMENT 'Associated thematic layer',
35  `OBJECT_DESC_0` varchar(255) NOT NULL COMMENT 'Feature description',
36  `OBJECT_DESC_1` varchar(255) DEFAULT NULL,
37  `OBJECT_DESC_2` varchar(255) DEFAULT NULL,
38  `OBJECT_DESC_3` varchar(255) DEFAULT NULL,
39  `OBJECT_DESC_4` varchar(255) DEFAULT NULL,
40  `OBJECT_ISFREQ` tinyint(1) NOT NULL DEFAULT '0',
41  `SYMBOL_CD` varchar(20) DEFAULT NULL COMMENT 'Feature symbology',
42  `RANK` int(11) DEFAULT NULL,
43  `REMARK` varchar(100) DEFAULT NULL,
44  PRIMARY KEY (`OBJECT_ID`),
45  KEY `DMN_LAYER_OBJECT_FKIndex2` (`THEMATIC_LAYERS_LAYER_INDEX`,`OBJECT_ID`)
[18]46) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]47
48-- dmn_layer_type --
49CREATE TABLE `dmn_layer_type` (
50  `TYPE_CD` int(10) unsigned NOT NULL COMMENT 'Layer type code',
51  `TYPE_DESCRIPTION` varchar(20) NOT NULL COMMENT 'Layer type description',
52  PRIMARY KEY (`TYPE_CD`)
[18]53) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]54
55
56INSERT INTO dmn_layer_type VALUES(0,"Line");
57INSERT INTO dmn_layer_type VALUES(1,"Point");
58INSERT INTO dmn_layer_type VALUES(2,"Polygon");
59
60
61-- dmn_shortcut_key --
62CREATE TABLE `dmn_shortcut_key` (
63  `SHORTCUT_CD` int(10) unsigned NOT NULL AUTO_INCREMENT,
64  `SHORTCUT_KEY` varchar(20) NOT NULL,
65  `SHORTCUT_DESC` varchar(255) DEFAULT NULL,
66  PRIMARY KEY (`SHORTCUT_CD`)
[18]67) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]68
69INSERT INTO dmn_shortcut_key VALUES(1,"F1","");
70INSERT INTO dmn_shortcut_key VALUES(2,"F2","");
71INSERT INTO dmn_shortcut_key VALUES(3,"F3","");
72INSERT INTO dmn_shortcut_key VALUES(4,"F4","");
73INSERT INTO dmn_shortcut_key VALUES(5,"F5","");
74INSERT INTO dmn_shortcut_key VALUES(6,"F6","");
75INSERT INTO dmn_shortcut_key VALUES(7,"F7","");
76INSERT INTO dmn_shortcut_key VALUES(8,"F8","");
77INSERT INTO dmn_shortcut_key VALUES(9,"F9","");
78INSERT INTO dmn_shortcut_key VALUES(10,"F10","");
79INSERT INTO dmn_shortcut_key VALUES(11,"F11","");
80INSERT INTO dmn_shortcut_key VALUES(12,"F12","");
81
82
83-- export_poly --
84CREATE TABLE `export_poly` (
85  `LAYER_INDEX` int(11) NOT NULL,
86  `RASTER_FACTOR` double DEFAULT NULL,
87  `NB_EXPORT` int(11) DEFAULT NULL,
88  `PERCENT_SKIPPED` double DEFAULT NULL,
89  PRIMARY KEY (`LAYER_INDEX`)
[18]90) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]91
92-- generic_aat --
93CREATE TABLE `generic_aat` (
94  `OBJECT_VAL_ID` int(10) unsigned NOT NULL,
95  `OBJECT_GEOM_ID` int(10) unsigned NOT NULL,
96  PRIMARY KEY (`OBJECT_VAL_ID`,`OBJECT_GEOM_ID`),
97  KEY `GENERIC_LINES_has_DMN_LAYER_OBJECT_FKIndex1` (`OBJECT_VAL_ID`),
98  KEY `GENERIC_LINES_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_GEOM_ID`)
[18]99) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]100
101-- generic_dmn --
102CREATE TABLE `generic_dmn` (
103  `CODE` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Code value',
104  `DESCRIPTION` varchar(255) DEFAULT NULL COMMENT 'Code description',
105  PRIMARY KEY (`CODE`)
[18]106) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]107
108-- generic_frame --
109CREATE TABLE `generic_frame` (
110  `OBJECT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Feature identifier',
111  `OBJECT_GEOMETRY` linestring NOT NULL COMMENT 'Feature geometry',
112  PRIMARY KEY (`OBJECT_ID`)
[18]113) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]114
115-- generic_labels --
116CREATE TABLE `generic_labels` (
117  `OBJECT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
118  `OBJECT_GEOMETRY` multipoint NOT NULL,
119  PRIMARY KEY (`OBJECT_ID`)
[18]120) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]121
122-- generic_lat --
123CREATE TABLE `generic_lat` (
124  `OBJECT_VAL_ID` int(10) unsigned NOT NULL,
125  `OBJECT_GEOM_ID` int(10) unsigned NOT NULL,
126  PRIMARY KEY (`OBJECT_VAL_ID`,`OBJECT_GEOM_ID`),
127  KEY `GENERIC_LABELS_has_DMN_LAYER_OBJECT_FKIndex1` (`OBJECT_VAL_ID`),
128  KEY `GENERIC_LABELS_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_GEOM_ID`)
[18]129) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]130
131-- generic_lines --
132CREATE TABLE `generic_lines` (
133  `OBJECT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
134  `OBJECT_GEOMETRY` linestring NOT NULL,
135  PRIMARY KEY (`OBJECT_ID`)
[18]136) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]137
138-- generic_notes --
139CREATE TABLE `generic_notes` (
140  `OBJECT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
141  `OBJECT_GEOMETRY` multipoint NOT NULL,
142  `PRIORITY_CD` tinyint(4) DEFAULT '0',
143  `CODE_CD` tinyint(4) DEFAULT '0',
144  `AUTHOR` varchar(255) DEFAULT NULL,
145  `NOTE_DATE` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
146  `DESCRIPTION` text,
147  `ISFIXED` tinyint(1) DEFAULT '0',
148  PRIMARY KEY (`OBJECT_ID`)
[18]149) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]150
151-- generic_pat --
152CREATE TABLE `generic_pat` (
153  `OBJECT_VAL_ID` int(10) unsigned NOT NULL,
154  `OBJECT_GEOM_ID` int(10) unsigned NOT NULL,
155  PRIMARY KEY (`OBJECT_VAL_ID`,`OBJECT_GEOM_ID`),
156  KEY `GENERIC_POINTS_has_DMN_LAYER_OBJECT_FKIndex1` (`OBJECT_VAL_ID`),
157  KEY `GENERIC_POINTS_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_GEOM_ID`)
[18]158) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]159
160-- generic_points --
161CREATE TABLE `generic_points` (
162  `OBJECT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Feature identifier',
163  `OBJECT_GEOMETRY` multipoint NOT NULL COMMENT 'Feature geometry',
164  PRIMARY KEY (`OBJECT_ID`)
[18]165) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]166
167-- lang_def --
168CREATE TABLE `lang_def` (
169  `LANG_ID` int(11) NOT NULL,
170  `LANG_NAME` varchar(50) DEFAULT NULL,
171  PRIMARY KEY (`LANG_ID`)
[18]172) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]173
174
175INSERT INTO lang_def VALUES(0,"Undefined");
176INSERT INTO lang_def VALUES(1,"Undefined");
177INSERT INTO lang_def VALUES(2,"Undefined");
178INSERT INTO lang_def VALUES(3,"Undefined");
179INSERT INTO lang_def VALUES(4,"Undefined");
180
181
182-- prj_queries --
183CREATE TABLE `prj_queries` (
184  `QUERIES_ID` int(11) NOT NULL AUTO_INCREMENT,
185  `QUERIES_TARGET` int(11) NOT NULL,
186  `QUERIES_NAME` varchar(255) NOT NULL,
187  `QUERIES_CODE` varchar(1000) DEFAULT NULL,
188  PRIMARY KEY (`QUERIES_ID`)
[18]189) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]190
191INSERT INTO prj_queries VALUES(1,0,"Lines without attribution","SELECT o.OBJECT_ID FROM generic_lines AS o WHERE o.OBJECT_ID NOT IN (SELECT a.OBJECT_GEOM_ID FROM generic_aat AS a)");
192INSERT INTO prj_queries VALUES(2,1,"Points without attribution","SELECT o.OBJECT_ID FROM generic_points AS o WHERE o.OBJECT_ID NOT IN (SELECT a.OBJECT_GEOM_ID FROM generic_pat AS a)");
193INSERT INTO prj_queries VALUES(3,2,"Labels without attribution","SELECT o.OBJECT_ID FROM generic_labels AS o WHERE o.OBJECT_ID NOT IN (SELECT a.OBJECT_GEOM_ID FROM generic_lat AS a)");
194
195
196-- prj_settings --
197CREATE TABLE `prj_settings` (
198  `SETTING_DBK` int(11) NOT NULL AUTO_INCREMENT,
199  `PRJ_UNIT` varchar(10) NOT NULL,
200  `PRJ_PROJECTION` varchar(45) NOT NULL,
201  `PRJ_NAME` varchar(45) NOT NULL,
202  `PRJ_VERSION` int(11) NOT NULL,
203  `PRJ_EXPORT_PATH` varchar(255) DEFAULT NULL,
204  `PRJ_EXPORT_TYPE` int(11) DEFAULT '0',
205  `PRJ_BACKUP_PATH` varchar(255) DEFAULT NULL,
206  `PRJ_AUTHORS` varchar(255) DEFAULT NULL,
207  `PRJ_SUMMARY` text,
208  `PRJ_SNAP_TOLERENCE` int(11) NOT NULL DEFAULT '10',
209  PRIMARY KEY (`SETTING_DBK`)
[18]210) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]211
212
[20]213INSERT INTO prj_settings VALUES(1,"Meters","No projection","Master",225,"",0,"","SWISSTOPO - CREALP", "", 0);
[7]214
215-- prj_snapping --
216CREATE TABLE `prj_snapping` (
217  `TOC_ID` int(11) NOT NULL,
218  `SNAPPING_TYPE` int(11) NOT NULL,
219  PRIMARY KEY (`TOC_ID`)
[18]220) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]221
222-- prj_stats --
223CREATE TABLE `prj_stats` (
224  `STAT_ID` int(11) NOT NULL AUTO_INCREMENT,
225  `DATE_START` datetime NOT NULL,
226  `CLICK` bigint(20) unsigned DEFAULT '0',
227  `ATTRIBUTION` bigint(20) unsigned DEFAULT '0',
228  `INTERSECTION` bigint(20) unsigned DEFAULT '0',
229  `DATE_END` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
230  PRIMARY KEY (`STAT_ID`)
[18]231) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]232
233-- prj_toc --
234CREATE TABLE `prj_toc` (
235  `CONTENT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
236  `TYPE_CD` int(10) unsigned NOT NULL,
237  `CONTENT_PATH` varchar(255) DEFAULT NULL,
238  `CONTENT_NAME` varchar(255) DEFAULT NULL,
239  `CONTENT_STATUS` tinyint(1) DEFAULT '1',
240  `GENERIC_LAYERS` tinyint(4) DEFAULT '100',
241  `RANK` int(11) DEFAULT NULL,
242  `SYMBOLOGY` mediumtext,
243  `VERTEX_FLAGS` tinyint(4) DEFAULT NULL,
244  PRIMARY KEY (`CONTENT_ID`),
245  KEY `PRJ_TOC_FKIndex1` (`TYPE_CD`)
[18]246) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]247
248
[18]249INSERT INTO prj_toc VALUES(1,0,"","Lines",1,0,1,"",0);
250INSERT INTO prj_toc VALUES(2,1,"","Points",1,1,2,"",0);
251INSERT INTO prj_toc VALUES(3,1,"","Labels",1,2,3,"",0);
252INSERT INTO prj_toc VALUES(4,1,"","Notes",0,3,4,"",0);
253INSERT INTO prj_toc VALUES(5,0,"","Frame",1,4,5,"",0);
[7]254
255
256-- shortcut_list --
257CREATE TABLE `shortcut_list` (
258  `OBJECT_ID` int(10) unsigned NOT NULL,
259  `SHORTCUT_CD` int(10) unsigned NOT NULL,
260  PRIMARY KEY (`OBJECT_ID`,`SHORTCUT_CD`),
261  KEY `SHORTCUT_KEYS_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_ID`),
262  KEY `SHORTCUT_LIST_FKIndex2` (`SHORTCUT_CD`)
[18]263) ENGINE=MyISAM DEFAULT CHARSET=utf8;
[7]264
265-- thematic_layers --
266CREATE TABLE `thematic_layers` (
267  `LAYER_INDEX` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Theme index',
268  `TYPE_CD` int(10) unsigned NOT NULL,
269  `LAYER_NAME` varchar(255) NOT NULL COMMENT 'Theme name',
270  `LAYER_DESC` varchar(255) DEFAULT NULL COMMENT 'Theme description',
271  `REMARK` varchar(255) DEFAULT NULL,
272  PRIMARY KEY (`LAYER_INDEX`),
273  KEY `THEMATIC_LAYERS_FKIndex1` (`TYPE_CD`)
[18]274) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]275
276-- zoom_level --
277CREATE TABLE `zoom_level` (
278  `ZOOM_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
279  `SCALE_VALUE` int(10) unsigned NOT NULL,
280  `RANK` int(11) DEFAULT NULL,
281  PRIMARY KEY (`ZOOM_ID`)
[18]282) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
[7]283
284INSERT INTO zoom_level VALUES(1,5000,2);
285INSERT INTO zoom_level VALUES(2,10000,3);
286INSERT INTO zoom_level VALUES(3,25000,4);
287INSERT INTO zoom_level VALUES(4,50000,5);
288INSERT INTO zoom_level VALUES(5,1000,0);
289INSERT INTO zoom_level VALUES(6,2000,1);
290
Note: See TracBrowser for help on using the repository browser.