[Lada-commits] [PATCH 03 of 14] Replaced explicit sequences by serials

Wald Commits scm-commit at wald.intevation.org
Fri Jul 1 19:54:55 CEST 2016


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1467388764 -7200
# Branch schema-update
# Node ID 5886384dcb9246e3be37bb97356e6cc34b64f4df
# Parent  196800bb22b0e46b5c9f4ef904043935a1765bc0
Replaced explicit sequences by serials.

diff -r 196800bb22b0 -r 5886384dcb92 db_schema/lada_schema.sql
--- 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,10 +445,61 @@
 
 
 --
--- Name: id; Type: DEFAULT; Schema: land; Owner: -
+-- Name: datum; Type: DEFAULT; Schema: land; Owner: -
 --
 
-ALTER TABLE ONLY status_protokoll ALTER COLUMN id SET DEFAULT nextval('kommentar_id_seq'::regclass);
+ALTER TABLE ONLY status_protokoll ALTER COLUMN datum SET DEFAULT now();
+
+
+SET search_path = land, pg_catalog;
+
+--
+-- Name: datum; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY kommentar_m ALTER COLUMN datum SET DEFAULT now();
+
+
+--
+-- Name: datum; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY kommentar_p ALTER COLUMN datum SET DEFAULT now();
+
+
+--
+-- Name: fertig; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY messung ALTER COLUMN fertig SET DEFAULT false;
+
+
+--
+-- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY messung ALTER COLUMN letzte_aenderung SET DEFAULT now();
+
+
+--
+-- Name: grenzwertueberschreitung; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY messwert ALTER COLUMN grenzwertueberschreitung SET DEFAULT false;
+
+
+--
+-- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY messwert ALTER COLUMN letzte_aenderung SET DEFAULT now();
+
+
+--
+-- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: -
+--
+
+ALTER TABLE ONLY ortszuordnung ALTER COLUMN letzte_aenderung SET DEFAULT now();
 
 
 --
@@ -579,113 +509,6 @@
 ALTER TABLE ONLY status_protokoll ALTER COLUMN datum SET DEFAULT now();
 
 
-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: -
---
-
-ALTER TABLE ONLY kommentar_m ALTER COLUMN datum SET DEFAULT now();
-
-
---
--- 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: -
---
-
-ALTER TABLE ONLY kommentar_p ALTER COLUMN datum SET DEFAULT now();
-
-
---
--- 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: -
---
-
-ALTER TABLE ONLY messung ALTER COLUMN fertig SET DEFAULT false;
-
-
---
--- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messung ALTER COLUMN letzte_aenderung SET DEFAULT now();
-
-
---
--- 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: -
---
-
-ALTER TABLE ONLY messwert ALTER COLUMN grenzwertueberschreitung SET DEFAULT false;
-
-
---
--- Name: letzte_aenderung; Type: DEFAULT; Schema: land; Owner: -
---
-
-ALTER TABLE ONLY messwert ALTER COLUMN letzte_aenderung SET DEFAULT now();
-
-
---
--- 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: -
---
-
-ALTER TABLE ONLY ortszuordnung ALTER COLUMN letzte_aenderung SET DEFAULT now();
-
-
---
--- 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: -
---
-
-ALTER TABLE ONLY status_protokoll ALTER COLUMN datum SET DEFAULT now();
-
-
 --
 -- Name: tree_modified; 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: -
 --
 


More information about the Lada-commits mailing list