Mercurial > lada > lada-server
changeset 994:5886384dcb92 schema-update
Replaced explicit sequences by serials.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 01 Jul 2016 17:59:24 +0200 (2016-07-01) |
parents | 196800bb22b0 |
children | c21d2e3c988a |
files | db_schema/lada_schema.sql |
diffstat | 1 files changed, 10 insertions(+), 174 deletions(-) [+] |
line wrap: on
line diff
--- a/db_schema/lada_schema.sql Fri Jul 01 17:46:39 2016 +0200 +++ b/db_schema/lada_schema.sql Fri Jul 01 17:59:24 2016 +0200 @@ -134,36 +134,12 @@ $$; --- --- Name: kommentar_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE kommentar_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - SET default_tablespace = ''; SET default_with_oids = false; -- --- Name: messung_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE messung_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- -- Name: messung_messung_id_alt_seq; Type: SEQUENCE; Schema: land; Owner: - -- @@ -176,55 +152,6 @@ -- --- Name: messung_messungs_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE messung_messungs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: messwert_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE messwert_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: ort_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE ort_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - - --- --- Name: probe_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE probe_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- -- Name: probe_probe_id_seq; Type: SEQUENCE; Schema: land; Owner: - -- @@ -237,22 +164,11 @@ -- --- Name: zusatz_wert_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE zusatz_wert_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - --- -- Name: kommentar_m; Type: TABLE; Schema: land; Owner: -; Tablespace: -- CREATE TABLE kommentar_m ( - id integer DEFAULT nextval('kommentar_id_seq'::regclass) NOT NULL, + id serial NOT NULL, erzeuger character varying(5) NOT NULL, datum timestamp without time zone DEFAULT now(), text character varying(1024), @@ -265,7 +181,7 @@ -- CREATE TABLE kommentar_p ( - id integer DEFAULT nextval('kommentar_id_seq'::regclass) NOT NULL, + id serial NOT NULL, erzeuger character varying(5) NOT NULL, datum timestamp without time zone DEFAULT now(), text character varying(1024), @@ -274,23 +190,11 @@ -- --- Name: messprogramm_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE messprogramm_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- -- Name: messprogramm; Type: TABLE; Schema: land; Owner: -; Tablespace: -- CREATE TABLE messprogramm ( - id integer PRIMARY KEY DEFAULT nextval('messprogramm_id_seq'::regclass), + id serial PRIMARY KEY, name character varying(256), test boolean DEFAULT false NOT NULL, netzbetreiber_id character varying(2) NOT NULL @@ -317,12 +221,6 @@ ); CREATE TRIGGER letzte_aenderung_messprogramm BEFORE UPDATE ON messprogramm FOR EACH ROW EXECUTE PROCEDURE update_letzte_aenderung(); --- --- Name: messprogramm_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: - --- - -ALTER SEQUENCE messprogramm_id_seq OWNED BY messprogramm.id; - -- -- Name: COLUMN messprogramm.media_desk; Type: COMMENT; Schema: land; Owner: - @@ -336,7 +234,7 @@ -- CREATE TABLE messprogramm_mmt ( - id integer NOT NULL, + id serial NOT NULL, messprogramm_id integer NOT NULL, mmt_id character varying(2) NOT NULL, messgroessen integer[], @@ -346,30 +244,11 @@ -- --- Name: messprogramm_mmt_id_seq; Type: SEQUENCE; Schema: land; Owner: - --- - -CREATE SEQUENCE messprogramm_mmt_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: messprogramm_mmt_id_seq; Type: SEQUENCE OWNED BY; Schema: land; Owner: - --- - -ALTER SEQUENCE messprogramm_mmt_id_seq OWNED BY messprogramm_mmt.id; - - --- -- Name: messung; Type: TABLE; Schema: land; Owner: -; Tablespace: -- CREATE TABLE messung ( - id integer DEFAULT nextval('messung_id_seq'::regclass) NOT NULL, + id serial NOT NULL, id_alt integer DEFAULT nextval('land.messung_messung_id_alt_seq'::regclass) NOT NULL, probe_id integer NOT NULL, nebenproben_nr character varying(10), @@ -389,7 +268,7 @@ -- CREATE TABLE messwert ( - id integer DEFAULT nextval('messwert_id_seq'::regclass) NOT NULL, + id serial NOT NULL, messungs_id integer NOT NULL, messgroesse_id integer NOT NULL, messwert_nwg character varying(1), @@ -409,7 +288,7 @@ -- CREATE TABLE ortszuordnung ( - id integer DEFAULT nextval('ort_id_seq'::regclass) NOT NULL, + id serial NOT NULL, probe_id integer NOT NULL, ort_id bigint NOT NULL, ortszuordnung_typ character varying(1), @@ -431,7 +310,7 @@ -- CREATE TABLE probe ( - id integer PRIMARY KEY DEFAULT nextval('probe_id_seq'::regclass), + id serial PRIMARY KEY, id_alt character varying(20) DEFAULT (('sss'::text || lpad(((nextval('land.probe_probe_id_seq'::regclass))::character varying)::text, 12, '0'::text)) || 'Y'::text) NOT NULL, test boolean DEFAULT false NOT NULL, netzbetreiber_id character varying(2) REFERENCES stammdaten.netz_betreiber, @@ -537,7 +416,7 @@ -- CREATE TABLE status_protokoll ( - id integer DEFAULT nextval('kommentar_id_seq'::regclass) NOT NULL, + id serial NOT NULL, erzeuger character varying(5) NOT NULL, datum timestamp without time zone DEFAULT now(), text character varying(1024), @@ -553,7 +432,7 @@ -- CREATE TABLE zusatz_wert ( - id integer DEFAULT nextval('zusatz_wert_id_seq'::regclass) NOT NULL, + id serial NOT NULL, probe_id integer NOT NULL, pzs_id character varying(3) NOT NULL, messwert_pzs double precision, @@ -566,13 +445,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY status_protokoll ALTER COLUMN id SET DEFAULT nextval('kommentar_id_seq'::regclass); - - --- -- Name: datum; Type: DEFAULT; Schema: land; Owner: - -- @@ -582,13 +454,6 @@ SET search_path = land, pg_catalog; -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY kommentar_m ALTER COLUMN id SET DEFAULT nextval('land.kommentar_id_seq'::regclass); - - --- -- Name: datum; Type: DEFAULT; Schema: land; Owner: - -- @@ -596,13 +461,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY kommentar_p ALTER COLUMN id SET DEFAULT nextval('land.kommentar_id_seq'::regclass); - - --- -- Name: datum; Type: DEFAULT; Schema: land; Owner: - -- @@ -610,20 +468,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY messprogramm_mmt ALTER COLUMN id SET DEFAULT nextval('messprogramm_mmt_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY messung ALTER COLUMN id SET DEFAULT nextval('land.messung_id_seq'::regclass); - - --- -- Name: fertig; Type: DEFAULT; Schema: land; Owner: - -- @@ -638,13 +482,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY messwert ALTER COLUMN id SET DEFAULT nextval('land.messwert_id_seq'::regclass); - - --- -- Name: grenzwertueberschreitung; Type: DEFAULT; Schema: land; Owner: - -- @@ -659,13 +496,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY ortszuordnung ALTER COLUMN id SET DEFAULT nextval('land.ort_id_seq'::regclass); - - --- -- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: - -- @@ -673,13 +503,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY status_protokoll ALTER COLUMN id SET DEFAULT nextval('land.kommentar_id_seq'::regclass); - - --- -- Name: datum; Type: DEFAULT; Schema: land; Owner: - -- @@ -694,13 +517,6 @@ -- --- Name: id; Type: DEFAULT; Schema: land; Owner: - --- - -ALTER TABLE ONLY zusatz_wert ALTER COLUMN id SET DEFAULT nextval('land.zusatz_wert_id_seq'::regclass); - - --- -- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: - --