ibm_db 2.5.26-universal-darwin-14 → 2.6.1-universal-darwin-14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +11 -0
  3. data/MANIFEST +14 -14
  4. data/README +225 -225
  5. data/ext/Makefile.nt32 +181 -181
  6. data/ext/Makefile.nt32.191 +212 -212
  7. data/ext/extconf.rb +264 -261
  8. data/ext/extconf_MacOS.rb +269 -0
  9. data/ext/ibm_db.c +11879 -11793
  10. data/ext/ruby_ibm_db.h +241 -240
  11. data/ext/ruby_ibm_db_cli.c +851 -845
  12. data/ext/ruby_ibm_db_cli.h +500 -489
  13. data/init.rb +41 -41
  14. data/lib/IBM_DB.rb +27 -19
  15. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +3339 -3289
  16. data/lib/active_record/connection_adapters/ibmdb_adapter.rb +1 -1
  17. data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -328
  18. data/test/cases/adapter_test.rb +207 -207
  19. data/test/cases/associations/belongs_to_associations_test.rb +711 -711
  20. data/test/cases/associations/cascaded_eager_loading_test.rb +181 -181
  21. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +851 -851
  22. data/test/cases/associations/join_model_test.rb +743 -743
  23. data/test/cases/attribute_methods_test.rb +822 -822
  24. data/test/cases/base_test.rb +2133 -2133
  25. data/test/cases/calculations_test.rb +482 -482
  26. data/test/cases/migration_test.rb +2408 -2408
  27. data/test/cases/persistence_test.rb +642 -642
  28. data/test/cases/query_cache_test.rb +257 -257
  29. data/test/cases/relations_test.rb +1182 -1182
  30. data/test/cases/schema_dumper_test.rb +256 -256
  31. data/test/cases/transaction_callbacks_test.rb +300 -300
  32. data/test/cases/validations/uniqueness_validation_test.rb +299 -299
  33. data/test/cases/xml_serialization_test.rb +408 -408
  34. data/test/config.yml +154 -154
  35. data/test/connections/native_ibm_db/connection.rb +43 -43
  36. data/test/ibm_db_test.rb +24 -24
  37. data/test/models/warehouse_thing.rb +4 -4
  38. data/test/schema/schema.rb +751 -751
  39. metadata +6 -8
  40. data/lib/linux/rb18x/ibm_db.bundle +0 -0
  41. data/lib/linux/rb19x/ibm_db.bundle +0 -0
  42. data/lib/linux/rb20x/ibm_db.bundle +0 -0
  43. data/lib/linux/rb21x/ibm_db.bundle +0 -0
@@ -1,751 +1,751 @@
1
- ActiveRecord::Schema.define do
2
- def except(adapter_names_to_exclude)
3
- unless [adapter_names_to_exclude].flatten.include?(adapter_name)
4
- yield
5
- end
6
- end
7
-
8
- #put adapter specific setup here
9
- case adapter_name
10
- # For Firebird, set the sequence values 10000 when create_table is called;
11
- # this prevents primary key collisions between "normally" created records
12
- # and fixture-based (YAML) records.
13
- when "Firebird"
14
- def create_table(*args, &block)
15
- ActiveRecord::Base.connection.create_table(*args, &block)
16
- ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
17
- end
18
- end
19
-
20
-
21
- # ------------------------------------------------------------------- #
22
- # #
23
- # Please keep these create table statements in alphabetical order #
24
- # unless the ordering matters. In which case, define them below. #
25
- # #
26
- # ------------------------------------------------------------------- #
27
-
28
- create_table :accounts, :force => true do |t|
29
- t.integer :firm_id
30
- t.string :firm_name
31
- t.integer :credit_limit
32
- end
33
-
34
- create_table :admin_accounts, :force => true do |t|
35
- t.string :name
36
- end
37
-
38
- create_table :admin_users, :force => true do |t|
39
- t.string :name
40
- t.text :settings
41
- t.references :account
42
- end
43
-
44
- create_table :aircraft, :force => true do |t|
45
- t.string :name
46
- end
47
-
48
- create_table :audit_logs, :force => true do |t|
49
- t.column :message, :string, :null=>false
50
- t.column :developer_id, :integer, :null=>false
51
- t.integer :unvalidated_developer_id
52
- end
53
-
54
- create_table :authors, :force => true do |t|
55
- t.string :name, :null => false
56
- t.integer :author_address_id
57
- t.integer :author_address_extra_id
58
- t.string :organization_id
59
- t.string :owned_essay_id
60
- end
61
-
62
- create_table :author_addresses, :force => true do |t|
63
- end
64
-
65
- create_table :author_favorites, :force => true do |t|
66
- t.column :author_id, :integer
67
- t.column :favorite_author_id, :integer
68
- end
69
-
70
- create_table :auto_id_tests, :force => true, :id => false do |t|
71
- t.primary_key :auto_id
72
- t.integer :value
73
- end
74
-
75
- create_table :binaries, :force => true do |t|
76
- t.string :name
77
- t.binary :data
78
- end
79
-
80
- create_table :birds, :force => true do |t|
81
- t.string :name
82
- t.string :color
83
- t.integer :pirate_id
84
- end
85
-
86
- create_table :books, :force => true do |t|
87
- t.integer :author_id
88
- t.column :name, :string
89
- end
90
-
91
- create_table :booleans, :force => true do |t|
92
- t.boolean :value
93
- end
94
-
95
- create_table :bulbs, :force => true do |t|
96
- t.integer :car_id
97
- t.string :name
98
- t.boolean :frickinawesome
99
- t.string :color
100
- end
101
-
102
- create_table "camelcase", :force => true do |t|
103
- t.string :name
104
- end
105
-
106
- create_table :cars, :force => true do |t|
107
- t.string :name
108
- t.integer :engines_count
109
- t.integer :wheels_count
110
- end
111
-
112
- create_table :categories, :force => true do |t|
113
- t.string :name, :null => false
114
- t.string :type
115
- t.integer :categorizations_count
116
- end
117
-
118
- create_table :categories_posts, :force => true, :id => false do |t|
119
- t.integer :category_id, :null => false
120
- t.integer :post_id, :null => false
121
- end
122
-
123
- create_table :categorizations, :force => true do |t|
124
- t.column :category_id, :integer
125
- t.string :named_category_name
126
- t.column :post_id, :integer
127
- t.column :author_id, :integer
128
- t.column :special, :boolean
129
- end
130
-
131
- create_table :citations, :force => true do |t|
132
- t.column :book1_id, :integer
133
- t.column :book2_id, :integer
134
- end
135
-
136
- create_table :clubs, :force => true do |t|
137
- t.string :name
138
- t.integer :category_id
139
- end
140
-
141
- create_table :collections, :force => true do |t|
142
- t.string :name
143
- end
144
-
145
- create_table :colnametests, :force => true do |t|
146
- t.integer :references, :null => false
147
- end
148
-
149
- create_table :comments, :force => true do |t|
150
- t.integer :post_id, :null => false
151
- # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
152
- # Oracle SELECT WHERE clause which causes many unit test failures
153
- if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
154
- t.string :body, :null => false, :limit => 4000
155
- else
156
- t.text :body, :null => false
157
- end
158
- t.string :type
159
- t.integer :taggings_count, :default => 0
160
- t.integer :children_count, :default => 0
161
- t.integer :parent_id
162
- end
163
-
164
- create_table :companies, :force => true do |t|
165
- t.string :type
166
- t.string :ruby_type
167
- t.integer :firm_id
168
- t.string :firm_name
169
- t.string :name
170
- t.integer :client_of
171
- t.integer :rating, :default => 1
172
- t.integer :account_id
173
- end
174
-
175
- add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
176
-
177
- create_table :computers, :force => true do |t|
178
- t.integer :developer, :null => false
179
- t.integer :extendedWarranty, :null => false
180
- end
181
-
182
- create_table :contracts, :force => true do |t|
183
- t.integer :developer_id
184
- t.integer :company_id
185
- end
186
-
187
- create_table :customers, :force => true do |t|
188
- t.string :name
189
- t.integer :balance, :default => 0
190
- t.string :address_street
191
- t.string :address_city
192
- t.string :address_country
193
- t.string :gps_location
194
- end
195
-
196
- create_table :dashboards, :force => true, :id => false do |t|
197
- t.string :dashboard_id
198
- t.string :name
199
- end
200
-
201
- create_table :developers, :force => true do |t|
202
- t.string :name
203
- t.integer :salary, :default => 70000
204
- t.datetime :created_at
205
- t.datetime :updated_at
206
- end
207
-
208
- create_table :developers_projects, :force => true, :id => false do |t|
209
- t.integer :developer_id, :null => false
210
- t.integer :project_id, :null => false
211
- t.date :joined_on
212
- t.integer :access_level, :default => 1
213
- end
214
-
215
- create_table :dog_lovers, :force => true do |t|
216
- t.integer :trained_dogs_count, :default => 0
217
- t.integer :bred_dogs_count, :default => 0
218
- end
219
-
220
- create_table :dogs, :force => true do |t|
221
- t.integer :trainer_id
222
- t.integer :breeder_id
223
- end
224
-
225
- create_table :edges, :force => true, :id => false do |t|
226
- t.column :source_id, :integer, :null => false
227
- t.column :sink_id, :integer, :null => false
228
- end
229
- add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
230
-
231
- create_table :engines, :force => true do |t|
232
- t.integer :car_id
233
- end
234
-
235
- create_table :entrants, :force => true do |t|
236
- t.string :name, :null => false
237
- t.integer :course_id, :null => false
238
- end
239
-
240
- create_table :essays, :force => true do |t|
241
- t.string :name
242
- t.string :writer_id
243
- t.string :writer_type
244
- t.string :category_id
245
- t.string :author_id
246
- end
247
-
248
- create_table :events, :force => true do |t|
249
- t.string :title, :limit => 5
250
- end
251
-
252
- create_table :eyes, :force => true do |t|
253
- end
254
-
255
- create_table :funny_jokes, :force => true do |t|
256
- t.string :name
257
- end
258
-
259
- create_table :cold_jokes, :force => true do |t|
260
- t.string :name
261
- end
262
-
263
- create_table :goofy_string_id, :force => true, :id => false do |t|
264
- t.string :id, :null => false
265
- t.string :info
266
- end
267
-
268
- create_table :guids, :force => true do |t|
269
- t.column :key, :string
270
- end
271
-
272
- create_table :inept_wizards, :force => true do |t|
273
- t.column :name, :string, :null => false
274
- t.column :city, :string, :null => false
275
- t.column :type, :string
276
- end
277
-
278
- create_table :integer_limits, :force => true do |t|
279
- t.integer :"c_int_without_limit"
280
- (1..8).each do |i|
281
- t.integer :"c_int_#{i}", :limit => i
282
- end
283
- end
284
-
285
- create_table :invoices, :force => true do |t|
286
- t.integer :balance
287
- t.datetime :updated_at
288
- end
289
-
290
- create_table :iris, :force => true do |t|
291
- t.references :eye
292
- t.string :color
293
- end
294
-
295
- create_table :items, :force => true do |t|
296
- t.column :name, :string
297
- end
298
-
299
- create_table :jobs, :force => true do |t|
300
- t.integer :ideal_reference_id
301
- end
302
-
303
- create_table :keyboards, :force => true, :id => false do |t|
304
- t.primary_key :key_number
305
- t.string :name
306
- end
307
-
308
- create_table :legacy_things, :force => true do |t|
309
- t.integer :tps_report_number
310
- t.integer :version, :null => false, :default => 0
311
- end
312
-
313
- create_table :lessons, :force => true do |t|
314
- t.string :name
315
- end
316
-
317
- create_table :lessons_students, :id => false, :force => true do |t|
318
- t.references :lesson
319
- t.references :student
320
- end
321
-
322
- create_table :lint_models, :force => true
323
-
324
- create_table :line_items, :force => true do |t|
325
- t.integer :invoice_id
326
- t.integer :amount
327
- end
328
-
329
- create_table :lock_without_defaults, :force => true do |t|
330
- t.column :lock_version, :integer
331
- end
332
-
333
- create_table :lock_without_defaults_cust, :force => true do |t|
334
- t.column :custom_lock_version, :integer
335
- end
336
-
337
- create_table :mateys, :id => false, :force => true do |t|
338
- t.column :pirate_id, :integer
339
- t.column :target_id, :integer
340
- t.column :weight, :integer
341
- end
342
-
343
- create_table :members, :force => true do |t|
344
- t.string :name
345
- t.integer :member_type_id
346
- end
347
-
348
- create_table :member_details, :force => true do |t|
349
- t.integer :member_id
350
- t.integer :organization_id
351
- t.string :extra_data
352
- end
353
-
354
- create_table :memberships, :force => true do |t|
355
- t.datetime :joined_on
356
- t.integer :club_id, :member_id
357
- t.boolean :favourite, :default => false
358
- t.string :type
359
- end
360
-
361
- create_table :member_types, :force => true do |t|
362
- t.string :name
363
- end
364
-
365
- create_table :minivans, :force => true, :id => false do |t|
366
- t.string :minivan_id
367
- t.string :name
368
- t.string :speedometer_id
369
- t.string :color
370
- end
371
-
372
- create_table :minimalistics, :force => true do |t|
373
- end
374
-
375
- create_table :mixed_case_monkeys, :force => true, :id => false do |t|
376
- t.primary_key :monkeyID
377
- t.integer :fleaCount
378
- end
379
-
380
- create_table :mixins, :force => true do |t|
381
- t.integer :parent_id
382
- t.integer :pos
383
- t.datetime :created_at
384
- t.datetime :updated_at
385
- t.integer :lft
386
- t.integer :rgt
387
- t.integer :root_id
388
- t.string :type
389
- end
390
-
391
- create_table :movies, :force => true, :id => false do |t|
392
- t.primary_key :movieid
393
- t.string :name
394
- end
395
-
396
- create_table :numeric_data, :force => true do |t|
397
- t.decimal :bank_balance, :precision => 10, :scale => 2
398
- t.decimal :big_bank_balance, :precision => 15, :scale => 2
399
- t.decimal :world_population, :precision => 10, :scale => 0
400
- t.decimal :my_house_population, :precision => 2, :scale => 0
401
- t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
402
- t.float :temperature
403
- # Oracle/SQLServer supports precision up to 38
404
- if current_adapter?(:OracleAdapter,:SQLServerAdapter)
405
- t.decimal :atoms_in_universe, :precision => 38, :scale => 0
406
- elsif current_adapter?(:IBM_DBAdapter)
407
- t.decimal :atoms_in_universe, :precision => 31, :scale => 0
408
- else
409
- t.decimal :atoms_in_universe, :precision => 55, :scale => 0
410
- end
411
- end
412
-
413
- create_table :orders, :force => true do |t|
414
- t.string :name
415
- t.integer :billing_customer_id
416
- t.integer :shipping_customer_id
417
- end
418
-
419
- create_table :organizations, :force => true do |t|
420
- t.string :name
421
- end
422
-
423
- create_table :owners, :primary_key => :owner_id ,:force => true do |t|
424
- t.string :name
425
- t.column :updated_at, :datetime
426
- t.column :happy_at, :datetime
427
- t.string :essay_id
428
- end
429
-
430
- create_table :paint_colors, :force => true do |t|
431
- t.integer :non_poly_one_id
432
- end
433
-
434
- create_table :paint_textures, :force => true do |t|
435
- t.integer :non_poly_two_id
436
- end
437
-
438
- create_table :parrots, :force => true do |t|
439
- t.column :name, :string
440
- t.column :parrot_sti_class, :string
441
- t.column :killer_id, :integer
442
- t.column :created_at, :datetime
443
- t.column :created_on, :datetime
444
- t.column :updated_at, :datetime
445
- t.column :updated_on, :datetime
446
- end
447
-
448
- create_table :parrots_pirates, :id => false, :force => true do |t|
449
- t.column :parrot_id, :integer
450
- t.column :pirate_id, :integer
451
- end
452
-
453
- create_table :parrots_treasures, :id => false, :force => true do |t|
454
- t.column :parrot_id, :integer
455
- t.column :treasure_id, :integer
456
- end
457
-
458
- create_table :people, :force => true do |t|
459
- t.string :first_name, :null => false
460
- t.references :primary_contact
461
- t.string :gender, :limit => 1
462
- t.references :number1_fan
463
- t.integer :lock_version, :null => false, :default => 0
464
- t.string :comments
465
- t.references :best_friend
466
- t.references :best_friend_of
467
- t.timestamps
468
- end
469
-
470
- create_table :pets, :primary_key => :pet_id ,:force => true do |t|
471
- t.string :name
472
- t.integer :owner_id, :integer
473
- t.timestamps
474
- end
475
-
476
- create_table :pirates, :force => true do |t|
477
- t.column :catchphrase, :string
478
- t.column :parrot_id, :integer
479
- t.integer :non_validated_parrot_id
480
- t.column :created_on, :datetime
481
- t.column :updated_on, :datetime
482
- end
483
-
484
- create_table :posts, :force => true do |t|
485
- t.integer :author_id
486
- t.string :title, :null => false
487
- # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
488
- # Oracle SELECT WHERE clause which causes many unit test failures
489
- if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
490
- t.string :body, :null => false, :limit => 4000
491
- else
492
- t.text :body, :null => false
493
- end
494
- t.string :type
495
- t.integer :comments_count, :default => 0
496
- t.integer :taggings_count, :default => 0
497
- t.integer :taggings_with_delete_all_count, :default => 0
498
- t.integer :taggings_with_destroy_count, :default => 0
499
- t.integer :tags_count, :default => 0
500
- t.integer :tags_with_destroy_count, :default => 0
501
- t.integer :tags_with_nullify_count, :default => 0
502
- end
503
-
504
- create_table :price_estimates, :force => true do |t|
505
- t.string :estimate_of_type
506
- t.integer :estimate_of_id
507
- t.integer :price
508
- end
509
-
510
- create_table :products, :force => true do |t|
511
- t.references :collection
512
- t.string :name
513
- end
514
-
515
- create_table :projects, :force => true do |t|
516
- t.string :name
517
- t.string :type
518
- end
519
-
520
- create_table :ratings, :force => true do |t|
521
- t.integer :comment_id
522
- t.integer :value
523
- end
524
-
525
- create_table :readers, :force => true do |t|
526
- t.integer :post_id, :null => false
527
- t.integer :person_id, :null => false
528
- t.boolean :skimmer, :default => false
529
- end
530
-
531
- create_table :references, :force => true do |t|
532
- t.integer :person_id
533
- t.integer :job_id
534
- t.boolean :favourite
535
- t.integer :lock_version, :default => 0
536
- end
537
-
538
- create_table :shape_expressions, :force => true do |t|
539
- t.string :paint_type
540
- t.integer :paint_id
541
- t.string :shape_type
542
- t.integer :shape_id
543
- end
544
-
545
- create_table :ships, :force => true do |t|
546
- t.string :name
547
- t.integer :pirate_id
548
- t.integer :update_only_pirate_id
549
- t.datetime :created_at
550
- t.datetime :created_on
551
- t.datetime :updated_at
552
- t.datetime :updated_on
553
- end
554
-
555
- create_table :ship_parts, :force => true do |t|
556
- t.string :name
557
- t.integer :ship_id
558
- end
559
-
560
- create_table :speedometers, :force => true, :id => false do |t|
561
- t.string :speedometer_id
562
- t.string :name
563
- t.string :dashboard_id
564
- end
565
-
566
- create_table :sponsors, :force => true do |t|
567
- t.integer :club_id
568
- t.integer :sponsorable_id
569
- t.string :sponsorable_type
570
- end
571
-
572
- create_table :string_key_objects, :id => false, :primary_key => :id, :force => true do |t|
573
- t.string :id
574
- t.string :name
575
- t.integer :lock_version, :null => false, :default => 0
576
- end
577
-
578
- create_table :students, :force => true do |t|
579
- t.string :name
580
- end
581
-
582
- create_table :subscribers, :force => true, :id => false do |t|
583
- t.string :nick, :null => false
584
- t.string :name
585
- end
586
- add_index :subscribers, :nick, :unique => true
587
-
588
- create_table :subscriptions, :force => true do |t|
589
- t.string :subscriber_id
590
- t.integer :book_id
591
- end
592
-
593
- create_table :tags, :force => true do |t|
594
- t.column :name, :string
595
- t.column :taggings_count, :integer, :default => 0
596
- end
597
-
598
- create_table :taggings, :force => true do |t|
599
- t.column :tag_id, :integer
600
- t.column :super_tag_id, :integer
601
- t.column :taggable_type, :string
602
- t.column :taggable_id, :integer
603
- t.string :comment
604
- end
605
-
606
- create_table :tasks, :force => true do |t|
607
- t.datetime :starting
608
- t.datetime :ending
609
- end
610
-
611
- create_table :topics, :force => true do |t|
612
- t.string :title
613
- t.string :author_name
614
- t.string :author_email_address
615
- t.datetime :written_on
616
- t.time :bonus_time
617
- t.date :last_read
618
- # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
619
- # Oracle SELECT WHERE clause which causes many unit test failures
620
- if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
621
- t.string :content, :limit => 4000
622
- t.string :important, :limit => 4000
623
- else
624
- t.text :content
625
- t.text :important
626
- end
627
- t.boolean :approved, :default => true
628
- t.integer :replies_count, :default => 0
629
- t.integer :parent_id
630
- t.string :parent_title
631
- t.string :type
632
- t.string :group
633
- t.timestamps
634
- end
635
-
636
- create_table :toys, :primary_key => :toy_id ,:force => true do |t|
637
- t.string :name
638
- t.integer :pet_id, :integer
639
- t.timestamps
640
- end
641
-
642
- create_table :traffic_lights, :force => true do |t|
643
- t.string :location
644
- t.string :state
645
- t.datetime :created_at
646
- t.datetime :updated_at
647
- end
648
-
649
- create_table :treasures, :force => true do |t|
650
- t.column :name, :string
651
- t.column :looter_id, :integer
652
- t.column :looter_type, :string
653
- end
654
-
655
- create_table :tyres, :force => true do |t|
656
- t.integer :car_id
657
- end
658
-
659
- create_table :variants, :force => true do |t|
660
- t.references :product
661
- t.string :name
662
- end
663
-
664
- create_table :vertices, :force => true do |t|
665
- t.column :label, :string
666
- end
667
-
668
- create_table 'warehouse_things', :force => true do |t|
669
- t.integer :value
670
- end
671
-
672
- [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
673
- create_table(t, :force => true) { }
674
- end
675
-
676
- # NOTE - the following 4 tables are used by models that have :inverse_of options on the associations
677
- create_table :men, :force => true do |t|
678
- t.string :name
679
- end
680
-
681
- create_table :faces, :force => true do |t|
682
- t.string :description
683
- t.integer :man_id
684
- t.integer :polymorphic_man_id
685
- t.string :polymorphic_man_type
686
- t.integer :horrible_polymorphic_man_id
687
- t.string :horrible_polymorphic_man_type
688
- end
689
-
690
- create_table :interests, :force => true do |t|
691
- t.string :topic
692
- t.integer :man_id
693
- t.integer :polymorphic_man_id
694
- t.string :polymorphic_man_type
695
- t.integer :zine_id
696
- end
697
-
698
- create_table :wheels, :force => true do |t|
699
- t.references :wheelable, :polymorphic => true
700
- end
701
-
702
- create_table :zines, :force => true do |t|
703
- t.string :title
704
- end
705
-
706
- create_table :countries, :force => true, :id => false, :primary_key => 'country_id' do |t|
707
- t.string :country_id
708
- t.string :name
709
- end
710
- create_table :treaties, :force => true, :id => false, :primary_key => 'treaty_id' do |t|
711
- t.string :treaty_id
712
- t.string :name
713
- end
714
- create_table :countries_treaties, :force => true, :id => false do |t|
715
- t.string :country_id, :null => false
716
- t.string :treaty_id, :null => false
717
- end
718
-
719
- create_table :liquid, :force => true do |t|
720
- t.string :name
721
- end
722
- create_table :molecules, :force => true do |t|
723
- t.integer :liquid_id
724
- t.string :name
725
- end
726
- create_table :electrons, :force => true do |t|
727
- t.integer :molecule_id
728
- t.string :name
729
- end
730
- create_table :weirds, :force => true do |t|
731
- t.string 'a$b'
732
- end
733
-
734
- except 'SQLite' do
735
- # fk_test_has_fk should be before fk_test_has_pk
736
- create_table :fk_test_has_fk, :force => true do |t|
737
- t.integer :fk_id, :null => false
738
- end
739
-
740
- create_table :fk_test_has_pk, :force => true do |t|
741
- end
742
-
743
- 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'})"
744
-
745
- execute "ALTER TABLE lessons_students ADD CONSTRAINT student_id_fk FOREIGN KEY (#{quote_column_name 'student_id'}) REFERENCES #{quote_table_name 'students'} (#{quote_column_name 'id'})"
746
- end
747
- end
748
-
749
- Course.connection.create_table :courses, :force => true do |t|
750
- t.column :name, :string, :null => false
751
- end
1
+ ActiveRecord::Schema.define do
2
+ def except(adapter_names_to_exclude)
3
+ unless [adapter_names_to_exclude].flatten.include?(adapter_name)
4
+ yield
5
+ end
6
+ end
7
+
8
+ #put adapter specific setup here
9
+ case adapter_name
10
+ # For Firebird, set the sequence values 10000 when create_table is called;
11
+ # this prevents primary key collisions between "normally" created records
12
+ # and fixture-based (YAML) records.
13
+ when "Firebird"
14
+ def create_table(*args, &block)
15
+ ActiveRecord::Base.connection.create_table(*args, &block)
16
+ ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
17
+ end
18
+ end
19
+
20
+
21
+ # ------------------------------------------------------------------- #
22
+ # #
23
+ # Please keep these create table statements in alphabetical order #
24
+ # unless the ordering matters. In which case, define them below. #
25
+ # #
26
+ # ------------------------------------------------------------------- #
27
+
28
+ create_table :accounts, :force => true do |t|
29
+ t.integer :firm_id
30
+ t.string :firm_name
31
+ t.integer :credit_limit
32
+ end
33
+
34
+ create_table :admin_accounts, :force => true do |t|
35
+ t.string :name
36
+ end
37
+
38
+ create_table :admin_users, :force => true do |t|
39
+ t.string :name
40
+ t.text :settings
41
+ t.references :account
42
+ end
43
+
44
+ create_table :aircraft, :force => true do |t|
45
+ t.string :name
46
+ end
47
+
48
+ create_table :audit_logs, :force => true do |t|
49
+ t.column :message, :string, :null=>false
50
+ t.column :developer_id, :integer, :null=>false
51
+ t.integer :unvalidated_developer_id
52
+ end
53
+
54
+ create_table :authors, :force => true do |t|
55
+ t.string :name, :null => false
56
+ t.integer :author_address_id
57
+ t.integer :author_address_extra_id
58
+ t.string :organization_id
59
+ t.string :owned_essay_id
60
+ end
61
+
62
+ create_table :author_addresses, :force => true do |t|
63
+ end
64
+
65
+ create_table :author_favorites, :force => true do |t|
66
+ t.column :author_id, :integer
67
+ t.column :favorite_author_id, :integer
68
+ end
69
+
70
+ create_table :auto_id_tests, :force => true, :id => false do |t|
71
+ t.primary_key :auto_id
72
+ t.integer :value
73
+ end
74
+
75
+ create_table :binaries, :force => true do |t|
76
+ t.string :name
77
+ t.binary :data
78
+ end
79
+
80
+ create_table :birds, :force => true do |t|
81
+ t.string :name
82
+ t.string :color
83
+ t.integer :pirate_id
84
+ end
85
+
86
+ create_table :books, :force => true do |t|
87
+ t.integer :author_id
88
+ t.column :name, :string
89
+ end
90
+
91
+ create_table :booleans, :force => true do |t|
92
+ t.boolean :value
93
+ end
94
+
95
+ create_table :bulbs, :force => true do |t|
96
+ t.integer :car_id
97
+ t.string :name
98
+ t.boolean :frickinawesome
99
+ t.string :color
100
+ end
101
+
102
+ create_table "camelcase", :force => true do |t|
103
+ t.string :name
104
+ end
105
+
106
+ create_table :cars, :force => true do |t|
107
+ t.string :name
108
+ t.integer :engines_count
109
+ t.integer :wheels_count
110
+ end
111
+
112
+ create_table :categories, :force => true do |t|
113
+ t.string :name, :null => false
114
+ t.string :type
115
+ t.integer :categorizations_count
116
+ end
117
+
118
+ create_table :categories_posts, :force => true, :id => false do |t|
119
+ t.integer :category_id, :null => false
120
+ t.integer :post_id, :null => false
121
+ end
122
+
123
+ create_table :categorizations, :force => true do |t|
124
+ t.column :category_id, :integer
125
+ t.string :named_category_name
126
+ t.column :post_id, :integer
127
+ t.column :author_id, :integer
128
+ t.column :special, :boolean
129
+ end
130
+
131
+ create_table :citations, :force => true do |t|
132
+ t.column :book1_id, :integer
133
+ t.column :book2_id, :integer
134
+ end
135
+
136
+ create_table :clubs, :force => true do |t|
137
+ t.string :name
138
+ t.integer :category_id
139
+ end
140
+
141
+ create_table :collections, :force => true do |t|
142
+ t.string :name
143
+ end
144
+
145
+ create_table :colnametests, :force => true do |t|
146
+ t.integer :references, :null => false
147
+ end
148
+
149
+ create_table :comments, :force => true do |t|
150
+ t.integer :post_id, :null => false
151
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
152
+ # Oracle SELECT WHERE clause which causes many unit test failures
153
+ if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
154
+ t.string :body, :null => false, :limit => 4000
155
+ else
156
+ t.text :body, :null => false
157
+ end
158
+ t.string :type
159
+ t.integer :taggings_count, :default => 0
160
+ t.integer :children_count, :default => 0
161
+ t.integer :parent_id
162
+ end
163
+
164
+ create_table :companies, :force => true do |t|
165
+ t.string :type
166
+ t.string :ruby_type
167
+ t.integer :firm_id
168
+ t.string :firm_name
169
+ t.string :name
170
+ t.integer :client_of
171
+ t.integer :rating, :default => 1
172
+ t.integer :account_id
173
+ end
174
+
175
+ add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
176
+
177
+ create_table :computers, :force => true do |t|
178
+ t.integer :developer, :null => false
179
+ t.integer :extendedWarranty, :null => false
180
+ end
181
+
182
+ create_table :contracts, :force => true do |t|
183
+ t.integer :developer_id
184
+ t.integer :company_id
185
+ end
186
+
187
+ create_table :customers, :force => true do |t|
188
+ t.string :name
189
+ t.integer :balance, :default => 0
190
+ t.string :address_street
191
+ t.string :address_city
192
+ t.string :address_country
193
+ t.string :gps_location
194
+ end
195
+
196
+ create_table :dashboards, :force => true, :id => false do |t|
197
+ t.string :dashboard_id
198
+ t.string :name
199
+ end
200
+
201
+ create_table :developers, :force => true do |t|
202
+ t.string :name
203
+ t.integer :salary, :default => 70000
204
+ t.datetime :created_at
205
+ t.datetime :updated_at
206
+ end
207
+
208
+ create_table :developers_projects, :force => true, :id => false do |t|
209
+ t.integer :developer_id, :null => false
210
+ t.integer :project_id, :null => false
211
+ t.date :joined_on
212
+ t.integer :access_level, :default => 1
213
+ end
214
+
215
+ create_table :dog_lovers, :force => true do |t|
216
+ t.integer :trained_dogs_count, :default => 0
217
+ t.integer :bred_dogs_count, :default => 0
218
+ end
219
+
220
+ create_table :dogs, :force => true do |t|
221
+ t.integer :trainer_id
222
+ t.integer :breeder_id
223
+ end
224
+
225
+ create_table :edges, :force => true, :id => false do |t|
226
+ t.column :source_id, :integer, :null => false
227
+ t.column :sink_id, :integer, :null => false
228
+ end
229
+ add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
230
+
231
+ create_table :engines, :force => true do |t|
232
+ t.integer :car_id
233
+ end
234
+
235
+ create_table :entrants, :force => true do |t|
236
+ t.string :name, :null => false
237
+ t.integer :course_id, :null => false
238
+ end
239
+
240
+ create_table :essays, :force => true do |t|
241
+ t.string :name
242
+ t.string :writer_id
243
+ t.string :writer_type
244
+ t.string :category_id
245
+ t.string :author_id
246
+ end
247
+
248
+ create_table :events, :force => true do |t|
249
+ t.string :title, :limit => 5
250
+ end
251
+
252
+ create_table :eyes, :force => true do |t|
253
+ end
254
+
255
+ create_table :funny_jokes, :force => true do |t|
256
+ t.string :name
257
+ end
258
+
259
+ create_table :cold_jokes, :force => true do |t|
260
+ t.string :name
261
+ end
262
+
263
+ create_table :goofy_string_id, :force => true, :id => false do |t|
264
+ t.string :id, :null => false
265
+ t.string :info
266
+ end
267
+
268
+ create_table :guids, :force => true do |t|
269
+ t.column :key, :string
270
+ end
271
+
272
+ create_table :inept_wizards, :force => true do |t|
273
+ t.column :name, :string, :null => false
274
+ t.column :city, :string, :null => false
275
+ t.column :type, :string
276
+ end
277
+
278
+ create_table :integer_limits, :force => true do |t|
279
+ t.integer :"c_int_without_limit"
280
+ (1..8).each do |i|
281
+ t.integer :"c_int_#{i}", :limit => i
282
+ end
283
+ end
284
+
285
+ create_table :invoices, :force => true do |t|
286
+ t.integer :balance
287
+ t.datetime :updated_at
288
+ end
289
+
290
+ create_table :iris, :force => true do |t|
291
+ t.references :eye
292
+ t.string :color
293
+ end
294
+
295
+ create_table :items, :force => true do |t|
296
+ t.column :name, :string
297
+ end
298
+
299
+ create_table :jobs, :force => true do |t|
300
+ t.integer :ideal_reference_id
301
+ end
302
+
303
+ create_table :keyboards, :force => true, :id => false do |t|
304
+ t.primary_key :key_number
305
+ t.string :name
306
+ end
307
+
308
+ create_table :legacy_things, :force => true do |t|
309
+ t.integer :tps_report_number
310
+ t.integer :version, :null => false, :default => 0
311
+ end
312
+
313
+ create_table :lessons, :force => true do |t|
314
+ t.string :name
315
+ end
316
+
317
+ create_table :lessons_students, :id => false, :force => true do |t|
318
+ t.references :lesson
319
+ t.references :student
320
+ end
321
+
322
+ create_table :lint_models, :force => true
323
+
324
+ create_table :line_items, :force => true do |t|
325
+ t.integer :invoice_id
326
+ t.integer :amount
327
+ end
328
+
329
+ create_table :lock_without_defaults, :force => true do |t|
330
+ t.column :lock_version, :integer
331
+ end
332
+
333
+ create_table :lock_without_defaults_cust, :force => true do |t|
334
+ t.column :custom_lock_version, :integer
335
+ end
336
+
337
+ create_table :mateys, :id => false, :force => true do |t|
338
+ t.column :pirate_id, :integer
339
+ t.column :target_id, :integer
340
+ t.column :weight, :integer
341
+ end
342
+
343
+ create_table :members, :force => true do |t|
344
+ t.string :name
345
+ t.integer :member_type_id
346
+ end
347
+
348
+ create_table :member_details, :force => true do |t|
349
+ t.integer :member_id
350
+ t.integer :organization_id
351
+ t.string :extra_data
352
+ end
353
+
354
+ create_table :memberships, :force => true do |t|
355
+ t.datetime :joined_on
356
+ t.integer :club_id, :member_id
357
+ t.boolean :favourite, :default => false
358
+ t.string :type
359
+ end
360
+
361
+ create_table :member_types, :force => true do |t|
362
+ t.string :name
363
+ end
364
+
365
+ create_table :minivans, :force => true, :id => false do |t|
366
+ t.string :minivan_id
367
+ t.string :name
368
+ t.string :speedometer_id
369
+ t.string :color
370
+ end
371
+
372
+ create_table :minimalistics, :force => true do |t|
373
+ end
374
+
375
+ create_table :mixed_case_monkeys, :force => true, :id => false do |t|
376
+ t.primary_key :monkeyID
377
+ t.integer :fleaCount
378
+ end
379
+
380
+ create_table :mixins, :force => true do |t|
381
+ t.integer :parent_id
382
+ t.integer :pos
383
+ t.datetime :created_at
384
+ t.datetime :updated_at
385
+ t.integer :lft
386
+ t.integer :rgt
387
+ t.integer :root_id
388
+ t.string :type
389
+ end
390
+
391
+ create_table :movies, :force => true, :id => false do |t|
392
+ t.primary_key :movieid
393
+ t.string :name
394
+ end
395
+
396
+ create_table :numeric_data, :force => true do |t|
397
+ t.decimal :bank_balance, :precision => 10, :scale => 2
398
+ t.decimal :big_bank_balance, :precision => 15, :scale => 2
399
+ t.decimal :world_population, :precision => 10, :scale => 0
400
+ t.decimal :my_house_population, :precision => 2, :scale => 0
401
+ t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
402
+ t.float :temperature
403
+ # Oracle/SQLServer supports precision up to 38
404
+ if current_adapter?(:OracleAdapter,:SQLServerAdapter)
405
+ t.decimal :atoms_in_universe, :precision => 38, :scale => 0
406
+ elsif current_adapter?(:IBM_DBAdapter)
407
+ t.decimal :atoms_in_universe, :precision => 31, :scale => 0
408
+ else
409
+ t.decimal :atoms_in_universe, :precision => 55, :scale => 0
410
+ end
411
+ end
412
+
413
+ create_table :orders, :force => true do |t|
414
+ t.string :name
415
+ t.integer :billing_customer_id
416
+ t.integer :shipping_customer_id
417
+ end
418
+
419
+ create_table :organizations, :force => true do |t|
420
+ t.string :name
421
+ end
422
+
423
+ create_table :owners, :primary_key => :owner_id ,:force => true do |t|
424
+ t.string :name
425
+ t.column :updated_at, :datetime
426
+ t.column :happy_at, :datetime
427
+ t.string :essay_id
428
+ end
429
+
430
+ create_table :paint_colors, :force => true do |t|
431
+ t.integer :non_poly_one_id
432
+ end
433
+
434
+ create_table :paint_textures, :force => true do |t|
435
+ t.integer :non_poly_two_id
436
+ end
437
+
438
+ create_table :parrots, :force => true do |t|
439
+ t.column :name, :string
440
+ t.column :parrot_sti_class, :string
441
+ t.column :killer_id, :integer
442
+ t.column :created_at, :datetime
443
+ t.column :created_on, :datetime
444
+ t.column :updated_at, :datetime
445
+ t.column :updated_on, :datetime
446
+ end
447
+
448
+ create_table :parrots_pirates, :id => false, :force => true do |t|
449
+ t.column :parrot_id, :integer
450
+ t.column :pirate_id, :integer
451
+ end
452
+
453
+ create_table :parrots_treasures, :id => false, :force => true do |t|
454
+ t.column :parrot_id, :integer
455
+ t.column :treasure_id, :integer
456
+ end
457
+
458
+ create_table :people, :force => true do |t|
459
+ t.string :first_name, :null => false
460
+ t.references :primary_contact
461
+ t.string :gender, :limit => 1
462
+ t.references :number1_fan
463
+ t.integer :lock_version, :null => false, :default => 0
464
+ t.string :comments
465
+ t.references :best_friend
466
+ t.references :best_friend_of
467
+ t.timestamps
468
+ end
469
+
470
+ create_table :pets, :primary_key => :pet_id ,:force => true do |t|
471
+ t.string :name
472
+ t.integer :owner_id, :integer
473
+ t.timestamps
474
+ end
475
+
476
+ create_table :pirates, :force => true do |t|
477
+ t.column :catchphrase, :string
478
+ t.column :parrot_id, :integer
479
+ t.integer :non_validated_parrot_id
480
+ t.column :created_on, :datetime
481
+ t.column :updated_on, :datetime
482
+ end
483
+
484
+ create_table :posts, :force => true do |t|
485
+ t.integer :author_id
486
+ t.string :title, :null => false
487
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
488
+ # Oracle SELECT WHERE clause which causes many unit test failures
489
+ if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
490
+ t.string :body, :null => false, :limit => 4000
491
+ else
492
+ t.text :body, :null => false
493
+ end
494
+ t.string :type
495
+ t.integer :comments_count, :default => 0
496
+ t.integer :taggings_count, :default => 0
497
+ t.integer :taggings_with_delete_all_count, :default => 0
498
+ t.integer :taggings_with_destroy_count, :default => 0
499
+ t.integer :tags_count, :default => 0
500
+ t.integer :tags_with_destroy_count, :default => 0
501
+ t.integer :tags_with_nullify_count, :default => 0
502
+ end
503
+
504
+ create_table :price_estimates, :force => true do |t|
505
+ t.string :estimate_of_type
506
+ t.integer :estimate_of_id
507
+ t.integer :price
508
+ end
509
+
510
+ create_table :products, :force => true do |t|
511
+ t.references :collection
512
+ t.string :name
513
+ end
514
+
515
+ create_table :projects, :force => true do |t|
516
+ t.string :name
517
+ t.string :type
518
+ end
519
+
520
+ create_table :ratings, :force => true do |t|
521
+ t.integer :comment_id
522
+ t.integer :value
523
+ end
524
+
525
+ create_table :readers, :force => true do |t|
526
+ t.integer :post_id, :null => false
527
+ t.integer :person_id, :null => false
528
+ t.boolean :skimmer, :default => false
529
+ end
530
+
531
+ create_table :references, :force => true do |t|
532
+ t.integer :person_id
533
+ t.integer :job_id
534
+ t.boolean :favourite
535
+ t.integer :lock_version, :default => 0
536
+ end
537
+
538
+ create_table :shape_expressions, :force => true do |t|
539
+ t.string :paint_type
540
+ t.integer :paint_id
541
+ t.string :shape_type
542
+ t.integer :shape_id
543
+ end
544
+
545
+ create_table :ships, :force => true do |t|
546
+ t.string :name
547
+ t.integer :pirate_id
548
+ t.integer :update_only_pirate_id
549
+ t.datetime :created_at
550
+ t.datetime :created_on
551
+ t.datetime :updated_at
552
+ t.datetime :updated_on
553
+ end
554
+
555
+ create_table :ship_parts, :force => true do |t|
556
+ t.string :name
557
+ t.integer :ship_id
558
+ end
559
+
560
+ create_table :speedometers, :force => true, :id => false do |t|
561
+ t.string :speedometer_id
562
+ t.string :name
563
+ t.string :dashboard_id
564
+ end
565
+
566
+ create_table :sponsors, :force => true do |t|
567
+ t.integer :club_id
568
+ t.integer :sponsorable_id
569
+ t.string :sponsorable_type
570
+ end
571
+
572
+ create_table :string_key_objects, :id => false, :primary_key => :id, :force => true do |t|
573
+ t.string :id
574
+ t.string :name
575
+ t.integer :lock_version, :null => false, :default => 0
576
+ end
577
+
578
+ create_table :students, :force => true do |t|
579
+ t.string :name
580
+ end
581
+
582
+ create_table :subscribers, :force => true, :id => false do |t|
583
+ t.string :nick, :null => false
584
+ t.string :name
585
+ end
586
+ add_index :subscribers, :nick, :unique => true
587
+
588
+ create_table :subscriptions, :force => true do |t|
589
+ t.string :subscriber_id
590
+ t.integer :book_id
591
+ end
592
+
593
+ create_table :tags, :force => true do |t|
594
+ t.column :name, :string
595
+ t.column :taggings_count, :integer, :default => 0
596
+ end
597
+
598
+ create_table :taggings, :force => true do |t|
599
+ t.column :tag_id, :integer
600
+ t.column :super_tag_id, :integer
601
+ t.column :taggable_type, :string
602
+ t.column :taggable_id, :integer
603
+ t.string :comment
604
+ end
605
+
606
+ create_table :tasks, :force => true do |t|
607
+ t.datetime :starting
608
+ t.datetime :ending
609
+ end
610
+
611
+ create_table :topics, :force => true do |t|
612
+ t.string :title
613
+ t.string :author_name
614
+ t.string :author_email_address
615
+ t.datetime :written_on
616
+ t.time :bonus_time
617
+ t.date :last_read
618
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
619
+ # Oracle SELECT WHERE clause which causes many unit test failures
620
+ if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
621
+ t.string :content, :limit => 4000
622
+ t.string :important, :limit => 4000
623
+ else
624
+ t.text :content
625
+ t.text :important
626
+ end
627
+ t.boolean :approved, :default => true
628
+ t.integer :replies_count, :default => 0
629
+ t.integer :parent_id
630
+ t.string :parent_title
631
+ t.string :type
632
+ t.string :group
633
+ t.timestamps
634
+ end
635
+
636
+ create_table :toys, :primary_key => :toy_id ,:force => true do |t|
637
+ t.string :name
638
+ t.integer :pet_id, :integer
639
+ t.timestamps
640
+ end
641
+
642
+ create_table :traffic_lights, :force => true do |t|
643
+ t.string :location
644
+ t.string :state
645
+ t.datetime :created_at
646
+ t.datetime :updated_at
647
+ end
648
+
649
+ create_table :treasures, :force => true do |t|
650
+ t.column :name, :string
651
+ t.column :looter_id, :integer
652
+ t.column :looter_type, :string
653
+ end
654
+
655
+ create_table :tyres, :force => true do |t|
656
+ t.integer :car_id
657
+ end
658
+
659
+ create_table :variants, :force => true do |t|
660
+ t.references :product
661
+ t.string :name
662
+ end
663
+
664
+ create_table :vertices, :force => true do |t|
665
+ t.column :label, :string
666
+ end
667
+
668
+ create_table 'warehouse_things', :force => true do |t|
669
+ t.integer :value
670
+ end
671
+
672
+ [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
673
+ create_table(t, :force => true) { }
674
+ end
675
+
676
+ # NOTE - the following 4 tables are used by models that have :inverse_of options on the associations
677
+ create_table :men, :force => true do |t|
678
+ t.string :name
679
+ end
680
+
681
+ create_table :faces, :force => true do |t|
682
+ t.string :description
683
+ t.integer :man_id
684
+ t.integer :polymorphic_man_id
685
+ t.string :polymorphic_man_type
686
+ t.integer :horrible_polymorphic_man_id
687
+ t.string :horrible_polymorphic_man_type
688
+ end
689
+
690
+ create_table :interests, :force => true do |t|
691
+ t.string :topic
692
+ t.integer :man_id
693
+ t.integer :polymorphic_man_id
694
+ t.string :polymorphic_man_type
695
+ t.integer :zine_id
696
+ end
697
+
698
+ create_table :wheels, :force => true do |t|
699
+ t.references :wheelable, :polymorphic => true
700
+ end
701
+
702
+ create_table :zines, :force => true do |t|
703
+ t.string :title
704
+ end
705
+
706
+ create_table :countries, :force => true, :id => false, :primary_key => 'country_id' do |t|
707
+ t.string :country_id
708
+ t.string :name
709
+ end
710
+ create_table :treaties, :force => true, :id => false, :primary_key => 'treaty_id' do |t|
711
+ t.string :treaty_id
712
+ t.string :name
713
+ end
714
+ create_table :countries_treaties, :force => true, :id => false do |t|
715
+ t.string :country_id, :null => false
716
+ t.string :treaty_id, :null => false
717
+ end
718
+
719
+ create_table :liquid, :force => true do |t|
720
+ t.string :name
721
+ end
722
+ create_table :molecules, :force => true do |t|
723
+ t.integer :liquid_id
724
+ t.string :name
725
+ end
726
+ create_table :electrons, :force => true do |t|
727
+ t.integer :molecule_id
728
+ t.string :name
729
+ end
730
+ create_table :weirds, :force => true do |t|
731
+ t.string 'a$b'
732
+ end
733
+
734
+ except 'SQLite' do
735
+ # fk_test_has_fk should be before fk_test_has_pk
736
+ create_table :fk_test_has_fk, :force => true do |t|
737
+ t.integer :fk_id, :null => false
738
+ end
739
+
740
+ create_table :fk_test_has_pk, :force => true do |t|
741
+ end
742
+
743
+ 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'})"
744
+
745
+ execute "ALTER TABLE lessons_students ADD CONSTRAINT student_id_fk FOREIGN KEY (#{quote_column_name 'student_id'}) REFERENCES #{quote_table_name 'students'} (#{quote_column_name 'id'})"
746
+ end
747
+ end
748
+
749
+ Course.connection.create_table :courses, :force => true do |t|
750
+ t.column :name, :string, :null => false
751
+ end