ibm_db 1.0.2 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -0
- data/README +1 -1
- data/ext/ibm_db.c +9 -6
- data/ext/ruby_ibm_db.h +9 -1
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +33 -16
- data/test/cases/associations/cascaded_eager_loading_test.rb +8 -0
- data/test/cases/associations/eager_test.rb +140 -8
- data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +77 -28
- data/test/cases/associations/has_many_through_associations_test.rb +39 -7
- data/test/cases/associations/join_model_test.rb +5 -7
- data/test/cases/attribute_methods_test.rb +312 -0
- data/test/cases/base_test.rb +44 -24
- data/test/cases/calculations_test.rb +37 -17
- data/test/cases/finder_test.rb +79 -44
- data/test/cases/fixtures_test.rb +15 -19
- data/test/cases/migration_test.rb +91 -67
- data/test/cases/query_cache_test.rb +20 -24
- data/test/cases/schema_dumper_test.rb +0 -1
- data/test/cases/validations_test.rb +228 -178
- data/test/schema/schema.rb +484 -451
- metadata +4 -3
data/test/schema/schema.rb
CHANGED
@@ -1,451 +1,484 @@
|
|
1
|
-
|
2
|
-
ActiveRecord::Schema.define do
|
3
|
-
def except(adapter_names_to_exclude)
|
4
|
-
unless [adapter_names_to_exclude].flatten.include?(adapter_name)
|
5
|
-
yield
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
#put adapter specific setup here
|
10
|
-
case adapter_name
|
11
|
-
# For Firebird, set the sequence values 10000 when create_table is called;
|
12
|
-
# this prevents primary key collisions between "normally" created records
|
13
|
-
# and fixture-based (YAML) records.
|
14
|
-
when "Firebird"
|
15
|
-
def create_table(*args, &block)
|
16
|
-
ActiveRecord::Base.connection.create_table(*args, &block)
|
17
|
-
ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
# Please keep these create table statements in alphabetical order
|
23
|
-
# unless the ordering matters. In which case, define them below
|
24
|
-
create_table :accounts, :force => true do |t|
|
25
|
-
t.integer :firm_id
|
26
|
-
t.integer :credit_limit
|
27
|
-
end
|
28
|
-
|
29
|
-
create_table :audit_logs, :force => true do |t|
|
30
|
-
t.column :message, :string, :null=>false
|
31
|
-
t.column :developer_id, :integer, :null=>false
|
32
|
-
end
|
33
|
-
|
34
|
-
create_table :authors, :force => true do |t|
|
35
|
-
t.string :name, :null => false
|
36
|
-
t.integer :author_address_id
|
37
|
-
t.integer :author_address_extra_id
|
38
|
-
end
|
39
|
-
|
40
|
-
create_table :author_addresses, :force => true do |t|
|
41
|
-
end
|
42
|
-
|
43
|
-
create_table :author_favorites, :force => true do |t|
|
44
|
-
t.column :author_id, :integer
|
45
|
-
t.column :favorite_author_id, :integer
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
create_table :auto_id_tests, :force => true, :id => false do |t|
|
50
|
-
t.primary_key :auto_id
|
51
|
-
t.integer :value
|
52
|
-
end
|
53
|
-
|
54
|
-
create_table :binaries, :force => true do |t|
|
55
|
-
t.binary :data
|
56
|
-
end
|
57
|
-
|
58
|
-
create_table :
|
59
|
-
t.
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
t.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
t.
|
74
|
-
t.integer :
|
75
|
-
end
|
76
|
-
|
77
|
-
create_table :
|
78
|
-
t.
|
79
|
-
t.
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
t.column :
|
85
|
-
t.column :
|
86
|
-
end
|
87
|
-
|
88
|
-
create_table :
|
89
|
-
t.
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
t.
|
111
|
-
t.
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
t.integer :
|
116
|
-
t.integer :
|
117
|
-
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
t.
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
t.string :
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
t.string
|
131
|
-
t.
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
t.
|
138
|
-
t.
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
t.
|
145
|
-
t.
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
create_table :
|
156
|
-
t.string :
|
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
|
-
t.
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
create_table :
|
187
|
-
t.
|
188
|
-
end
|
189
|
-
|
190
|
-
create_table :
|
191
|
-
t.
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
t.
|
197
|
-
t.
|
198
|
-
end
|
199
|
-
|
200
|
-
create_table :
|
201
|
-
t.
|
202
|
-
end
|
203
|
-
|
204
|
-
create_table :
|
205
|
-
t.
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
t.
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
t.
|
221
|
-
t.integer :
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
t.
|
229
|
-
t.
|
230
|
-
end
|
231
|
-
|
232
|
-
create_table :
|
233
|
-
t.
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
t.integer
|
238
|
-
t.integer
|
239
|
-
t.
|
240
|
-
t.
|
241
|
-
end
|
242
|
-
|
243
|
-
create_table :
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
t.
|
253
|
-
t.
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
t.
|
258
|
-
t.integer
|
259
|
-
t.
|
260
|
-
end
|
261
|
-
|
262
|
-
create_table :
|
263
|
-
t.
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
t.
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
t.
|
288
|
-
end
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
end
|
299
|
-
|
300
|
-
create_table :
|
301
|
-
t.
|
302
|
-
t.
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
t.
|
307
|
-
t.
|
308
|
-
end
|
309
|
-
|
310
|
-
create_table :
|
311
|
-
t.column :
|
312
|
-
t.column :
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
t.
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
t.
|
336
|
-
t.
|
337
|
-
end
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
t.
|
353
|
-
t.
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
t.
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
t.string
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
t.datetime :
|
378
|
-
t.datetime :
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
t.
|
401
|
-
t.
|
402
|
-
end
|
403
|
-
|
404
|
-
create_table :
|
405
|
-
t.
|
406
|
-
t.
|
407
|
-
end
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
t.integer :
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
end
|
451
|
-
|
1
|
+
|
2
|
+
ActiveRecord::Schema.define do
|
3
|
+
def except(adapter_names_to_exclude)
|
4
|
+
unless [adapter_names_to_exclude].flatten.include?(adapter_name)
|
5
|
+
yield
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
#put adapter specific setup here
|
10
|
+
case adapter_name
|
11
|
+
# For Firebird, set the sequence values 10000 when create_table is called;
|
12
|
+
# this prevents primary key collisions between "normally" created records
|
13
|
+
# and fixture-based (YAML) records.
|
14
|
+
when "Firebird"
|
15
|
+
def create_table(*args, &block)
|
16
|
+
ActiveRecord::Base.connection.create_table(*args, &block)
|
17
|
+
ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# Please keep these create table statements in alphabetical order
|
23
|
+
# unless the ordering matters. In which case, define them below
|
24
|
+
create_table :accounts, :force => true do |t|
|
25
|
+
t.integer :firm_id
|
26
|
+
t.integer :credit_limit
|
27
|
+
end
|
28
|
+
|
29
|
+
create_table :audit_logs, :force => true do |t|
|
30
|
+
t.column :message, :string, :null=>false
|
31
|
+
t.column :developer_id, :integer, :null=>false
|
32
|
+
end
|
33
|
+
|
34
|
+
create_table :authors, :force => true do |t|
|
35
|
+
t.string :name, :null => false
|
36
|
+
t.integer :author_address_id
|
37
|
+
t.integer :author_address_extra_id
|
38
|
+
end
|
39
|
+
|
40
|
+
create_table :author_addresses, :force => true do |t|
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table :author_favorites, :force => true do |t|
|
44
|
+
t.column :author_id, :integer
|
45
|
+
t.column :favorite_author_id, :integer
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
create_table :auto_id_tests, :force => true, :id => false do |t|
|
50
|
+
t.primary_key :auto_id
|
51
|
+
t.integer :value
|
52
|
+
end
|
53
|
+
|
54
|
+
create_table :binaries, :force => true do |t|
|
55
|
+
t.binary :data
|
56
|
+
end
|
57
|
+
|
58
|
+
create_table :birds, :force => true do |t|
|
59
|
+
t.string :name
|
60
|
+
t.integer :pirate_id
|
61
|
+
end
|
62
|
+
|
63
|
+
create_table :books, :force => true do |t|
|
64
|
+
t.column :name, :string
|
65
|
+
end
|
66
|
+
|
67
|
+
create_table :booleantests, :force => true do |t|
|
68
|
+
t.boolean :value
|
69
|
+
end
|
70
|
+
|
71
|
+
create_table :categories, :force => true do |t|
|
72
|
+
t.string :name, :null => false
|
73
|
+
t.string :type
|
74
|
+
t.integer :categorizations_count
|
75
|
+
end
|
76
|
+
|
77
|
+
create_table :categories_posts, :force => true, :id => false do |t|
|
78
|
+
t.integer :category_id, :null => false
|
79
|
+
t.integer :post_id, :null => false
|
80
|
+
end
|
81
|
+
|
82
|
+
create_table :categorizations, :force => true do |t|
|
83
|
+
t.column :category_id, :integer
|
84
|
+
t.column :post_id, :integer
|
85
|
+
t.column :author_id, :integer
|
86
|
+
end
|
87
|
+
|
88
|
+
create_table :citations, :force => true do |t|
|
89
|
+
t.column :book1_id, :integer
|
90
|
+
t.column :book2_id, :integer
|
91
|
+
end
|
92
|
+
|
93
|
+
create_table :clubs, :force => true do |t|
|
94
|
+
t.string :name
|
95
|
+
end
|
96
|
+
|
97
|
+
create_table :colnametests, :force => true do |t|
|
98
|
+
t.integer :references, :null => false
|
99
|
+
end
|
100
|
+
|
101
|
+
except 'IBM_DB' do
|
102
|
+
create_table :comments, :force => true do |t|
|
103
|
+
t.integer :post_id, :null => false
|
104
|
+
t.text :body, :null => false
|
105
|
+
t.string :type
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
create_table :companies, :force => true do |t|
|
110
|
+
t.string :type
|
111
|
+
t.string :ruby_type
|
112
|
+
t.integer :firm_id
|
113
|
+
t.string :firm_name
|
114
|
+
t.string :name
|
115
|
+
t.integer :client_of
|
116
|
+
t.integer :rating, :default => 1
|
117
|
+
end
|
118
|
+
|
119
|
+
create_table :computers, :force => true do |t|
|
120
|
+
t.integer :developer, :null => false
|
121
|
+
t.integer :extendedWarranty, :null => false
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
create_table :customers, :force => true do |t|
|
126
|
+
t.string :name
|
127
|
+
t.integer :balance, :default => 0
|
128
|
+
t.string :address_street
|
129
|
+
t.string :address_city
|
130
|
+
t.string :address_country
|
131
|
+
t.string :gps_location
|
132
|
+
end
|
133
|
+
|
134
|
+
create_table :developers, :force => true do |t|
|
135
|
+
t.string :name
|
136
|
+
t.integer :salary, :default => 70000
|
137
|
+
t.datetime :created_at
|
138
|
+
t.datetime :updated_at
|
139
|
+
end
|
140
|
+
|
141
|
+
create_table :developers_projects, :force => true, :id => false do |t|
|
142
|
+
t.integer :developer_id, :null => false
|
143
|
+
t.integer :project_id, :null => false
|
144
|
+
t.date :joined_on
|
145
|
+
t.integer :access_level, :default => 1
|
146
|
+
end
|
147
|
+
|
148
|
+
create_table :edges, :force => true do |t|
|
149
|
+
t.column :source_id, :integer, :null => false
|
150
|
+
t.column :sink_id, :integer, :null => false
|
151
|
+
end
|
152
|
+
add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
|
153
|
+
|
154
|
+
|
155
|
+
create_table :entrants, :force => true do |t|
|
156
|
+
t.string :name, :null => false
|
157
|
+
t.integer :course_id, :null => false
|
158
|
+
end
|
159
|
+
|
160
|
+
create_table :events, :force => true do |t|
|
161
|
+
t.string :title, :limit => 5
|
162
|
+
end
|
163
|
+
|
164
|
+
create_table :funny_jokes, :force => true do |t|
|
165
|
+
t.string :name
|
166
|
+
end
|
167
|
+
|
168
|
+
create_table :goofy_string_id, :force => true, :id => false do |t|
|
169
|
+
t.string :id, :null => false
|
170
|
+
t.string :info
|
171
|
+
end
|
172
|
+
|
173
|
+
except 'IBM_DB' do
|
174
|
+
create_table :items, :force => true do |t|
|
175
|
+
t.column :name, :string
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
create_table :inept_wizards, :force => true do |t|
|
180
|
+
t.column :name, :string, :null => false
|
181
|
+
t.column :city, :string, :null => false
|
182
|
+
t.column :type, :string
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
create_table :jobs, :force => true do |t|
|
187
|
+
t.integer :ideal_reference_id
|
188
|
+
end
|
189
|
+
|
190
|
+
create_table :keyboards, :force => true, :id => false do |t|
|
191
|
+
t.primary_key :key_number
|
192
|
+
t.string :name
|
193
|
+
end
|
194
|
+
|
195
|
+
create_table :legacy_things, :force => true do |t|
|
196
|
+
t.integer :tps_report_number
|
197
|
+
t.integer :version, :null => false, :default => 0
|
198
|
+
end
|
199
|
+
|
200
|
+
create_table :lock_without_defaults, :force => true do |t|
|
201
|
+
t.column :lock_version, :integer
|
202
|
+
end
|
203
|
+
|
204
|
+
create_table :lock_without_defaults_cust, :force => true do |t|
|
205
|
+
t.column :custom_lock_version, :integer
|
206
|
+
end
|
207
|
+
|
208
|
+
create_table :mateys, :id => false, :force => true do |t|
|
209
|
+
t.column :pirate_id, :integer
|
210
|
+
t.column :target_id, :integer
|
211
|
+
t.column :weight, :integer
|
212
|
+
end
|
213
|
+
|
214
|
+
create_table :members, :force => true do |t|
|
215
|
+
t.string :name
|
216
|
+
t.integer :member_type_id
|
217
|
+
end
|
218
|
+
|
219
|
+
create_table :member_details, :force => true do |t|
|
220
|
+
t.integer :member_id
|
221
|
+
t.integer :organization_id
|
222
|
+
t.string :extra_data
|
223
|
+
end
|
224
|
+
|
225
|
+
create_table :memberships, :force => true do |t|
|
226
|
+
t.datetime :joined_on
|
227
|
+
t.integer :club_id, :member_id
|
228
|
+
t.boolean :favourite, :default => false
|
229
|
+
t.string :type
|
230
|
+
end
|
231
|
+
|
232
|
+
create_table :member_types, :force => true do |t|
|
233
|
+
t.string :name
|
234
|
+
end
|
235
|
+
|
236
|
+
create_table :references, :force => true do |t|
|
237
|
+
t.integer :person_id
|
238
|
+
t.integer :job_id
|
239
|
+
t.boolean :favourite
|
240
|
+
t.integer :lock_version, :default => 0
|
241
|
+
end
|
242
|
+
|
243
|
+
create_table :minimalistics, :force => true do |t|
|
244
|
+
end
|
245
|
+
|
246
|
+
create_table :mixed_case_monkeys, :force => true, :id => false do |t|
|
247
|
+
t.primary_key :monkeyID
|
248
|
+
t.integer :fleaCount
|
249
|
+
end
|
250
|
+
|
251
|
+
create_table :mixins, :force => true do |t|
|
252
|
+
t.integer :parent_id
|
253
|
+
t.integer :pos
|
254
|
+
t.datetime :created_at
|
255
|
+
t.datetime :updated_at
|
256
|
+
t.integer :lft
|
257
|
+
t.integer :rgt
|
258
|
+
t.integer :root_id
|
259
|
+
t.string :type
|
260
|
+
end
|
261
|
+
|
262
|
+
create_table :movies, :force => true, :id => false do |t|
|
263
|
+
t.primary_key :movieid
|
264
|
+
t.string :name
|
265
|
+
end
|
266
|
+
|
267
|
+
create_table :numeric_data, :force => true do |t|
|
268
|
+
t.decimal :bank_balance, :precision => 10, :scale => 2
|
269
|
+
t.decimal :big_bank_balance, :precision => 15, :scale => 2
|
270
|
+
t.decimal :world_population, :precision => 10, :scale => 0
|
271
|
+
t.decimal :my_house_population, :precision => 2, :scale => 0
|
272
|
+
t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
|
273
|
+
t.float :temperature
|
274
|
+
end
|
275
|
+
|
276
|
+
create_table :orders, :force => true do |t|
|
277
|
+
t.string :name
|
278
|
+
t.integer :billing_customer_id
|
279
|
+
t.integer :shipping_customer_id
|
280
|
+
end
|
281
|
+
|
282
|
+
create_table :organizations, :force => true do |t|
|
283
|
+
t.string :name
|
284
|
+
end
|
285
|
+
|
286
|
+
create_table :owners, :primary_key => :owner_id ,:force => true do |t|
|
287
|
+
t.string :name
|
288
|
+
end
|
289
|
+
|
290
|
+
except 'IBM_DB' do
|
291
|
+
create_table :paint_colors, :force => true do |t|
|
292
|
+
t.integer :non_poly_one_id
|
293
|
+
end
|
294
|
+
|
295
|
+
create_table :paint_textures, :force => true do |t|
|
296
|
+
t.integer :non_poly_two_id
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
create_table :parrots, :force => true do |t|
|
301
|
+
t.column :name, :string
|
302
|
+
t.column :parrot_sti_class, :string
|
303
|
+
t.column :killer_id, :integer
|
304
|
+
t.column :created_at, :datetime
|
305
|
+
t.column :created_on, :datetime
|
306
|
+
t.column :updated_at, :datetime
|
307
|
+
t.column :updated_on, :datetime
|
308
|
+
end
|
309
|
+
|
310
|
+
create_table :parrots_pirates, :id => false, :force => true do |t|
|
311
|
+
t.column :parrot_id, :integer
|
312
|
+
t.column :pirate_id, :integer
|
313
|
+
end
|
314
|
+
|
315
|
+
create_table :parrots_treasures, :id => false, :force => true do |t|
|
316
|
+
t.column :parrot_id, :integer
|
317
|
+
t.column :treasure_id, :integer
|
318
|
+
end
|
319
|
+
|
320
|
+
create_table :people, :force => true do |t|
|
321
|
+
t.string :first_name, :null => false
|
322
|
+
t.references :primary_contact
|
323
|
+
t.string :gender, :limit => 1
|
324
|
+
t.integer :lock_version, :null => false, :default => 0
|
325
|
+
end
|
326
|
+
|
327
|
+
create_table :pets, :primary_key => :pet_id ,:force => true do |t|
|
328
|
+
t.string :name
|
329
|
+
t.integer :owner_id, :integer
|
330
|
+
end
|
331
|
+
|
332
|
+
create_table :pirates, :force => true do |t|
|
333
|
+
t.column :catchphrase, :string
|
334
|
+
t.column :parrot_id, :integer
|
335
|
+
t.column :created_on, :datetime
|
336
|
+
t.column :updated_on, :datetime
|
337
|
+
end
|
338
|
+
|
339
|
+
except 'IBM_DB' do
|
340
|
+
create_table :posts, :force => true do |t|
|
341
|
+
t.integer :author_id
|
342
|
+
t.string :title, :null => false
|
343
|
+
t.text :body, :null => false
|
344
|
+
t.string :type
|
345
|
+
t.integer :comments_count, :default => 0
|
346
|
+
t.integer :taggings_count, :default => 0
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
create_table :price_estimates, :force => true do |t|
|
351
|
+
t.string :estimate_of_type
|
352
|
+
t.integer :estimate_of_id
|
353
|
+
t.integer :price
|
354
|
+
end
|
355
|
+
|
356
|
+
create_table :projects, :force => true do |t|
|
357
|
+
t.string :name
|
358
|
+
t.string :type
|
359
|
+
end
|
360
|
+
|
361
|
+
create_table :readers, :force => true do |t|
|
362
|
+
t.integer :post_id, :null => false
|
363
|
+
t.integer :person_id, :null => false
|
364
|
+
end
|
365
|
+
|
366
|
+
create_table :shape_expressions, :force => true do |t|
|
367
|
+
t.string :paint_type
|
368
|
+
t.integer :paint_id
|
369
|
+
t.string :shape_type
|
370
|
+
t.integer :shape_id
|
371
|
+
end
|
372
|
+
|
373
|
+
create_table :ships, :force => true do |t|
|
374
|
+
t.string :name
|
375
|
+
t.integer :pirate_id
|
376
|
+
t.datetime :created_at
|
377
|
+
t.datetime :created_on
|
378
|
+
t.datetime :updated_at
|
379
|
+
t.datetime :updated_on
|
380
|
+
end
|
381
|
+
|
382
|
+
create_table :ship_parts, :force => true do |t|
|
383
|
+
t.string :name
|
384
|
+
t.integer :ship_id
|
385
|
+
end
|
386
|
+
|
387
|
+
create_table :sponsors, :force => true do |t|
|
388
|
+
t.integer :club_id
|
389
|
+
t.integer :sponsorable_id
|
390
|
+
t.string :sponsorable_type
|
391
|
+
end
|
392
|
+
|
393
|
+
create_table :subscribers, :force => true, :id => false do |t|
|
394
|
+
t.string :nick, :null => false
|
395
|
+
t.string :name
|
396
|
+
end
|
397
|
+
add_index :subscribers, :nick, :unique => true
|
398
|
+
|
399
|
+
create_table :subscriptions, :force => true do |t|
|
400
|
+
t.string :subscriber_id
|
401
|
+
t.integer :book_id
|
402
|
+
end
|
403
|
+
|
404
|
+
create_table :tasks, :force => true do |t|
|
405
|
+
t.datetime :starting
|
406
|
+
t.datetime :ending
|
407
|
+
end
|
408
|
+
|
409
|
+
except 'IBM_DB' do
|
410
|
+
create_table :topics, :force => true do |t|
|
411
|
+
t.string :title
|
412
|
+
t.string :author_name
|
413
|
+
t.string :author_email_address
|
414
|
+
t.datetime :written_on
|
415
|
+
t.time :bonus_time
|
416
|
+
t.date :last_read
|
417
|
+
t.text :content
|
418
|
+
t.boolean :approved, :default => true
|
419
|
+
t.integer :replies_count, :default => 0
|
420
|
+
t.integer :parent_id
|
421
|
+
t.string :type
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
create_table :taggings, :force => true do |t|
|
426
|
+
t.column :tag_id, :integer
|
427
|
+
t.column :super_tag_id, :integer
|
428
|
+
t.column :taggable_type, :string
|
429
|
+
t.column :taggable_id, :integer
|
430
|
+
end
|
431
|
+
|
432
|
+
create_table :tags, :force => true do |t|
|
433
|
+
t.column :name, :string
|
434
|
+
t.column :taggings_count, :integer, :default => 0
|
435
|
+
end
|
436
|
+
|
437
|
+
create_table :toys, :primary_key => :toy_id ,:force => true do |t|
|
438
|
+
t.string :name
|
439
|
+
t.integer :pet_id, :integer
|
440
|
+
end
|
441
|
+
|
442
|
+
create_table :treasures, :force => true do |t|
|
443
|
+
t.column :name, :string
|
444
|
+
t.column :looter_id, :integer
|
445
|
+
t.column :looter_type, :string
|
446
|
+
end
|
447
|
+
|
448
|
+
create_table :vertices, :force => true do |t|
|
449
|
+
t.column :label, :string
|
450
|
+
end
|
451
|
+
|
452
|
+
create_table 'warehouse_things', :force => true do |t|
|
453
|
+
t.integer :value
|
454
|
+
end
|
455
|
+
|
456
|
+
except 'IBM_DB' do
|
457
|
+
[:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
|
458
|
+
create_table(t, :force => true) { }
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
create_table :guids, :force => true do |t|
|
463
|
+
t.column :key, :string
|
464
|
+
end
|
465
|
+
|
466
|
+
create_table :integer_limits, :force => true do |t|
|
467
|
+
t.integer :"c_int_without_limit"
|
468
|
+
(1..8).each do |i|
|
469
|
+
t.integer :"c_int_#{i}", :limit => i
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
except ['SQLite','IBM_DB'] do
|
474
|
+
# fk_test_has_fk should be before fk_test_has_pk
|
475
|
+
create_table :fk_test_has_fk, :force => true do |t|
|
476
|
+
t.integer :fk_id, :null => false
|
477
|
+
end
|
478
|
+
|
479
|
+
create_table :fk_test_has_pk, :force => true do |t|
|
480
|
+
end
|
481
|
+
|
482
|
+
execute "ALTER TABLE fk_test_has_fk ADD CONSTRAINT fk_name FOREIGN KEY (#{quote_column_name 'fk_id'}) REFERENCES #{quote_table_name 'fk_test_has_pk'} (#{quote_column_name 'id'})"
|
483
|
+
end
|
484
|
+
end
|