aboutsummaryrefslogtreecommitdiffstats
path: root/schema.sql
blob: 25cf25bf2893775f0053dedb152a5637192349f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
--
-- PostgreSQL database dump
--

-- Dumped from database version 15.6 (Debian 15.6-0+deb12u1)
-- Dumped by pg_dump version 15.6 (Debian 15.6-0+deb12u1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE webmap;
--
-- Name: webmap; Type: DATABASE; Schema: -; Owner: postgres
--

CREATE DATABASE webmap WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = icu LOCALE = 'sv_SE.UTF-8' ICU_LOCALE = 'sv-SE-x-icu';


ALTER DATABASE webmap OWNER TO postgres;

\connect webmap

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: DATABASE webmap; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON DATABASE webmap IS 'Backend PostGIS database for KlimatanalysNorr tooling';


--
-- Name: postgis; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA postgis;


ALTER SCHEMA postgis OWNER TO postgres;

--
-- Name: postgis; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA postgis;


--
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION postgis IS 'Geographic objects support for PostgreSQL';


SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: kommunyta; Type: TABLE; Schema: postgis; Owner: webmap_import
--

CREATE TABLE postgis.kommunyta (
    ogc_fid bigint NOT NULL,
    objektidentitet uuid,
    skapad timestamp without time zone,
    kommunkod smallint NOT NULL,
    wkb_geometry postgis.geometry(MultiPolygon,3006)
);


ALTER TABLE postgis.kommunyta OWNER TO webmap_import;

--
-- Name: TABLE kommunyta; Type: COMMENT; Schema: postgis; Owner: webmap_import
--

COMMENT ON TABLE postgis.kommunyta IS 'Sveriges kommuner (Lantmäteriet)';


--
-- Name: kommunyta_ogc_fid_seq; Type: SEQUENCE; Schema: postgis; Owner: webmap_import
--

CREATE SEQUENCE postgis.kommunyta_ogc_fid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE postgis.kommunyta_ogc_fid_seq OWNER TO webmap_import;

--
-- Name: kommunyta_ogc_fid_seq; Type: SEQUENCE OWNED BY; Schema: postgis; Owner: webmap_import
--

ALTER SEQUENCE postgis.kommunyta_ogc_fid_seq OWNED BY postgis.kommunyta.ogc_fid;


--
-- Name: lansyta; Type: TABLE; Schema: postgis; Owner: webmap_import
--

CREATE TABLE postgis.lansyta (
    ogc_fid bigint NOT NULL,
    objektidentitet uuid,
    skapad timestamp without time zone,
    lanskod smallint NOT NULL,
    wkb_geometry postgis.geometry(MultiPolygon,3006)
);


ALTER TABLE postgis.lansyta OWNER TO webmap_import;

--
-- Name: TABLE lansyta; Type: COMMENT; Schema: postgis; Owner: webmap_import
--

COMMENT ON TABLE postgis.lansyta IS 'Sveriges län (Lantmäteriet)';


--
-- Name: lansyta_ogc_fid_seq; Type: SEQUENCE; Schema: postgis; Owner: webmap_import
--

CREATE SEQUENCE postgis.lansyta_ogc_fid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE postgis.lansyta_ogc_fid_seq OWNER TO webmap_import;

--
-- Name: lansyta_ogc_fid_seq; Type: SEQUENCE OWNED BY; Schema: postgis; Owner: webmap_import
--

ALTER SEQUENCE postgis.lansyta_ogc_fid_seq OWNED BY postgis.lansyta.ogc_fid;


--
-- Name: sks:AvverkAnm; Type: TABLE; Schema: postgis; Owner: webmap_import
--

CREATE TABLE postgis."sks:AvverkAnm" (
    ogc_fid bigint NOT NULL,
    "OBJECTID" integer NOT NULL,
    "Beteckn" character(12) NOT NULL,
    "ArendeAr" smallint NOT NULL,
    "Avverktyp" character varying(254) NOT NULL,
    "Skogstyp" character varying(254) NOT NULL,
    "Inkomdatum" date NOT NULL,
    "AnmaldHa" real NOT NULL,
    "SkogsodlHa" real NOT NULL,
    "NatforHa" real NOT NULL,
    "AvvSasong" character varying(254) NOT NULL,
    "ArendeStat" character varying(254) NOT NULL,
    "AvvHa" real,
    "Avverkning" character varying(254) NOT NULL,
    wkb_geometry postgis.geometry(MultiPolygon,3006)
);


ALTER TABLE postgis."sks:AvverkAnm" OWNER TO webmap_import;

--
-- Name: TABLE "sks:AvverkAnm"; Type: COMMENT; Schema: postgis; Owner: webmap_import
--

COMMENT ON TABLE postgis."sks:AvverkAnm" IS 'Avverkningsanmälningar (Skogsstyrelsen)';


--
-- Name: sks:AvverkAnm_ogc_fid_seq; Type: SEQUENCE; Schema: postgis; Owner: webmap_import
--

CREATE SEQUENCE postgis."sks:AvverkAnm_ogc_fid_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE postgis."sks:AvverkAnm_ogc_fid_seq" OWNER TO webmap_import;

--
-- Name: sks:AvverkAnm_ogc_fid_seq; Type: SEQUENCE OWNED BY; Schema: postgis; Owner: webmap_import
--

ALTER SEQUENCE postgis."sks:AvverkAnm_ogc_fid_seq" OWNED BY postgis."sks:AvverkAnm".ogc_fid;


--
-- Name: sks:UtfordAvverk; Type: TABLE; Schema: postgis; Owner: webmap_import
--

CREATE TABLE postgis."sks:UtfordAvverk" (
    ogc_fid bigint NOT NULL,
    "OBJECTID" integer NOT NULL,
    "Beteckn" character(12) NOT NULL,
    "ArendeAr" smallint NOT NULL,
    "Avverktyp" character varying(254) NOT NULL,
    "Skogstyp" character varying(254) NOT NULL,
    "AnmaldHa" real,
    "SkogsodlHa" real NOT NULL,
    "NatforHa" real NOT NULL,
    "Avvdatum" date NOT NULL,
    "KallaDatum" date,
    "KallaAreal" character varying(62),
    "Forebild" character varying(62),
    "Efterbild" character varying(62),
    "ArealHa" real NOT NULL,
    wkb_geometry postgis.geometry(MultiPolygon,3006)
);


ALTER TABLE postgis."sks:UtfordAvverk" OWNER TO webmap_import;

--
-- Name: TABLE "sks:UtfordAvverk"; Type: COMMENT; Schema: postgis; Owner: webmap_import
--

COMMENT ON TABLE postgis."sks:UtfordAvverk" IS 'Utförd avverkning (Skogsstyrelsen)';


--
-- Name: sks:UtfordAvverk_ogc_fid_seq; Type: SEQUENCE; Schema: postgis; Owner: webmap_import
--

CREATE SEQUENCE postgis."sks:UtfordAvverk_ogc_fid_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE postgis."sks:UtfordAvverk_ogc_fid_seq" OWNER TO webmap_import;

--
-- Name: sks:UtfordAvverk_ogc_fid_seq; Type: SEQUENCE OWNED BY; Schema: postgis; Owner: webmap_import
--

ALTER SEQUENCE postgis."sks:UtfordAvverk_ogc_fid_seq" OWNED BY postgis."sks:UtfordAvverk".ogc_fid;


--
-- Name: kommunyta ogc_fid; Type: DEFAULT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.kommunyta ALTER COLUMN ogc_fid SET DEFAULT nextval('postgis.kommunyta_ogc_fid_seq'::regclass);


--
-- Name: lansyta ogc_fid; Type: DEFAULT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.lansyta ALTER COLUMN ogc_fid SET DEFAULT nextval('postgis.lansyta_ogc_fid_seq'::regclass);


--
-- Name: sks:AvverkAnm ogc_fid; Type: DEFAULT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:AvverkAnm" ALTER COLUMN ogc_fid SET DEFAULT nextval('postgis."sks:AvverkAnm_ogc_fid_seq"'::regclass);


--
-- Name: sks:UtfordAvverk ogc_fid; Type: DEFAULT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:UtfordAvverk" ALTER COLUMN ogc_fid SET DEFAULT nextval('postgis."sks:UtfordAvverk_ogc_fid_seq"'::regclass);


--
-- Name: kommunyta kommunyta_kommunkod_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.kommunyta
    ADD CONSTRAINT kommunyta_kommunkod_key UNIQUE (kommunkod);


--
-- Name: kommunyta kommunyta_objektidentitet_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.kommunyta
    ADD CONSTRAINT kommunyta_objektidentitet_key UNIQUE (objektidentitet);


--
-- Name: kommunyta kommunyta_pkey; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.kommunyta
    ADD CONSTRAINT kommunyta_pkey PRIMARY KEY (ogc_fid);


--
-- Name: lansyta lansyta_lanskod_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.lansyta
    ADD CONSTRAINT lansyta_lanskod_key UNIQUE (lanskod);


--
-- Name: lansyta lansyta_objektidentitet_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.lansyta
    ADD CONSTRAINT lansyta_objektidentitet_key UNIQUE (objektidentitet);


--
-- Name: lansyta lansyta_pkey; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis.lansyta
    ADD CONSTRAINT lansyta_pkey PRIMARY KEY (ogc_fid);


--
-- Name: sks:AvverkAnm sks:AvverkAnm_Beteckn_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:AvverkAnm"
    ADD CONSTRAINT "sks:AvverkAnm_Beteckn_key" UNIQUE ("Beteckn");


--
-- Name: sks:AvverkAnm sks:AvverkAnm_OBJECTID_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:AvverkAnm"
    ADD CONSTRAINT "sks:AvverkAnm_OBJECTID_key" UNIQUE ("OBJECTID");


--
-- Name: sks:AvverkAnm sks:AvverkAnm_pkey; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:AvverkAnm"
    ADD CONSTRAINT "sks:AvverkAnm_pkey" PRIMARY KEY (ogc_fid);


--
-- Name: sks:UtfordAvverk sks:UtfordAvverk_OBJECTID_key; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:UtfordAvverk"
    ADD CONSTRAINT "sks:UtfordAvverk_OBJECTID_key" UNIQUE ("OBJECTID");


--
-- Name: sks:UtfordAvverk sks:UtfordAvverk_pkey; Type: CONSTRAINT; Schema: postgis; Owner: webmap_import
--

ALTER TABLE ONLY postgis."sks:UtfordAvverk"
    ADD CONSTRAINT "sks:UtfordAvverk_pkey" PRIMARY KEY (ogc_fid);


--
-- Name: kommunyta_wkb_geometry_geom_idx; Type: INDEX; Schema: postgis; Owner: webmap_import
--

CREATE INDEX kommunyta_wkb_geometry_geom_idx ON postgis.kommunyta USING gist (wkb_geometry);


--
-- Name: lansyta_wkb_geometry_geom_idx; Type: INDEX; Schema: postgis; Owner: webmap_import
--

CREATE INDEX lansyta_wkb_geometry_geom_idx ON postgis.lansyta USING gist (wkb_geometry);


--
-- Name: sks:AvverkAnm_wkb_geometry_geom_idx; Type: INDEX; Schema: postgis; Owner: webmap_import
--

CREATE INDEX "sks:AvverkAnm_wkb_geometry_geom_idx" ON postgis."sks:AvverkAnm" USING gist (wkb_geometry);


--
-- Name: sks:UtfordAvverk_wkb_geometry_geom_idx; Type: INDEX; Schema: postgis; Owner: webmap_import
--

CREATE INDEX "sks:UtfordAvverk_wkb_geometry_geom_idx" ON postgis."sks:UtfordAvverk" USING gist (wkb_geometry);


--
-- Name: DATABASE webmap; Type: ACL; Schema: -; Owner: postgres
--

GRANT CONNECT ON DATABASE webmap TO webmap_import;
GRANT CONNECT ON DATABASE webmap TO webmap_guest;


--
-- Name: SCHEMA postgis; Type: ACL; Schema: -; Owner: postgres
--

GRANT USAGE ON SCHEMA postgis TO webmap_import;
GRANT USAGE ON SCHEMA postgis TO webmap_guest;


--
-- Name: TABLE geography_columns; Type: ACL; Schema: postgis; Owner: postgres
--

GRANT SELECT ON TABLE postgis.geography_columns TO webmap_guest;


--
-- Name: TABLE geometry_columns; Type: ACL; Schema: postgis; Owner: postgres
--

GRANT SELECT ON TABLE postgis.geometry_columns TO webmap_guest;


--
-- Name: TABLE kommunyta; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT ON TABLE postgis.kommunyta TO webmap_guest;


--
-- Name: SEQUENCE kommunyta_ogc_fid_seq; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT,USAGE ON SEQUENCE postgis.kommunyta_ogc_fid_seq TO webmap_guest;


--
-- Name: TABLE lansyta; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT ON TABLE postgis.lansyta TO webmap_guest;


--
-- Name: SEQUENCE lansyta_ogc_fid_seq; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT,USAGE ON SEQUENCE postgis.lansyta_ogc_fid_seq TO webmap_guest;


--
-- Name: TABLE "sks:AvverkAnm"; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT ON TABLE postgis."sks:AvverkAnm" TO webmap_guest;


--
-- Name: SEQUENCE "sks:AvverkAnm_ogc_fid_seq"; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT,USAGE ON SEQUENCE postgis."sks:AvverkAnm_ogc_fid_seq" TO webmap_guest;


--
-- Name: TABLE "sks:UtfordAvverk"; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT ON TABLE postgis."sks:UtfordAvverk" TO webmap_guest;


--
-- Name: SEQUENCE "sks:UtfordAvverk_ogc_fid_seq"; Type: ACL; Schema: postgis; Owner: webmap_import
--

GRANT SELECT,USAGE ON SEQUENCE postgis."sks:UtfordAvverk_ogc_fid_seq" TO webmap_guest;


--
-- Name: TABLE spatial_ref_sys; Type: ACL; Schema: postgis; Owner: postgres
--

GRANT SELECT ON TABLE postgis.spatial_ref_sys TO webmap_guest;


--
-- PostgreSQL database dump complete
--