db2 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/CHANGES +17 -0
  2. data/README +79 -141
  3. data/ext/Makefile.nt32 +3 -3
  4. data/ext/Makefile.nt32.191 +212 -0
  5. data/ext/extconf.rb +75 -14
  6. data/ext/ibm_db.c +504 -47
  7. data/ext/ruby_ibm_db.h +4 -1
  8. data/ext/ruby_ibm_db_cli.c +108 -1
  9. data/ext/ruby_ibm_db_cli.h +54 -1
  10. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +423 -124
  11. data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1 -1
  12. data/test/cases/adapter_test.rb +169 -164
  13. data/test/cases/associations/belongs_to_associations_test.rb +268 -43
  14. data/test/cases/associations/cascaded_eager_loading_test.rb +31 -33
  15. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +90 -156
  16. data/test/cases/associations/join_model_test.rb +100 -150
  17. data/test/cases/attribute_methods_test.rb +259 -58
  18. data/test/cases/base_test.rb +785 -138
  19. data/test/cases/calculations_test.rb +128 -8
  20. data/test/cases/migration_test.rb +680 -286
  21. data/test/cases/persistence_test.rb +642 -0
  22. data/test/cases/query_cache_test.rb +257 -0
  23. data/test/cases/relations_test.rb +1182 -0
  24. data/test/cases/schema_dumper_test.rb +41 -17
  25. data/test/cases/transaction_callbacks_test.rb +300 -0
  26. data/test/cases/validations/uniqueness_validation_test.rb +38 -22
  27. data/test/cases/xml_serialization_test.rb +408 -0
  28. data/test/config.yml +154 -0
  29. data/test/connections/native_ibm_db/connection.rb +2 -0
  30. data/test/models/warehouse_thing.rb +4 -4
  31. data/test/schema/i5/ibm_db_specific_schema.rb +3 -1
  32. data/test/schema/ids/ibm_db_specific_schema.rb +3 -1
  33. data/test/schema/luw/ibm_db_specific_schema.rb +2 -0
  34. data/test/schema/schema.rb +196 -92
  35. data/test/schema/zOS/ibm_db_specific_schema.rb +3 -1
  36. metadata +73 -68
  37. data/.gitignore +0 -1
  38. data/test/cases/associations/eager_test.rb +0 -862
  39. data/test/cases/associations/has_many_through_associations_test.rb +0 -461
  40. data/test/cases/finder_test.rb +0 -1088
  41. data/test/cases/fixtures_test.rb +0 -684
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  print "Using native IBM_DB\n"
2
3
  require_dependency 'models/course'
3
4
  require 'logger'
@@ -40,3 +41,4 @@ ActiveRecord::Base.configurations = {
40
41
 
41
42
  ActiveRecord::Base.establish_connection 'arunit'
42
43
  Course.establish_connection 'arunit2'
44
+ =end
@@ -1,5 +1,5 @@
1
- class WarehouseThing < ActiveRecord::Base
2
- set_table_name "warehouse_things"
3
-
4
- validates_uniqueness_of :value
1
+ class WarehouseThing < ActiveRecord::Base
2
+ set_table_name "warehouse_things"
3
+
4
+ validates_uniqueness_of :value
5
5
  end
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  ActiveRecord::Schema.define do
2
3
 
3
4
  execute "DROP TABLE COMMENTS" rescue nil
@@ -132,4 +133,5 @@ execute <<_SQL
132
133
  );
133
134
  _SQL
134
135
 
135
- end
136
+ end
137
+ =end
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  ActiveRecord::Schema.define do
2
3
 
3
4
  execute "DROP TABLE COMMENTS" rescue nil
@@ -135,4 +136,5 @@ execute <<_SQL
135
136
 
136
137
  _SQL
137
138
 
138
- end
139
+ end
140
+ =end
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  ActiveRecord::Schema.define do
2
3
 
3
4
  execute "DROP TABLE COMMENTS" rescue nil
@@ -133,3 +134,4 @@ execute <<_SQL
133
134
  _SQL
134
135
 
135
136
  end
137
+ =end
@@ -18,8 +18,13 @@ ActiveRecord::Schema.define do
18
18
  end
19
19
 
20
20
 
21
- # Please keep these create table statements in alphabetical order
22
- # unless the ordering matters. In which case, define them below
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
+
23
28
  create_table :accounts, :force => true do |t|
24
29
  t.integer :firm_id
25
30
  t.string :firm_name
@@ -32,18 +37,26 @@ ActiveRecord::Schema.define do
32
37
 
33
38
  create_table :admin_users, :force => true do |t|
34
39
  t.string :name
40
+ t.text :settings
35
41
  t.references :account
36
42
  end
37
43
 
44
+ create_table :aircraft, :force => true do |t|
45
+ t.string :name
46
+ end
47
+
38
48
  create_table :audit_logs, :force => true do |t|
39
49
  t.column :message, :string, :null=>false
40
50
  t.column :developer_id, :integer, :null=>false
51
+ t.integer :unvalidated_developer_id
41
52
  end
42
53
 
43
54
  create_table :authors, :force => true do |t|
44
55
  t.string :name, :null => false
45
56
  t.integer :author_address_id
46
57
  t.integer :author_address_extra_id
58
+ t.string :organization_id
59
+ t.string :owned_essay_id
47
60
  end
48
61
 
49
62
  create_table :author_addresses, :force => true do |t|
@@ -54,13 +67,13 @@ ActiveRecord::Schema.define do
54
67
  t.column :favorite_author_id, :integer
55
68
  end
56
69
 
57
-
58
70
  create_table :auto_id_tests, :force => true, :id => false do |t|
59
71
  t.primary_key :auto_id
60
72
  t.integer :value
61
73
  end
62
74
 
63
75
  create_table :binaries, :force => true do |t|
76
+ t.string :name
64
77
  t.binary :data
65
78
  end
66
79
 
@@ -71,6 +84,7 @@ ActiveRecord::Schema.define do
71
84
  end
72
85
 
73
86
  create_table :books, :force => true do |t|
87
+ t.integer :author_id
74
88
  t.column :name, :string
75
89
  end
76
90
 
@@ -78,7 +92,14 @@ ActiveRecord::Schema.define do
78
92
  t.boolean :value
79
93
  end
80
94
 
81
- create_table :camelcase, :force => true do |t|
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|
82
103
  t.string :name
83
104
  end
84
105
 
@@ -101,8 +122,10 @@ ActiveRecord::Schema.define do
101
122
 
102
123
  create_table :categorizations, :force => true do |t|
103
124
  t.column :category_id, :integer
125
+ t.string :named_category_name
104
126
  t.column :post_id, :integer
105
127
  t.column :author_id, :integer
128
+ t.column :special, :boolean
106
129
  end
107
130
 
108
131
  create_table :citations, :force => true do |t|
@@ -112,6 +135,7 @@ ActiveRecord::Schema.define do
112
135
 
113
136
  create_table :clubs, :force => true do |t|
114
137
  t.string :name
138
+ t.integer :category_id
115
139
  end
116
140
 
117
141
  create_table :collections, :force => true do |t|
@@ -122,13 +146,20 @@ ActiveRecord::Schema.define do
122
146
  t.integer :references, :null => false
123
147
  end
124
148
 
125
- except 'IBM_DB' do
126
- create_table :comments, :force => true do |t|
127
- t.integer :post_id, :null => false
128
- t.text :body, :null => false
129
- t.string :type
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
130
157
  end
131
- 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
132
163
 
133
164
  create_table :companies, :force => true do |t|
134
165
  t.string :type
@@ -138,6 +169,7 @@ ActiveRecord::Schema.define do
138
169
  t.string :name
139
170
  t.integer :client_of
140
171
  t.integer :rating, :default => 1
172
+ t.integer :account_id
141
173
  end
142
174
 
143
175
  add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
@@ -180,6 +212,16 @@ ActiveRecord::Schema.define do
180
212
  t.integer :access_level, :default => 1
181
213
  end
182
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
+
183
225
  create_table :edges, :force => true, :id => false do |t|
184
226
  t.column :source_id, :integer, :null => false
185
227
  t.column :sink_id, :integer, :null => false
@@ -190,15 +232,6 @@ ActiveRecord::Schema.define do
190
232
  t.integer :car_id
191
233
  end
192
234
 
193
- create_table :tyres, :force => true do |t|
194
- t.integer :car_id
195
- end
196
-
197
- create_table :bulbs, :force => true do |t|
198
- t.integer :car_id
199
- t.string :name
200
- end
201
-
202
235
  create_table :entrants, :force => true do |t|
203
236
  t.string :name, :null => false
204
237
  t.integer :course_id, :null => false
@@ -208,30 +241,32 @@ ActiveRecord::Schema.define do
208
241
  t.string :name
209
242
  t.string :writer_id
210
243
  t.string :writer_type
244
+ t.string :category_id
245
+ t.string :author_id
211
246
  end
212
247
 
213
248
  create_table :events, :force => true do |t|
214
249
  t.string :title, :limit => 5
215
250
  end
216
251
 
252
+ create_table :eyes, :force => true do |t|
253
+ end
254
+
217
255
  create_table :funny_jokes, :force => true do |t|
218
256
  t.string :name
219
257
  end
220
258
 
259
+ create_table :cold_jokes, :force => true do |t|
260
+ t.string :name
261
+ end
262
+
221
263
  create_table :goofy_string_id, :force => true, :id => false do |t|
222
264
  t.string :id, :null => false
223
265
  t.string :info
224
266
  end
225
267
 
226
- create_table :invoices, :force => true do |t|
227
- t.integer :balance
228
- t.datetime :updated_at
229
- end
230
-
231
- except 'IBM_DB' do
232
- create_table :items, :force => true do |t|
233
- t.column :name, :string
234
- end
268
+ create_table :guids, :force => true do |t|
269
+ t.column :key, :string
235
270
  end
236
271
 
237
272
  create_table :inept_wizards, :force => true do |t|
@@ -240,6 +275,26 @@ ActiveRecord::Schema.define do
240
275
  t.column :type, :string
241
276
  end
242
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
243
298
 
244
299
  create_table :jobs, :force => true do |t|
245
300
  t.integer :ideal_reference_id
@@ -255,6 +310,17 @@ ActiveRecord::Schema.define do
255
310
  t.integer :version, :null => false, :default => 0
256
311
  end
257
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
+
258
324
  create_table :line_items, :force => true do |t|
259
325
  t.integer :invoice_id
260
326
  t.integer :amount
@@ -296,13 +362,6 @@ ActiveRecord::Schema.define do
296
362
  t.string :name
297
363
  end
298
364
 
299
- create_table :references, :force => true do |t|
300
- t.integer :person_id
301
- t.integer :job_id
302
- t.boolean :favourite
303
- t.integer :lock_version, :default => 0
304
- end
305
-
306
365
  create_table :minivans, :force => true, :id => false do |t|
307
366
  t.string :minivan_id
308
367
  t.string :name
@@ -341,10 +400,10 @@ ActiveRecord::Schema.define do
341
400
  t.decimal :my_house_population, :precision => 2, :scale => 0
342
401
  t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
343
402
  t.float :temperature
344
- # Oracle supports precision up to 38
345
- if current_adapter?(:OracleAdapter)
403
+ # Oracle/SQLServer supports precision up to 38
404
+ if current_adapter?(:OracleAdapter,:SQLServerAdapter)
346
405
  t.decimal :atoms_in_universe, :precision => 38, :scale => 0
347
- elsif current_adapter?(:IBM_DBAdapter)
406
+ elsif current_adapter?(:IBM_DBAdapter)
348
407
  t.decimal :atoms_in_universe, :precision => 31, :scale => 0
349
408
  else
350
409
  t.decimal :atoms_in_universe, :precision => 55, :scale => 0
@@ -365,16 +424,15 @@ ActiveRecord::Schema.define do
365
424
  t.string :name
366
425
  t.column :updated_at, :datetime
367
426
  t.column :happy_at, :datetime
427
+ t.string :essay_id
368
428
  end
369
429
 
370
- except 'IBM_DB' do
371
- create_table :paint_colors, :force => true do |t|
372
- t.integer :non_poly_one_id
373
- end
430
+ create_table :paint_colors, :force => true do |t|
431
+ t.integer :non_poly_one_id
432
+ end
374
433
 
375
- create_table :paint_textures, :force => true do |t|
376
- t.integer :non_poly_two_id
377
- end
434
+ create_table :paint_textures, :force => true do |t|
435
+ t.integer :non_poly_two_id
378
436
  end
379
437
 
380
438
  create_table :parrots, :force => true do |t|
@@ -403,30 +461,45 @@ ActiveRecord::Schema.define do
403
461
  t.string :gender, :limit => 1
404
462
  t.references :number1_fan
405
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
406
468
  end
407
469
 
408
470
  create_table :pets, :primary_key => :pet_id ,:force => true do |t|
409
471
  t.string :name
410
472
  t.integer :owner_id, :integer
473
+ t.timestamps
411
474
  end
412
475
 
413
476
  create_table :pirates, :force => true do |t|
414
477
  t.column :catchphrase, :string
415
478
  t.column :parrot_id, :integer
479
+ t.integer :non_validated_parrot_id
416
480
  t.column :created_on, :datetime
417
481
  t.column :updated_on, :datetime
418
482
  end
419
483
 
420
- except 'IBM_DB' do
421
- create_table :posts, :force => true do |t|
422
- t.integer :author_id
423
- t.string :title, :null => false
424
- t.text :body, :null => false
425
- t.string :type
426
- t.integer :comments_count, :default => 0
427
- t.integer :taggings_count, :default => 0
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
428
493
  end
429
- 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
430
503
 
431
504
  create_table :price_estimates, :force => true do |t|
432
505
  t.string :estimate_of_type
@@ -444,12 +517,24 @@ ActiveRecord::Schema.define do
444
517
  t.string :type
445
518
  end
446
519
 
520
+ create_table :ratings, :force => true do |t|
521
+ t.integer :comment_id
522
+ t.integer :value
523
+ end
524
+
447
525
  create_table :readers, :force => true do |t|
448
526
  t.integer :post_id, :null => false
449
527
  t.integer :person_id, :null => false
450
528
  t.boolean :skimmer, :default => false
451
529
  end
452
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
+
453
538
  create_table :shape_expressions, :force => true do |t|
454
539
  t.string :paint_type
455
540
  t.integer :paint_id
@@ -460,6 +545,7 @@ ActiveRecord::Schema.define do
460
545
  create_table :ships, :force => true do |t|
461
546
  t.string :name
462
547
  t.integer :pirate_id
548
+ t.integer :update_only_pirate_id
463
549
  t.datetime :created_at
464
550
  t.datetime :created_on
465
551
  t.datetime :updated_at
@@ -483,6 +569,16 @@ ActiveRecord::Schema.define do
483
569
  t.string :sponsorable_type
484
570
  end
485
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
+
486
582
  create_table :subscribers, :force => true, :id => false do |t|
487
583
  t.string :nick, :null => false
488
584
  t.string :name
@@ -494,43 +590,53 @@ ActiveRecord::Schema.define do
494
590
  t.integer :book_id
495
591
  end
496
592
 
497
- create_table :tasks, :force => true do |t|
498
- t.datetime :starting
499
- t.datetime :ending
593
+ create_table :tags, :force => true do |t|
594
+ t.column :name, :string
595
+ t.column :taggings_count, :integer, :default => 0
500
596
  end
501
597
 
502
- except 'IBM_DB' do
503
- create_table :topics, :force => true do |t|
504
- t.string :title
505
- t.string :author_name
506
- t.string :author_email_address
507
- t.datetime :written_on
508
- t.time :bonus_time
509
- t.date :last_read
510
- t.text :content
511
- t.boolean :approved, :default => true
512
- t.integer :replies_count, :default => 0
513
- t.integer :parent_id
514
- t.string :parent_title
515
- t.string :type
516
- end
517
- end
518
-
519
598
  create_table :taggings, :force => true do |t|
520
599
  t.column :tag_id, :integer
521
600
  t.column :super_tag_id, :integer
522
601
  t.column :taggable_type, :string
523
602
  t.column :taggable_id, :integer
603
+ t.string :comment
524
604
  end
525
605
 
526
- create_table :tags, :force => true do |t|
527
- t.column :name, :string
528
- t.column :taggings_count, :integer, :default => 0
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
529
634
  end
530
635
 
531
636
  create_table :toys, :primary_key => :toy_id ,:force => true do |t|
532
637
  t.string :name
533
638
  t.integer :pet_id, :integer
639
+ t.timestamps
534
640
  end
535
641
 
536
642
  create_table :traffic_lights, :force => true do |t|
@@ -546,6 +652,10 @@ ActiveRecord::Schema.define do
546
652
  t.column :looter_type, :string
547
653
  end
548
654
 
655
+ create_table :tyres, :force => true do |t|
656
+ t.integer :car_id
657
+ end
658
+
549
659
  create_table :variants, :force => true do |t|
550
660
  t.references :product
551
661
  t.string :name
@@ -563,17 +673,6 @@ ActiveRecord::Schema.define do
563
673
  create_table(t, :force => true) { }
564
674
  end
565
675
 
566
- create_table :guids, :force => true do |t|
567
- t.column :key, :string
568
- end
569
-
570
- create_table :integer_limits, :force => true do |t|
571
- t.integer :"c_int_without_limit"
572
- (1..8).each do |i|
573
- t.integer :"c_int_#{i}", :limit => i
574
- end
575
- end
576
-
577
676
  # NOTE - the following 4 tables are used by models that have :inverse_of options on the associations
578
677
  create_table :men, :force => true do |t|
579
678
  t.string :name
@@ -583,7 +682,9 @@ ActiveRecord::Schema.define do
583
682
  t.string :description
584
683
  t.integer :man_id
585
684
  t.integer :polymorphic_man_id
586
- t.string :polymorphic_man_type
685
+ t.string :polymorphic_man_type
686
+ t.integer :horrible_polymorphic_man_id
687
+ t.string :horrible_polymorphic_man_type
587
688
  end
588
689
 
589
690
  create_table :interests, :force => true do |t|
@@ -613,8 +714,6 @@ ActiveRecord::Schema.define do
613
714
  create_table :countries_treaties, :force => true, :id => false do |t|
614
715
  t.string :country_id, :null => false
615
716
  t.string :treaty_id, :null => false
616
- t.datetime :created_at
617
- t.datetime :updated_at
618
717
  end
619
718
 
620
719
  create_table :liquid, :force => true do |t|
@@ -628,8 +727,11 @@ ActiveRecord::Schema.define do
628
727
  t.integer :molecule_id
629
728
  t.string :name
630
729
  end
730
+ create_table :weirds, :force => true do |t|
731
+ t.string 'a$b'
732
+ end
631
733
 
632
- except ['SQLite','IBM_DB'] do
734
+ except 'SQLite' do
633
735
  # fk_test_has_fk should be before fk_test_has_pk
634
736
  create_table :fk_test_has_fk, :force => true do |t|
635
737
  t.integer :fk_id, :null => false
@@ -639,6 +741,8 @@ ActiveRecord::Schema.define do
639
741
  end
640
742
 
641
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'})"
642
746
  end
643
747
  end
644
748