schema.rb 22.8 KB
Newer Older
1 2
# encoding: utf-8

3 4 5 6
ActiveRecord::Schema.define do
  def except(adapter_names_to_exclude)
    unless [adapter_names_to_exclude].flatten.include?(adapter_name)
      yield
7
    end
8
  end
J
Jeremy Kemper 已提交
9

10 11
  #put adapter specific setup here
  case adapter_name
12
  when "PostgreSQL"
13
    enable_extension!('uuid-ossp', ActiveRecord::Base.connection)
14 15 16 17 18 19 20
    create_table :uuid_parents, id: :uuid, force: true do |t|
      t.string :name
    end
    create_table :uuid_children, id: :uuid, force: true do |t|
      t.string :name
      t.uuid :uuid_parent_id
    end
21
  end
J
Jeremy Kemper 已提交
22

23

24 25 26 27 28 29 30
  # ------------------------------------------------------------------- #
  #                                                                     #
  #   Please keep these create table statements in alphabetical order   #
  #   unless the ordering matters.  In which case, define them below.   #
  #                                                                     #
  # ------------------------------------------------------------------- #

31
  create_table :accounts, force: true do |t|
32
    t.integer :firm_id
33
    t.string  :firm_name
34 35
    t.integer :credit_limit
  end
36

37
  create_table :admin_accounts, force: true do |t|
38 39 40
    t.string :name
  end

41
  create_table :admin_users, force: true do |t|
42
    t.string :name
43
    t.string :settings, null: true, limit: 1024
44 45
    # MySQL does not allow default values for blobs. Fake it out with a
    # big varchar below.
46 47 48
    t.string :preferences, null: true, default: '', limit: 1024
    t.string :json_data, null: true, limit: 1024
    t.string :json_data_empty, null: true, default: "", limit: 1024
49
    t.text :params
50 51 52
    t.references :account
  end

53
  create_table :aircraft, force: true do |t|
54 55 56
    t.string :name
  end

57 58 59 60 61 62 63 64
  create_table :articles, force: true do |t|
  end

  create_table :articles_magazines, force: true do |t|
    t.references :article
    t.references :magazine
  end

65 66 67 68 69
  create_table :articles_tags, force: true do |t|
    t.references :article
    t.references :tag
  end

70 71 72
  create_table :audit_logs, force: true do |t|
    t.column :message, :string, null: false
    t.column :developer_id, :integer, null: false
73
    t.integer :unvalidated_developer_id
74
  end
75

76 77
  create_table :authors, force: true do |t|
    t.string :name, null: false
78 79
    t.integer :author_address_id
    t.integer :author_address_extra_id
80 81
    t.string :organization_id
    t.string :owned_essay_id
82
  end
83

84
  create_table :author_addresses, force: true do |t|
85
  end
86

87
  add_foreign_key :authors, :author_addresses
J
Jeremy Kemper 已提交
88

89
  create_table :author_favorites, force: true do |t|
90 91 92
    t.column :author_id, :integer
    t.column :favorite_author_id, :integer
  end
J
Jeremy Kemper 已提交
93

94
  create_table :auto_id_tests, force: true, id: false do |t|
95 96 97
    t.primary_key :auto_id
    t.integer     :value
  end
J
Jeremy Kemper 已提交
98

99
  create_table :binaries, force: true do |t|
100
    t.string :name
101
    t.binary :data
102
    t.binary :short_data, limit: 2048
103
  end
J
Jeremy Kemper 已提交
104

105
  create_table :birds, force: true do |t|
106
    t.string :name
107
    t.string :color
108 109 110
    t.integer :pirate_id
  end

111
  create_table :books, force: true do |t|
112
    t.integer :author_id
113
    t.string :format
114
    t.column :name, :string
115
    t.column :status, :integer, default: 0
Y
Yury Korolev 已提交
116
    t.column :read_status, :integer, default: 0
117
    t.column :nullable_status, :integer
118
  end
J
Jeremy Kemper 已提交
119

120
  create_table :booleans, force: true do |t|
121
    t.boolean :value
122
    t.boolean :has_fun, null: false, default: false
123
  end
J
Jeremy Kemper 已提交
124

125
  create_table :bulbs, force: true do |t|
126 127
    t.integer :car_id
    t.string  :name
128
    t.boolean :frickinawesome
129
    t.string :color
130 131
  end

132
  create_table "CamelCase", force: true do |t|
133 134 135
    t.string :name
  end

136
  create_table :cars, force: true do |t|
137 138 139
    t.string  :name
    t.integer :engines_count
    t.integer :wheels_count
140
    t.column :lock_version, :integer, null: false, default: 0
141
    t.timestamps null: false
142 143
  end

144 145
  create_table :categories, force: true do |t|
    t.string :name, null: false
146
    t.string :type
147
    t.integer :categorizations_count
148
  end
J
Jeremy Kemper 已提交
149

150 151 152
  create_table :categories_posts, force: true, id: false do |t|
    t.integer :category_id, null: false
    t.integer :post_id, null: false
153
  end
154

155
  create_table :categorizations, force: true do |t|
156
    t.column :category_id, :integer
157
    t.string :named_category_name
158 159
    t.column :post_id, :integer
    t.column :author_id, :integer
160
    t.column :special, :boolean
161
  end
J
Jeremy Kemper 已提交
162

163
  create_table :citations, force: true do |t|
164 165 166
    t.column :book1_id, :integer
    t.column :book2_id, :integer
  end
167

168
  create_table :clubs, force: true do |t|
169
    t.string :name
170
    t.integer :category_id
171
  end
J
Jeremy Kemper 已提交
172

173
  create_table :collections, force: true do |t|
174 175 176
    t.string :name
  end

177 178
  create_table :colnametests, force: true do |t|
    t.integer :references, null: false
179
  end
J
Jeremy Kemper 已提交
180

181 182 183 184
  create_table :columns, force: true do |t|
    t.references :record
  end

185 186
  create_table :comments, force: true do |t|
    t.integer :post_id, null: false
187 188 189
    # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
    # Oracle SELECT WHERE clause which causes many unit test failures
    if current_adapter?(:OracleAdapter)
190
      t.string  :body, null: false, limit: 4000
191
    else
192
      t.text    :body, null: false
193
    end
194
    t.string  :type
195
    t.integer :tags_count, default: 0
196
    t.integer :children_count, default: 0
197
    t.integer :parent_id
198 199 200
    t.references :author, polymorphic: true
    t.string :resource_id
    t.string :resource_type
201
    t.integer :developer_id
202
  end
203

204
  create_table :companies, force: true do |t|
205 206
    t.string  :type
    t.integer :firm_id
207
    t.string  :firm_name
208 209
    t.string  :name
    t.integer :client_of
210
    t.integer :rating, default: 1
211
    t.integer :account_id
212
    t.string :description, default: ""
213
  end
214

215 216 217
  add_index :companies, [:firm_id, :type, :rating], name: "company_index"
  add_index :companies, [:firm_id, :type], name: "company_partial_index", where: "rating > 10"
  add_index :companies, :name, name: 'company_name_index', using: :btree
218

219
  create_table :vegetables, force: true do |t|
220
    t.string :name
221
    t.integer :seller_id
222 223 224
    t.string :custom_type
  end

225
  create_table :computers, force: true do |t|
226
    t.string :system
227 228
    t.integer :developer, null: false
    t.integer :extendedWarranty, null: false
229
  end
230

231
  create_table :contracts, force: true do |t|
232 233 234
    t.integer :developer_id
    t.integer :company_id
  end
235

236
  create_table :customers, force: true do |t|
237
    t.string  :name
238
    t.integer :balance, default: 0
239 240 241 242 243
    t.string  :address_street
    t.string  :address_city
    t.string  :address_country
    t.string  :gps_location
  end
244

245
  create_table :dashboards, force: true, id: false do |t|
246 247 248
    t.string :dashboard_id
    t.string :name
  end
249

250
  create_table :developers, force: true do |t|
251
    t.string   :name
252
    t.integer  :salary, default: 70000
253 254
    t.datetime :created_at
    t.datetime :updated_at
255 256
    t.datetime :created_on
    t.datetime :updated_on
257
  end
258

259 260 261
  create_table :developers_projects, force: true, id: false do |t|
    t.integer :developer_id, null: false
    t.integer :project_id, null: false
262
    t.date    :joined_on
263
    t.integer :access_level, default: 1
264
  end
265

266 267 268 269
  create_table :dog_lovers, force: true do |t|
    t.integer :trained_dogs_count, default: 0
    t.integer :bred_dogs_count, default: 0
    t.integer :dogs_count, default: 0
270 271
  end

272
  create_table :dogs, force: true do |t|
273 274
    t.integer :trainer_id
    t.integer :breeder_id
275
    t.integer :dog_lover_id
276
    t.string  :alias
277 278
  end

279 280 281
  create_table :edges, force: true, id: false do |t|
    t.column :source_id, :integer, null: false
    t.column :sink_id,   :integer, null: false
282
  end
283
  add_index :edges, [:source_id, :sink_id], unique: true, name: 'unique_edge_index'
284

285
  create_table :engines, force: true do |t|
286 287
    t.integer :car_id
  end
288

289 290 291
  create_table :entrants, force: true do |t|
    t.string  :name, null: false
    t.integer :course_id, null: false
292
  end
293

294
  create_table :essays, force: true do |t|
295 296 297
    t.string :name
    t.string :writer_id
    t.string :writer_type
298 299
    t.string :category_id
    t.string :author_id
300 301
  end

302 303
  create_table :events, force: true do |t|
    t.string :title, limit: 5
304 305
  end

306
  create_table :eyes, force: true do |t|
307 308
  end

309
  create_table :funny_jokes, force: true do |t|
310
    t.string :name
311 312
  end

313
  create_table :cold_jokes, force: true do |t|
S
💣  
Sean Griffin 已提交
314
    t.string :cold_name
315 316
  end

317
  create_table :friendships, force: true do |t|
318
    t.integer :friend_id
319
    t.integer :follower_id
320 321
  end

322 323
  create_table :goofy_string_id, force: true, id: false do |t|
    t.string :id, null: false
324 325 326
    t.string :info
  end

327
  create_table :having, force: true do |t|
328 329 330
    t.string :where
  end

331
  create_table :guids, force: true do |t|
332
    t.column :key, :string
333 334
  end

335 336 337
  create_table :inept_wizards, force: true do |t|
    t.column :name, :string, null: false
    t.column :city, :string, null: false
338
    t.column :type, :string
339 340
  end

341
  create_table :integer_limits, force: true do |t|
342 343
    t.integer :"c_int_without_limit"
    (1..8).each do |i|
344
      t.integer :"c_int_#{i}", limit: i
345 346 347
    end
  end

348
  create_table :invoices, force: true do |t|
349 350 351 352
    t.integer :balance
    t.datetime :updated_at
  end

353
  create_table :iris, force: true do |t|
354 355 356 357
    t.references :eye
    t.string     :color
  end

358
  create_table :items, force: true do |t|
359 360
    t.column :name, :string
  end
361

362
  create_table :jobs, force: true do |t|
363 364 365
    t.integer :ideal_reference_id
  end

P
Pablo Torres 已提交
366
  create_table :keyboards, force: true, id: false do |t|
367 368
    t.primary_key :key_number
    t.string      :name
369 370
  end

371
  create_table :legacy_things, force: true do |t|
372
    t.integer :tps_report_number
373
    t.integer :version, null: false, default: 0
374 375
  end

376
  create_table :lessons, force: true do |t|
377 378 379
    t.string :name
  end

380
  create_table :lessons_students, id: false, force: true do |t|
381 382 383 384
    t.references :lesson
    t.references :student
  end

385
  create_table :lint_models, force: true
386

387
  create_table :line_items, force: true do |t|
388 389 390 391
    t.integer :invoice_id
    t.integer :amount
  end

392
  create_table :lock_without_defaults, force: true do |t|
393 394
    t.column :lock_version, :integer
  end
395

396
  create_table :lock_without_defaults_cust, force: true do |t|
397
    t.column :custom_lock_version, :integer
398
  end
399

400 401 402
  create_table :magazines, force: true do |t|
  end

403
  create_table :mateys, id: false, force: true do |t|
404 405 406
    t.column :pirate_id, :integer
    t.column :target_id, :integer
    t.column :weight, :integer
407
  end
J
Jeremy Kemper 已提交
408

409
  create_table :members, force: true do |t|
410
    t.string :name
411
    t.integer :member_type_id
J
Jeremy Kemper 已提交
412 413
  end

414
  create_table :member_details, force: true do |t|
415 416 417 418 419
    t.integer :member_id
    t.integer :organization_id
    t.string :extra_data
  end

420
  create_table :member_friends, force: true, id: false do |t|
421 422 423 424
    t.integer :member_id
    t.integer :friend_id
  end

425
  create_table :memberships, force: true do |t|
426 427
    t.datetime :joined_on
    t.integer :club_id, :member_id
428
    t.boolean :favourite, default: false
429
    t.string :type
J
Jeremy Kemper 已提交
430
  end
431

432
  create_table :member_types, force: true do |t|
433 434 435
    t.string :name
  end

436
  create_table :minivans, force: true, id: false do |t|
437 438 439
    t.string :minivan_id
    t.string :name
    t.string :speedometer_id
440
    t.string :color
441
  end
442

443
  create_table :minimalistics, force: true do |t|
444
  end
J
Jeremy Kemper 已提交
445

446
  create_table :mixed_case_monkeys, force: true, id: false do |t|
447 448
    t.primary_key :monkeyID
    t.integer     :fleaCount
449
  end
J
Jeremy Kemper 已提交
450

451
  create_table :mixins, force: true do |t|
452 453 454 455 456 457 458 459
    t.integer  :parent_id
    t.integer  :pos
    t.datetime :created_at
    t.datetime :updated_at
    t.integer  :lft
    t.integer  :rgt
    t.integer  :root_id
    t.string   :type
460
  end
461

462
  create_table :movies, force: true, id: false do |t|
463 464
    t.primary_key :movieid
    t.string      :name
465
  end
J
Jeremy Kemper 已提交
466

467 468 469 470 471 472
  create_table :numeric_data, force: true do |t|
    t.decimal :bank_balance, precision: 10, scale: 2
    t.decimal :big_bank_balance, precision: 15, scale: 2
    t.decimal :world_population, precision: 10, scale: 0
    t.decimal :my_house_population, precision: 2, scale: 0
    t.decimal :decimal_number_with_default, precision: 3, scale: 2, default: 2.78
473
    t.float   :temperature
474
    # Oracle/SQLServer supports precision up to 38
475
    if current_adapter?(:OracleAdapter, :SQLServerAdapter)
476
      t.decimal :atoms_in_universe, precision: 38, scale: 0
477
    else
478
      t.decimal :atoms_in_universe, precision: 55, scale: 0
479
    end
480
  end
481

482
  create_table :orders, force: true do |t|
483 484 485
    t.string  :name
    t.integer :billing_customer_id
    t.integer :shipping_customer_id
486
  end
487

488
  create_table :organizations, force: true do |t|
489 490 491
    t.string :name
  end

492
  create_table :owners, primary_key: :owner_id, force: true do |t|
493
    t.string :name
494 495
    t.column :updated_at, :datetime
    t.column :happy_at,   :datetime
496
    t.string :essay_id
497 498
  end

499
  create_table :paint_colors, force: true do |t|
500
    t.integer :non_poly_one_id
501 502
  end

503
  create_table :paint_textures, force: true do |t|
504
    t.integer :non_poly_two_id
505
  end
506

507
  create_table :parrots, force: true do |t|
508
    t.column :name, :string
509
    t.column :color, :string
510 511
    t.column :parrot_sti_class, :string
    t.column :killer_id, :integer
512 513 514 515 516 517
    t.column :created_at, :datetime
    t.column :created_on, :datetime
    t.column :updated_at, :datetime
    t.column :updated_on, :datetime
  end

518
  create_table :parrots_pirates, id: false, force: true do |t|
519 520 521 522
    t.column :parrot_id, :integer
    t.column :pirate_id, :integer
  end

523
  create_table :parrots_treasures, id: false, force: true do |t|
524 525 526
    t.column :parrot_id, :integer
    t.column :treasure_id, :integer
  end
527

528 529
  create_table :people, force: true do |t|
    t.string     :first_name, null: false
530
    t.references :primary_contact
531
    t.string     :gender, limit: 1
532
    t.references :number1_fan
533
    t.integer    :lock_version, null: false, default: 0
534
    t.string     :comments
535 536
    t.integer    :followers_count, default: 0
    t.integer    :friends_too_count, default: 0
537 538
    t.references :best_friend
    t.references :best_friend_of
539
    t.integer    :insures, null: false, default: 0
540
    t.timestamp :born_at
541
    t.timestamps null: false
542
  end
J
Jon Leighton 已提交
543

544
  create_table :peoples_treasures, id: false, force: true do |t|
545 546 547
    t.column :rich_person_id, :integer
    t.column :treasure_id, :integer
  end
548

549 550 551 552 553 554
  create_table :personal_legacy_things, force: true do |t|
    t.integer :tps_report_number
    t.integer :person_id
    t.integer :version, null: false, default: 0
  end

555
  create_table :pets, primary_key: :pet_id, force: true do |t|
556
    t.string :name
557
    t.integer :owner_id, :integer
558
    t.timestamps null: false
559
  end
560

561
  create_table :pirates, force: true do |t|
562 563
    t.column :catchphrase, :string
    t.column :parrot_id, :integer
564
    t.integer :non_validated_parrot_id
565 566
    t.column :created_on, :datetime
    t.column :updated_on, :datetime
567
  end
568

569
  create_table :posts, force: true do |t|
570
    t.integer :author_id
571
    t.string  :title, null: false
572 573 574
    # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
    # Oracle SELECT WHERE clause which causes many unit test failures
    if current_adapter?(:OracleAdapter)
575
      t.string  :body, null: false, limit: 4000
576
    else
577
      t.text    :body, null: false
578
    end
579
    t.string  :type
580 581 582 583 584 585
    t.integer :comments_count, default: 0
    t.integer :taggings_with_delete_all_count, default: 0
    t.integer :taggings_with_destroy_count, default: 0
    t.integer :tags_count, default: 0
    t.integer :tags_with_destroy_count, default: 0
    t.integer :tags_with_nullify_count, default: 0
586
  end
587

588 589 590 591 592
  create_table :serialized_posts, force: true do |t|
    t.integer :author_id
    t.string :title, null: false
  end

593
  create_table :price_estimates, force: true do |t|
594 595 596 597
    t.string :estimate_of_type
    t.integer :estimate_of_id
    t.integer :price
  end
598

599
  create_table :products, force: true do |t|
600
    t.references :collection
601
    t.references :type
602 603 604
    t.string     :name
  end

605 606 607 608
  create_table :product_types, force: true do |t|
    t.string :name
  end

609
  create_table :projects, force: true do |t|
610 611 612 613
    t.string :name
    t.string :type
  end

614
  create_table :randomly_named_table, force: true do |t|
615 616 617 618
    t.string  :some_attribute
    t.integer :another_attribute
  end

619
  create_table :ratings, force: true do |t|
620 621 622 623
    t.integer :comment_id
    t.integer :value
  end

624 625 626 627
  create_table :readers, force: true do |t|
    t.integer :post_id, null: false
    t.integer :person_id, null: false
    t.boolean :skimmer, default: false
628
    t.integer :first_post_id
629 630
  end

631
  create_table :references, force: true do |t|
632 633 634
    t.integer :person_id
    t.integer :job_id
    t.boolean :favourite
635
    t.integer :lock_version, default: 0
636 637
  end

638
  create_table :shape_expressions, force: true do |t|
639 640 641 642 643
    t.string  :paint_type
    t.integer :paint_id
    t.string  :shape_type
    t.integer :shape_id
  end
644

645
  create_table :ships, force: true do |t|
646
    t.string :name
647
    t.integer :pirate_id
648
    t.integer :update_only_pirate_id
649 650 651 652
    t.datetime :created_at
    t.datetime :created_on
    t.datetime :updated_at
    t.datetime :updated_on
653
  end
654

655
  create_table :ship_parts, force: true do |t|
656 657 658
    t.string :name
    t.integer :ship_id
  end
659

660
  create_table :speedometers, force: true, id: false do |t|
661 662 663 664
    t.string :speedometer_id
    t.string :name
    t.string :dashboard_id
  end
665

666
  create_table :sponsors, force: true do |t|
667 668
    t.integer :club_id
    t.integer :sponsorable_id
669
    t.string :sponsorable_type
670
  end
671

672
  create_table :string_key_objects, id: false, primary_key: :id, force: true do |t|
673 674
    t.string     :id
    t.string     :name
675
    t.integer    :lock_version, null: false, default: 0
676 677
  end

678
  create_table :students, force: true do |t|
679
    t.string :name
680 681
    t.boolean :active
    t.integer :college_id
682 683
  end

684 685
  create_table :subscribers, force: true, id: false do |t|
    t.string :nick, null: false
686
    t.string :name
687
    t.column :books_count, :integer, null: false, default: 0
688
  end
689
  add_index :subscribers, :nick, unique: true
690

691
  create_table :subscriptions, force: true do |t|
692 693 694 695
    t.string :subscriber_id
    t.integer :book_id
  end

696
  create_table :tags, force: true do |t|
697
    t.column :name, :string
698
    t.column :taggings_count, :integer, default: 0
699 700
  end

701
  create_table :taggings, force: true do |t|
702 703 704 705
    t.column :tag_id, :integer
    t.column :super_tag_id, :integer
    t.column :taggable_type, :string
    t.column :taggable_id, :integer
706
    t.string :comment
707 708
  end

709
  create_table :tasks, force: true do |t|
710 711
    t.datetime :starting
    t.datetime :ending
712 713
  end

714
  create_table :topics, force: true do |t|
715
    t.string   :title, limit: 250
716 717
    t.string   :author_name
    t.string   :author_email_address
A
Arthur Neves 已提交
718 719 720 721 722
    if mysql_56?
      t.datetime :written_on, limit: 6
    else
      t.datetime :written_on
    end
723 724
    t.time     :bonus_time
    t.date     :last_read
725 726 727
    # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
    # Oracle SELECT WHERE clause which causes many unit test failures
    if current_adapter?(:OracleAdapter)
728 729
      t.string   :content, limit: 4000
      t.string   :important, limit: 4000
730 731
    else
      t.text     :content
A
Alvaro Bautista 已提交
732
      t.text     :important
733
    end
734 735 736
    t.boolean  :approved, default: true
    t.integer  :replies_count, default: 0
    t.integer  :unique_replies_count, default: 0
737
    t.integer  :parent_id
738
    t.string   :parent_title
739
    t.string   :type
740
    t.string   :group
741
    t.timestamps null: true
742 743
  end

744
  create_table :toys, primary_key: :toy_id, force: true do |t|
745 746
    t.string :name
    t.integer :pet_id, :integer
747
    t.timestamps null: false
748 749
  end

750
  create_table :traffic_lights, force: true do |t|
751 752
    t.string   :location
    t.string   :state
753
    t.text     :long_state, null: false
754 755 756 757
    t.datetime :created_at
    t.datetime :updated_at
  end

758
  create_table :treasures, force: true do |t|
759
    t.column :name, :string
760
    t.column :type, :string
761 762 763 764
    t.column :looter_id, :integer
    t.column :looter_type, :string
  end

765
  create_table :tyres, force: true do |t|
766 767 768
    t.integer :car_id
  end

769
  create_table :variants, force: true do |t|
770 771 772 773
    t.references :product
    t.string     :name
  end

774
  create_table :vertices, force: true do |t|
775 776 777
    t.column :label, :string
  end

778
  create_table 'warehouse-things', force: true do |t|
779 780 781 782
    t.integer :value
  end

  [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
783
    create_table(t, force: true) { }
784 785
  end

786
  # NOTE - the following 4 tables are used by models that have :inverse_of options on the associations
787
  create_table :men, force: true do |t|
788 789 790
    t.string  :name
  end

791
  create_table :faces, force: true do |t|
792 793
    t.string  :description
    t.integer :man_id
794
    t.integer :polymorphic_man_id
795
    t.string  :polymorphic_man_type
796 797
    t.integer :poly_man_without_inverse_id
    t.string  :poly_man_without_inverse_type
798 799
    t.integer :horrible_polymorphic_man_id
    t.string  :horrible_polymorphic_man_type
800 801
  end

802
  create_table :interests, force: true do |t|
803 804
    t.string :topic
    t.integer :man_id
805 806
    t.integer :polymorphic_man_id
    t.string :polymorphic_man_type
807 808 809
    t.integer :zine_id
  end

810 811
  create_table :wheels, force: true do |t|
    t.references :wheelable, polymorphic: true
812 813
  end

814
  create_table :zines, force: true do |t|
815 816 817
    t.string :title
  end

818
  create_table :countries, force: true, id: false, primary_key: 'country_id' do |t|
819 820 821
    t.string :country_id
    t.string :name
  end
822
  create_table :treaties, force: true, id: false, primary_key: 'treaty_id' do |t|
823 824 825
    t.string :treaty_id
    t.string :name
  end
826 827 828
  create_table :countries_treaties, force: true, id: false do |t|
    t.string :country_id, null: false
    t.string :treaty_id, null: false
829 830
  end

831
  create_table :liquid, force: true do |t|
832 833
    t.string :name
  end
834
  create_table :molecules, force: true do |t|
835 836 837
    t.integer :liquid_id
    t.string :name
  end
838
  create_table :electrons, force: true do |t|
839 840 841
    t.integer :molecule_id
    t.string :name
  end
842
  create_table :weirds, force: true do |t|
843
    t.string 'a$b'
A
Aaron Patterson 已提交
844
    t.string 'なまえ'
845
    t.string 'from'
846
  end
847

848 849 850 851 852 853 854 855 856 857 858 859 860 861 862
  create_table :hotels, force: true do |t|
  end
  create_table :departments, force: true do |t|
    t.integer :hotel_id
  end
  create_table :cake_designers, force: true do |t|
  end
  create_table :drink_designers, force: true do |t|
  end
  create_table :chefs, force: true do |t|
    t.integer :employable_id
    t.string :employable_type
    t.integer :department_id
  end

863 864
  create_table :records, force: true do |t|
  end
865

866 867
  except 'SQLite' do
    # fk_test_has_fk should be before fk_test_has_pk
868 869
    create_table :fk_test_has_fk, force: true do |t|
      t.integer :fk_id, null: false
870 871
    end

Y
Yves Senn 已提交
872
    create_table :fk_test_has_pk, force: true, primary_key: "pk_id" do |t|
873 874
    end

Y
Yves Senn 已提交
875 876
    add_foreign_key :fk_test_has_fk, :fk_test_has_pk, column: "fk_id", name: "fk_name", primary_key: "pk_id"
    add_foreign_key :lessons_students, :students
877
  end
878 879 880 881 882

  create_table :overloaded_types, force: true do |t|
    t.float :overloaded_float, default: 500
    t.float :unoverloaded_float
    t.string :overloaded_string_with_limit, limit: 255
883
    t.string :string_with_default, default: 'the original default'
884
  end
885
end
886

887 888
Course.connection.create_table :courses, force: true do |t|
  t.column :name, :string, null: false
R
Rick Martinez 已提交
889 890 891
  t.column :college_id, :integer
end

892 893
College.connection.create_table :colleges, force: true do |t|
  t.column :name, :string, null: false
894
end