Mercurial > gemma
comparison schema/gemma.sql @ 569:ad07846b09d1
Add function to construct isrs from text
In passing moved all related functionality to its own set of files.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 05 Sep 2018 11:05:58 +0200 |
parents | f3452ce5c056 |
children | e6c9d2da2e20 |
comparison
equal
deleted
inserted
replaced
568:99968a7394f7 | 569:ad07846b09d1 |
---|---|
13 BEGIN | 13 BEGIN |
14 NEW.date_info = CURRENT_TIMESTAMP; | 14 NEW.date_info = CURRENT_TIMESTAMP; |
15 RETURN NEW; | 15 RETURN NEW; |
16 END; | 16 END; |
17 $$; | 17 $$; |
18 | |
19 -- Composite type: UN/LOCODE, fairway section, object reference, hectometre. | |
20 -- See RIS-Index Encoding Guide | |
21 CREATE TYPE isrs AS ( | |
22 country_code char(2), -- ISO 3166 country code | |
23 -- could be validated against countries table. | |
24 locode char(3), -- without the country code: | |
25 -- http://www.unece.org/cefact/locode/welcome.html | |
26 fairway_section char(5), | |
27 object_reference char(5), | |
28 hectometre int -- should be constrained to five digits | |
29 ); | |
30 | |
31 CREATE TYPE isrsrange AS RANGE ( | |
32 subtype = isrs | |
33 ); | |
34 | 18 |
35 -- | 19 -- |
36 -- GEMMA data | 20 -- GEMMA data |
37 -- | 21 -- |
38 | 22 |