-
Notifications
You must be signed in to change notification settings - Fork 0
/
createDB.sql
72 lines (51 loc) · 1.71 KB
/
createDB.sql
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
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
CREATE DATABASE cnstbmb_db WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'ru_RU.UTF-8' LC_CTYPE = 'ru_RU.UTF-8';
\connect cnstbmb_db
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE error_events (
event_id bigint NOT NULL,
event_date timestamp without time zone DEFAULT now(),
event_log text,
event_reason text
);
CREATE SEQUENCE error_events_event_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE error_events_event_id_seq OWNED BY error_events.event_id;
CREATE TABLE event_counter (
producer_name text,
message_time timestamp without time zone DEFAULT now()
);
CREATE TABLE messages (
producer_time bigint,
consumer_time bigint,
message text
);
CREATE TABLE sys_error (
error_text text,
error_time timestamp without time zone DEFAULT now()
);
ALTER TABLE ONLY error_events ALTER COLUMN event_id SET DEFAULT nextval('error_events_event_id_seq'::regclass);
SELECT pg_catalog.setval('error_events_event_id_seq', 39, true);