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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
create table companies (
id integer not null,
type varchar(50) default null,
ruby_type varchar(50) default null,
firm_id integer default null references companies initially deferred disable,
name varchar(50) default null,
client_of integer default null references companies initially deferred disable,
companies_count integer default 0,
rating integer default 1,
primary key (id)
);
-- non-standard sequence name used to test set_sequence_name
--
create sequence companies_nonstd_seq minvalue 10000;
create table funny_jokes (
id integer not null,
name varchar(50) default null,
primary key (id)
);
create sequence funny_jokes_seq minvalue 10000;
create table accounts (
id integer not null,
firm_id integer default null references companies initially deferred disable,
credit_limit integer default null
);
create sequence accounts_seq minvalue 10000;
create table topics (
id integer not null,
title varchar(255) default null,
author_name varchar(255) default null,
author_email_address varchar(255) default null,
written_on timestamp default null,
bonus_time timestamp default null,
last_read timestamp default null,
content varchar(4000),
approved number(1) default 1,
replies_count integer default 0,
parent_id integer references topics initially deferred disable,
type varchar(50) default null,
primary key (id)
);
-- try again for 8i
create table topics (
id integer not null,
title varchar(255) default null,
author_name varchar(255) default null,
author_email_address varchar(255) default null,
written_on date default null,
bonus_time date default null,
last_read date default null,
content varchar(4000),
approved number(1) default 1,
replies_count integer default 0,
parent_id integer references topics initially deferred disable,
type varchar(50) default null,
primary key (id)
);
create sequence topics_seq minvalue 10000;
create synonym subjects for topics;
create table developers (
id integer not null,
name varchar(100) default null,
salary integer default 70000,
created_at timestamp default null,
updated_at timestamp default null,
primary key (id)
);
create sequence developers_seq minvalue 10000;
create table projects (
id integer not null,
name varchar(100) default null,
type varchar(255) default null,
primary key (id)
);
create sequence projects_seq minvalue 10000;
create table developers_projects (
developer_id integer not null references developers initially deferred disable,
project_id integer not null references projects initially deferred disable,
joined_on timestamp default null,
access_level integer default 1
);
-- Try again for 8i
create table developers_projects (
developer_id integer not null references developers initially deferred disable,
project_id integer not null references projects initially deferred disable,
joined_on date default null
);
create sequence developers_projects_seq minvalue 10000;
create table orders (
id integer not null,
name varchar(100) default null,
billing_customer_id integer default null,
shipping_customer_id integer default null,
primary key (id)
);
create sequence orders_seq minvalue 10000;
create table customers (
id integer not null,
name varchar(100) default null,
balance integer default 0,
address_street varchar(100) default null,
address_city varchar(100) default null,
address_country varchar(100) default null,
gps_location varchar(100) default null,
primary key (id)
);
create sequence customers_seq minvalue 10000;
create table movies (
movieid integer not null,
name varchar(100) default null,
primary key (movieid)
);
create sequence movies_seq minvalue 10000;
create table subscribers (
nick varchar(100) not null,
name varchar(100) default null,
primary key (nick)
);
create sequence subscribers_seq minvalue 10000;
create table booleantests (
id integer not null,
value integer default null,
primary key (id)
);
create sequence booleantests_seq minvalue 10000;
CREATE TABLE defaults (
id integer not null,
modified_date date default sysdate,
modified_date_function date default sysdate,
fixed_date date default to_date('2004-01-01', 'YYYY-MM-DD'),
modified_time date default sysdate,
modified_time_function date default sysdate,
fixed_time date default TO_DATE('2004-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),
char1 varchar2(1) default 'Y',
char2 varchar2(50) default 'a varchar field',
char3 clob default 'a text field',
positive_integer integer default 1,
negative_integer integer default -1,
decimal_number number(3,2) default 2.78
);
create sequence defaults_seq minvalue 10000;
create table auto_id_tests (
auto_id integer not null,
value integer default null,
primary key (auto_id)
);
create sequence auto_id_tests_seq minvalue 10000;
create table entrants (
id integer not null primary key,
name varchar(255) not null,
course_id integer not null
);
create sequence entrants_seq minvalue 10000;
create table colnametests (
id integer not null,
references integer not null,
primary key (id)
);
create sequence colnametests_seq minvalue 10000;
create table mixins (
id integer not null,
parent_id integer default null references mixins initially deferred disable,
type varchar(40) default null,
pos integer default null,
lft integer default null,
rgt integer default null,
root_id integer default null,
created_at timestamp default null,
updated_at timestamp default null,
primary key (id)
);
-- try again for 8i
create table mixins (
id integer not null,
parent_id integer default null references mixins initially deferred disable,
type varchar(40) default null,
pos integer default null,
lft integer default null,
rgt integer default null,
root_id integer default null,
created_at date default null,
updated_at date default null,
primary key (id)
);
create sequence mixins_seq minvalue 10000;
create table people (
id integer not null,
first_name varchar(40) null,
lock_version integer default 0,
primary key (id)
);
create sequence people_seq minvalue 10000;
create table readers (
id integer not null,
post_id integer not null,
person_id integer not null,
primary key (id)
);
create sequence readers_seq minvalue 10000;
create table binaries (
id integer not null,
data blob null,
primary key (id)
);
create sequence binaries_seq minvalue 10000;
create table computers (
id integer not null primary key,
developer integer not null references developers initially deferred disable,
"extendedWarranty" integer not null
);
create sequence computers_seq minvalue 10000;
create table posts (
id integer not null primary key,
author_id integer default null,
title varchar(255) default null,
type varchar(255) default null,
body varchar(3000) default null
);
create sequence posts_seq minvalue 10000;
create table comments (
id integer not null primary key,
post_id integer default null,
type varchar(255) default null,
body varchar(3000) default null
);
create sequence comments_seq minvalue 10000;
create table authors (
id integer not null primary key,
name varchar(255) default null
);
create sequence authors_seq minvalue 10000;
create table tasks (
id integer not null primary key,
starting date default null,
ending date default null
);
create sequence tasks_seq minvalue 10000;
create table categories (
id integer not null primary key,
name varchar(255) default null,
type varchar(255) default null
);
create sequence categories_seq minvalue 10000;
create table categories_posts (
category_id integer not null references categories initially deferred disable,
post_id integer not null references posts initially deferred disable
);
create sequence categories_posts_seq minvalue 10000;
create table fk_test_has_pk (
id integer not null primary key
);
create sequence fk_test_has_pk_seq minvalue 10000;
create table fk_test_has_fk (
id integer not null primary key,
fk_id integer not null references fk_test_has_fk initially deferred disable
);
create sequence fk_test_has_fk_seq minvalue 10000;
create table keyboards (
key_number integer not null,
name varchar(50) default null
);
create sequence keyboards_seq minvalue 10000;
create table test_oracle_defaults (
id integer not null primary key,
test_char char(1) default 'X' not null,
test_string varchar2(20) default 'hello' not null,
test_int integer default 3 not null
);
create sequence test_oracle_defaults_seq minvalue 10000;
--This table has an altered lock_version column name.
create table legacy_things (
id integer not null primary key,
tps_report_number integer default null,
version integer default 0
);
create sequence legacy_things_seq minvalue 10000;
CREATE TABLE numeric_data (
id integer NOT NULL 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 sequence numeric_data_seq minvalue 10000;
CREATE TABLE mixed_case_monkeys (
"monkeyID" INTEGER NOT NULL PRIMARY KEY,
"fleaCount" INTEGER
);
create sequence mixed_case_monkeys_seq minvalue 10000;
CREATE TABLE minimalistics (
id INTEGER NOT NULL PRIMARY KEY
);
create sequence minimalistics_seq minvalue 10000;
|