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
282
283
284
285
286
287
288
289
290
291
292
|
CREATE SEQUENCE public.accounts_id_seq START 100;
CREATE TABLE accounts (
id integer primary key DEFAULT nextval('public.accounts_id_seq'),
firm_id integer,
credit_limit integer
);
CREATE TABLE funny_jokes (
id serial,
name character varying(50)
);
CREATE SEQUENCE companies_nonstd_seq START 101;
CREATE TABLE companies (
id integer primary key DEFAULT nextval('companies_nonstd_seq'),
"type" character varying(50),
"ruby_type" character varying(50),
firm_id integer,
name character varying(50),
client_of integer,
rating integer default 1
);
CREATE TABLE developers_projects (
developer_id integer NOT NULL,
project_id integer NOT NULL,
joined_on date,
access_level integer default 1
);
CREATE TABLE developers (
id serial primary key,
name character varying(100),
salary integer DEFAULT 70000,
created_at timestamp,
updated_at timestamp
);
SELECT setval('developers_id_seq', 100);
CREATE TABLE projects (
id serial primary key,
name character varying(100),
type varchar(255)
);
SELECT setval('projects_id_seq', 100);
CREATE TABLE topics (
id serial primary key,
title character varying(255),
author_name character varying(255),
author_email_address character varying(255),
written_on timestamp without time zone,
bonus_time time,
last_read date,
content text,
approved boolean default true,
replies_count integer default 0,
parent_id integer,
"type" character varying(50)
);
SELECT setval('topics_id_seq', 100);
CREATE TABLE customers (
id serial primary key,
name character varying,
balance integer default 0,
address_street character varying,
address_city character varying,
address_country character varying,
gps_location character varying
);
SELECT setval('customers_id_seq', 100);
CREATE TABLE orders (
id serial primary key,
name character varying,
billing_customer_id integer,
shipping_customer_id integer
);
SELECT setval('orders_id_seq', 100);
CREATE TABLE movies (
movieid serial primary key,
name text
);
CREATE TABLE subscribers (
nick text primary key NOT NULL,
name text
);
CREATE TABLE booleantests (
id serial primary key,
value boolean
);
CREATE TABLE defaults (
id serial primary key,
modified_date date default CURRENT_DATE,
modified_date_function date default now(),
fixed_date date default '2004-01-01',
modified_time timestamp default CURRENT_TIMESTAMP,
modified_time_function timestamp default now(),
fixed_time timestamp default '2004-01-01 00:00:00.000000-00',
char1 char(1) default 'Y',
char2 character varying(50) default 'a varchar field',
char3 text default 'a text field',
positive_integer integer default 1,
negative_integer integer default -1,
decimal_number decimal(3,2) default 2.78,
multiline_default text DEFAULT E'--- []\n\n'::text
);
CREATE TABLE auto_id_tests (
auto_id serial primary key,
value integer
);
CREATE TABLE entrants (
id serial primary key,
name text not null,
course_id integer not null
);
CREATE TABLE colnametests (
id serial primary key,
"references" integer NOT NULL
);
CREATE TABLE mixins (
id serial primary key,
parent_id integer,
type character varying,
pos integer,
lft integer,
rgt integer,
root_id integer,
created_at timestamp,
updated_at timestamp
);
CREATE TABLE people (
id serial primary key,
first_name text,
lock_version integer default 0
);
CREATE TABLE readers (
id serial primary key,
post_id integer NOT NULL,
person_id integer NOT NULL
);
CREATE TABLE binaries (
id serial primary key,
data bytea
);
CREATE TABLE computers (
id serial primary key,
developer integer NOT NULL,
"extendedWarranty" integer NOT NULL
);
CREATE TABLE posts (
id serial primary key,
author_id integer,
title varchar(255),
type varchar(255),
body text
);
CREATE TABLE comments (
id serial primary key,
post_id integer,
type varchar(255),
body text
);
CREATE TABLE authors (
id serial primary key,
name varchar(255) default NULL
);
CREATE TABLE tasks (
id serial primary key,
starting timestamp,
ending timestamp
);
CREATE TABLE categories (
id serial primary key,
name varchar(255),
type varchar(255)
);
CREATE TABLE categories_posts (
category_id integer NOT NULL,
post_id integer NOT NULL
);
CREATE TABLE fk_test_has_pk (
id INTEGER NOT NULL PRIMARY KEY
);
CREATE TABLE fk_test_has_fk (
id INTEGER NOT NULL PRIMARY KEY,
fk_id INTEGER NOT NULL REFERENCES fk_test_has_fk(id)
);
CREATE TABLE geometrics (
id serial primary key,
a_point point,
-- a_line line, (the line type is currently not implemented in postgresql)
a_line_segment lseg,
a_box box,
a_path path,
a_polygon polygon,
a_circle circle
);
CREATE TABLE keyboards (
key_number serial primary key,
"name" character varying(50)
);
--Altered lock_version column name.
CREATE TABLE legacy_things (
id serial primary key,
tps_report_number integer,
version integer default 0
);
CREATE TABLE numeric_data (
id serial primary key,
bank_balance decimal(10,2),
big_bank_balance decimal(15,2),
world_population decimal(10),
my_house_population decimal(2),
decimal_number_with_default decimal(3,2) default 2.78
);
CREATE TABLE mixed_case_monkeys (
"monkeyID" INTEGER PRIMARY KEY,
"fleaCount" INTEGER
);
CREATE TABLE postgresql_arrays (
id SERIAL PRIMARY KEY,
commission_by_quarter INTEGER[],
nicknames TEXT[]
);
CREATE TABLE postgresql_moneys (
id SERIAL PRIMARY KEY,
wealth MONEY
);
CREATE TABLE postgresql_numbers (
id SERIAL PRIMARY KEY,
single REAL,
double DOUBLE PRECISION
);
CREATE TABLE postgresql_times (
id SERIAL PRIMARY KEY,
time_interval INTERVAL
);
CREATE TABLE postgresql_network_addresses (
id SERIAL PRIMARY KEY,
cidr_address CIDR,
inet_address INET,
mac_address MACADDR
);
CREATE TABLE postgresql_bit_strings (
id SERIAL PRIMARY KEY,
bit_string BIT(8),
bit_string_varying BIT VARYING(8)
);
CREATE TABLE postgresql_oids (
id SERIAL PRIMARY KEY,
obj_id OID
);
CREATE TABLE minimalistics (
id serial primary key
);
|