Repository navigation
Expand file tree
/
Copy pathpostgres.sql
More file actions
executable file
·282 lines (188 loc) · 5.19 KB
/
Copy pathpostgres.sql
File metadata and controls
executable file
·282 lines (188 loc) · 5.19 KB
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
--
-- PostgreSQL database dump
--
-- Started on 2012-02-03 00:00:32
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: empty_table; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE empty_table (
id integer NOT NULL,
field character varying
);
--
-- Name: empty_table_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE empty_table_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: empty_table_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE empty_table_id_seq OWNED BY empty_table.id;
--
-- Name: groups; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE groups (
name character varying(50),
created_at timestamp without time zone DEFAULT now(),
id integer NOT NULL
);
--
-- Name: groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE groups_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE groups_id_seq OWNED BY groups.id;
--
-- Name: permissions; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE permissions (
user_id integer,
group_id integer,
role character varying(10),
id integer NOT NULL
);
--
-- Name: permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE permissions_id_seq OWNED BY permissions.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE users (
name character varying(30),
email character varying(50),
created_at timestamp without time zone DEFAULT now(),
id integer NOT NULL
);
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE users_id_seq OWNED BY users.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY empty_table ALTER COLUMN id SET DEFAULT nextval('empty_table_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY groups ALTER COLUMN id SET DEFAULT nextval('groups_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY permissions ALTER COLUMN id SET DEFAULT nextval('permissions_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
--
-- Data for Name: empty_table; Type: TABLE DATA; Schema: public; Owner: -
--
COPY empty_table (id, field) FROM stdin;
\.
--
-- Name: empty_table_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('empty_table_id_seq', 1, false);
--
-- Data for Name: groups; Type: TABLE DATA; Schema: public; Owner: -
--
COPY groups (name, created_at, id) FROM stdin;
coders 2012-02-02 22:33:30.807 1
jazzman 2012-02-02 22:33:35.271 2
\.
--
-- Name: groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('groups_id_seq', 2, true);
--
-- Data for Name: permissions; Type: TABLE DATA; Schema: public; Owner: -
--
COPY permissions (user_id, group_id, role, id) FROM stdin;
1 1 member 1
2 1 member 2
3 2 member 9
4 2 admin 10
\.
--
-- Name: permissions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('permissions_id_seq', 10, true);
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: -
--
COPY users (name, email, created_at, id) FROM stdin;
davert davert@mail.ua \N 1
nick nick@mail.ua 2012-02-02 22:30:31.748 2
miles miles@davis.com 2012-02-02 22:30:52.166 3
bird charlie@parker.com 2012-02-02 22:32:13.107 4
\.
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('users_id_seq', 4, true);
--
-- Name: g1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY groups
ADD CONSTRAINT g1 PRIMARY KEY (id);
--
-- Name: p1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY permissions
ADD CONSTRAINT p1 PRIMARY KEY (id);
--
-- Name: u1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY users
ADD CONSTRAINT u1 PRIMARY KEY (id);
--
-- Name: pf1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY permissions
ADD CONSTRAINT pf1 FOREIGN KEY (user_id) REFERENCES users(id);
--
-- Name: pg1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY permissions
ADD CONSTRAINT pg1 FOREIGN KEY (group_id) REFERENCES groups(id);
--
-- PostgreSQL database dump complete
--