paper_trail 6.0.2 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +20 -0
  3. data/.rubocop.yml +30 -2
  4. data/.rubocop_todo.yml +20 -0
  5. data/.travis.yml +3 -5
  6. data/Appraisals +5 -6
  7. data/CHANGELOG.md +33 -0
  8. data/README.md +43 -81
  9. data/Rakefile +1 -1
  10. data/doc/bug_report_template.rb +4 -2
  11. data/gemfiles/ar_4.0.gemfile +7 -0
  12. data/gemfiles/ar_4.2.gemfile +0 -1
  13. data/lib/generators/paper_trail/templates/create_version_associations.rb +1 -1
  14. data/lib/generators/paper_trail/templates/create_versions.rb +1 -1
  15. data/lib/paper_trail.rb +7 -9
  16. data/lib/paper_trail/config.rb +0 -15
  17. data/lib/paper_trail/frameworks/rspec.rb +8 -2
  18. data/lib/paper_trail/model_config.rb +6 -2
  19. data/lib/paper_trail/record_trail.rb +3 -1
  20. data/lib/paper_trail/reifier.rb +43 -354
  21. data/lib/paper_trail/reifiers/belongs_to.rb +48 -0
  22. data/lib/paper_trail/reifiers/has_and_belongs_to_many.rb +50 -0
  23. data/lib/paper_trail/reifiers/has_many.rb +110 -0
  24. data/lib/paper_trail/reifiers/has_many_through.rb +90 -0
  25. data/lib/paper_trail/reifiers/has_one.rb +76 -0
  26. data/lib/paper_trail/serializers/yaml.rb +2 -25
  27. data/lib/paper_trail/version_concern.rb +5 -5
  28. data/lib/paper_trail/version_number.rb +7 -3
  29. data/paper_trail.gemspec +7 -34
  30. data/spec/controllers/articles_controller_spec.rb +1 -1
  31. data/spec/generators/install_generator_spec.rb +40 -34
  32. data/spec/models/animal_spec.rb +50 -25
  33. data/spec/models/boolit_spec.rb +8 -7
  34. data/spec/models/callback_modifier_spec.rb +13 -13
  35. data/spec/models/document_spec.rb +21 -0
  36. data/spec/models/gadget_spec.rb +35 -39
  37. data/spec/models/joined_version_spec.rb +4 -4
  38. data/spec/models/json_version_spec.rb +14 -15
  39. data/spec/models/not_on_update_spec.rb +1 -1
  40. data/spec/models/post_with_status_spec.rb +2 -2
  41. data/spec/models/skipper_spec.rb +4 -4
  42. data/spec/models/thing_spec.rb +1 -1
  43. data/spec/models/truck_spec.rb +1 -1
  44. data/spec/models/vehicle_spec.rb +1 -1
  45. data/spec/models/version_spec.rb +152 -168
  46. data/spec/models/widget_spec.rb +170 -196
  47. data/spec/modules/paper_trail_spec.rb +3 -3
  48. data/spec/modules/version_concern_spec.rb +5 -8
  49. data/spec/modules/version_number_spec.rb +11 -36
  50. data/spec/paper_trail/cleaner_spec.rb +152 -0
  51. data/spec/paper_trail/config_spec.rb +1 -1
  52. data/spec/paper_trail/serializers/custom_yaml_serializer_spec.rb +45 -0
  53. data/spec/paper_trail/serializers/json_spec.rb +57 -0
  54. data/spec/paper_trail/version_limit_spec.rb +55 -0
  55. data/spec/paper_trail_spec.rb +45 -32
  56. data/spec/requests/articles_spec.rb +4 -4
  57. data/test/dummy/app/models/custom_primary_key_record.rb +4 -2
  58. data/test/dummy/app/models/document.rb +1 -1
  59. data/test/dummy/app/models/not_on_update.rb +1 -1
  60. data/test/dummy/app/models/on/create.rb +6 -0
  61. data/test/dummy/app/models/on/destroy.rb +6 -0
  62. data/test/dummy/app/models/on/empty_array.rb +6 -0
  63. data/test/dummy/app/models/on/update.rb +6 -0
  64. data/test/dummy/app/models/person.rb +1 -0
  65. data/test/dummy/app/models/song.rb +19 -28
  66. data/test/dummy/config/application.rb +10 -43
  67. data/test/dummy/config/routes.rb +1 -1
  68. data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +25 -51
  69. data/test/dummy/db/schema.rb +29 -19
  70. data/test/test_helper.rb +0 -16
  71. data/test/unit/associations_test.rb +81 -81
  72. data/test/unit/model_test.rb +48 -131
  73. data/test/unit/serializer_test.rb +34 -45
  74. data/test/unit/serializers/mixin_json_test.rb +3 -1
  75. data/test/unit/serializers/yaml_test.rb +1 -5
  76. metadata +44 -19
  77. data/lib/paper_trail/frameworks/sinatra.rb +0 -40
  78. data/test/functional/modular_sinatra_test.rb +0 -46
  79. data/test/functional/sinatra_test.rb +0 -51
  80. data/test/unit/cleaner_test.rb +0 -151
  81. data/test/unit/inheritance_column_test.rb +0 -41
  82. data/test/unit/serializers/json_test.rb +0 -95
  83. data/test/unit/serializers/mixin_yaml_test.rb +0 -53
@@ -6,14 +6,14 @@ describe "Articles management", type: :request, order: :defined do
6
6
  context "versioning disabled" do
7
7
  specify { expect(PaperTrail).not_to be_enabled }
8
8
 
9
- it "should not create a version" do
9
+ it "does not create a version" do
10
10
  expect(PaperTrail).to be_enabled_for_controller
11
11
  expect {
12
12
  post articles_path, params_wrapper(valid_params)
13
- }.to_not change(PaperTrail::Version, :count)
13
+ }.not_to change(PaperTrail::Version, :count)
14
14
  end
15
15
 
16
- it "should not leak the state of the `PaperTrail.enabled_for_controller?` into the next test" do
16
+ it "does not leak the state of the `PaperTrail.enabled_for_controller?` into the next test" do
17
17
  expect(PaperTrail).to be_enabled_for_controller
18
18
  end
19
19
  end
@@ -22,7 +22,7 @@ describe "Articles management", type: :request, order: :defined do
22
22
  let(:article) { Article.last }
23
23
 
24
24
  context "`current_user` method returns a `String`" do
25
- it "should set that value as the `whodunnit`" do
25
+ it "sets that value as the `whodunnit`" do
26
26
  expect {
27
27
  post articles_path, params_wrapper(valid_params)
28
28
  }.to change(PaperTrail::Version, :count).by(1)
@@ -1,11 +1,13 @@
1
1
  require "securerandom"
2
+
2
3
  class CustomPrimaryKeyRecord < ActiveRecord::Base
3
4
  self.primary_key = :uuid
4
5
 
5
6
  has_paper_trail class_name: "CustomPrimaryKeyRecordVersion"
6
- # this unusual default_scope is to test the case of the Version#item association
7
+
8
+ # This default_scope is to test the case of the Version#item association
7
9
  # not returning the item due to unmatched default_scope on the model.
8
- default_scope -> { where(name: "custom_primary_key_record") }
10
+ default_scope { where(name: "custom_primary_key_record") }
9
11
 
10
12
  before_create do
11
13
  self.uuid ||= SecureRandom.uuid
@@ -1,6 +1,6 @@
1
1
  class Document < ActiveRecord::Base
2
2
  has_paper_trail(
3
3
  versions: :paper_trail_versions,
4
- on: [:create, :update]
4
+ on: %i(create update)
5
5
  )
6
6
  end
@@ -1,4 +1,4 @@
1
1
  # This model does not record versions when updated.
2
2
  class NotOnUpdate < ActiveRecord::Base
3
- has_paper_trail on: [:create, :destroy]
3
+ has_paper_trail on: %i(create destroy)
4
4
  end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class Create < ActiveRecord::Base
3
+ self.table_name = :on_create
4
+ has_paper_trail on: [:create]
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class Destroy < ActiveRecord::Base
3
+ self.table_name = :on_destroy
4
+ has_paper_trail on: [:destroy]
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class EmptyArray < ActiveRecord::Base
3
+ self.table_name = :on_empty_array
4
+ has_paper_trail on: []
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class Update < ActiveRecord::Base
3
+ self.table_name = :on_update
4
+ has_paper_trail on: [:update]
5
+ end
6
+ end
@@ -1,6 +1,7 @@
1
1
  class Person < ActiveRecord::Base
2
2
  has_many :authorships, foreign_key: :author_id, dependent: :destroy
3
3
  has_many :books, through: :authorships
4
+ belongs_to :mentor, class_name: "Person", foreign_key: :mentor_id
4
5
  has_paper_trail
5
6
 
6
7
  # Convert strings to TimeZone objects when assigned
@@ -1,4 +1,21 @@
1
- # Example from 'Overwriting default accessors' in ActiveRecord::Base.
1
+ module OverrideSongAttributesTheRails4Way
2
+ def attributes
3
+ if name
4
+ super.merge(name: name)
5
+ else
6
+ super
7
+ end
8
+ end
9
+
10
+ def changed_attributes
11
+ if name
12
+ super.merge(name: name)
13
+ else
14
+ super
15
+ end
16
+ end
17
+ end
18
+
2
19
  class Song < ActiveRecord::Base
3
20
  has_paper_trail
4
21
 
@@ -15,32 +32,6 @@ class Song < ActiveRecord::Base
15
32
  attribute :name, :string
16
33
  else
17
34
  attr_accessor :name
18
-
19
- # override attributes hashes like some libraries do
20
- def attributes_with_name
21
- if name
22
- attributes_without_name.merge(name: name)
23
- else
24
- attributes_without_name
25
- end
26
- end
27
-
28
- # `alias_method_chain` is deprecated in rails 5, but we cannot use the
29
- # suggested replacement, `Module#prepend`, because we still support ruby 1.9.
30
- alias attributes_without_name attributes
31
- alias attributes attributes_with_name
32
-
33
- def changed_attributes_with_name
34
- if name
35
- changed_attributes_without_name.merge(name: name)
36
- else
37
- changed_attributes_without_name
38
- end
39
- end
40
-
41
- # `alias_method_chain` is deprecated in rails 5, but we cannot use the
42
- # suggested replacement, `Module#prepend`, because we still support ruby 1.9.
43
- alias changed_attributes_without_name changed_attributes
44
- alias changed_attributes changed_attributes_with_name
35
+ prepend OverrideSongAttributesTheRails4Way
45
36
  end
46
37
  end
@@ -4,54 +4,24 @@ require File.expand_path("../boot", __FILE__)
4
4
  require "active_record/railtie"
5
5
  require "action_controller/railtie"
6
6
 
7
- Bundler.require(:default, Rails.env) if defined?(Bundler)
7
+ Bundler.require(:default, Rails.env)
8
8
  require "paper_trail"
9
9
 
10
10
  module Dummy
11
11
  class Application < Rails::Application
12
- # Settings in config/environments/* take precedence over those specified here.
13
- # Application configuration should go into files in config/initializers
14
- # -- all .rb files in that directory are automatically loaded.
15
-
16
- # Custom directories with classes and modules you want to be autoloadable.
17
- # config.autoload_paths += %W(#{config.root}/extras)
18
-
19
- # Only load the plugins named here, in the order given (default is alphabetical).
20
- # :all can be used as a placeholder for all plugins not explicitly named.
21
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
22
-
23
- # Activate observers that should always be running.
24
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
25
-
26
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
27
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
28
- # config.time_zone = 'Central Time (US & Canada)'
29
-
30
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
- # config.i18n.default_locale = :de
33
-
34
- # Configure the default encoding used in templates for Ruby 1.9.
35
12
  config.encoding = "utf-8"
36
-
37
- # Configure sensitive parameters which will be filtered from the log file.
38
13
  config.filter_parameters += [:password]
39
-
40
- # Enable escaping HTML in JSON.
41
14
  config.active_support.escape_html_entities_in_json = true
15
+ config.active_support.test_order = :sorted
16
+
17
+ # Disable assets in rails 4.2. In rails 5, config does not respond to
18
+ # assets, probably because it was moved out of railties to some other gem,
19
+ # and we only have dev. dependencies on railties, not all of rails. When
20
+ # we drop support for rails 4.2, we can remove this whole conditional.
21
+ if config.respond_to?(:assets)
22
+ config.assets.enabled = false
23
+ end
42
24
 
43
- # Use SQL instead of Active Record's schema dumper when creating the database.
44
- # This is necessary if your schema can't be completely dumped by the schema dumper,
45
- # like if you have constraints or database-specific column types
46
- # config.active_record.schema_format = :sql
47
-
48
- # `config.assets` is a `NoMethodError` in rails 5.
49
- config.assets.enabled = false if config.respond_to?(:assets)
50
-
51
- # Version of your assets, change this if you want to expire all your assets
52
- # config.assets.version = '1.0'
53
-
54
- # Rails 4 key for generating secret key
55
25
  config.secret_key_base = "A fox regularly kicked the screaming pile of biscuits."
56
26
 
57
27
  # `raise_in_transactional_callbacks` was added in rails 4, then deprecated
@@ -65,8 +35,5 @@ module Dummy
65
35
  config.active_record.time_zone_aware_types = [:datetime]
66
36
  end
67
37
  end
68
-
69
- # Set test order for Test::Unit if possible
70
- config.active_support.test_order = :sorted if config.active_support.respond_to?(:test_order=)
71
38
  end
72
39
  end
@@ -1,4 +1,4 @@
1
1
  Dummy::Application.routes.draw do
2
2
  resources :articles, only: [:create]
3
- resources :widgets, only: [:create, :update, :destroy]
3
+ resources :widgets, only: %i(create update destroy)
4
4
  end
@@ -9,6 +9,22 @@ class SetUpTestTables < ActiveRecord::Migration
9
9
  TEXT_BYTES = 1_073_741_823
10
10
 
11
11
  def up
12
+ create_table :on_create, force: true do |t|
13
+ t.string :name, null: false
14
+ end
15
+
16
+ create_table :on_destroy, force: true do |t|
17
+ t.string :name, null: false
18
+ end
19
+
20
+ create_table :on_empty_array, force: true do |t|
21
+ t.string :name, null: false
22
+ end
23
+
24
+ create_table :on_update, force: true do |t|
25
+ t.string :name, null: false
26
+ end
27
+
12
28
  # Classes: Vehicle, Car, Truck
13
29
  create_table :vehicles, force: true do |t|
14
30
  t.string :name, null: false
@@ -57,7 +73,7 @@ class SetUpTestTables < ActiveRecord::Migration
57
73
  t.string :ip
58
74
  t.string :user_agent
59
75
  end
60
- add_index :versions, [:item_type, :item_id]
76
+ add_index :versions, %i(item_type item_id)
61
77
 
62
78
  create_table :version_associations do |t|
63
79
  t.integer :version_id
@@ -66,7 +82,7 @@ class SetUpTestTables < ActiveRecord::Migration
66
82
  end
67
83
  add_index :version_associations, [:version_id]
68
84
  add_index :version_associations,
69
- [:foreign_key_name, :foreign_key_id],
85
+ %i(foreign_key_name foreign_key_id),
70
86
  name: "index_version_associations_on_foreign_key"
71
87
 
72
88
  create_table :post_versions, force: true do |t|
@@ -81,7 +97,7 @@ class SetUpTestTables < ActiveRecord::Migration
81
97
  t.string :ip
82
98
  t.string :user_agent
83
99
  end
84
- add_index :post_versions, [:item_type, :item_id]
100
+ add_index :post_versions, %i(item_type item_id)
85
101
 
86
102
  if ENV["DB"] == "postgres" && ::ActiveRecord::VERSION::MAJOR >= 4
87
103
  create_table :json_versions, force: true do |t|
@@ -93,7 +109,7 @@ class SetUpTestTables < ActiveRecord::Migration
93
109
  t.json :object_changes
94
110
  t.datetime :created_at
95
111
  end
96
- add_index :json_versions, [:item_type, :item_id]
112
+ add_index :json_versions, %i(item_type item_id)
97
113
  end
98
114
 
99
115
  create_table :not_on_updates, force: true do |t|
@@ -112,7 +128,7 @@ class SetUpTestTables < ActiveRecord::Migration
112
128
  t.text :object
113
129
  t.datetime :created_at
114
130
  end
115
- add_index :banana_versions, [:item_type, :item_id]
131
+ add_index :banana_versions, %i(item_type item_id)
116
132
 
117
133
  create_table :wotsits, force: true do |t|
118
134
  t.integer :widget_id
@@ -150,6 +166,7 @@ class SetUpTestTables < ActiveRecord::Migration
150
166
  create_table :people, force: true do |t|
151
167
  t.string :name
152
168
  t.string :time_zone
169
+ t.integer :mentor_id
153
170
  end
154
171
 
155
172
  create_table :editorships, force: true do |t|
@@ -288,55 +305,12 @@ class SetUpTestTables < ActiveRecord::Migration
288
305
  t.text :object
289
306
  t.datetime :created_at
290
307
  end
291
- add_index :custom_primary_key_record_versions, [:item_type, :item_id], name: "idx_cust_pk_item"
308
+ add_index :custom_primary_key_record_versions, %i(item_type item_id), name: "idx_cust_pk_item"
292
309
  end
293
310
 
294
311
  def down
295
- drop_table :bar_habtms_foo_habtms
296
- drop_table :foo_habtms
297
- drop_table :bar_habtms
298
- drop_table :citations
299
- drop_table :quotations
300
- drop_table :animals
301
- drop_table :skippers
302
- drop_table :not_on_updates
303
- drop_table :posts
304
- drop_table :songs
305
- drop_table :editors
306
- drop_table :editorships
307
- drop_table :people
308
- drop_table :authorships
309
- drop_table :books
310
- drop_table :articles
311
- drop_table :whatchamajiggers
312
- drop_table :fluxors
313
- drop_table :wotsits
314
- remove_index :post_versions, column: [:item_type, :item_id]
315
- drop_table :post_versions
316
- remove_index :versions, column: [:item_type, :item_id]
317
- drop_table :versions
318
- if JsonVersion.table_exists?
319
- remove_index :json_versions, column: [:item_type, :item_id]
320
- drop_table :json_versions
321
- end
322
- drop_table :widgets
323
- drop_table :documents
324
- drop_table :legacy_widgets
325
- drop_table :things
326
- drop_table :translations
327
- drop_table :gadgets
328
- drop_table :customers
329
- drop_table :orders
330
- drop_table :line_items
331
- drop_table :fruits
332
- drop_table :boolits
333
- drop_table :chapters
334
- drop_table :sections
335
- drop_table :paragraphs
336
- remove_index :version_associations, column: [:version_id]
337
- remove_index :version_associations, name: "index_version_associations_on_foreign_key"
338
- drop_table :version_associations
339
- drop_table :callback_modifiers
312
+ # Not actually irreversible, but there is no need to maintain this method.
313
+ raise ActiveRecord::IrreversibleMigration
340
314
  end
341
315
 
342
316
  private
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
@@ -37,10 +36,9 @@ ActiveRecord::Schema.define(version: 20110208155312) do
37
36
  t.string "whodunnit"
38
37
  t.text "object"
39
38
  t.datetime "created_at"
39
+ t.index ["item_type", "item_id"], name: "index_banana_versions_on_item_type_and_item_id"
40
40
  end
41
41
 
42
- add_index "banana_versions", ["item_type", "item_id"], name: "index_banana_versions_on_item_type_and_item_id"
43
-
44
42
  create_table "bananas", force: :cascade do |t|
45
43
  t.datetime "created_at"
46
44
  t.datetime "updated_at"
@@ -53,11 +51,10 @@ ActiveRecord::Schema.define(version: 20110208155312) do
53
51
  create_table "bar_habtms_foo_habtms", id: false, force: :cascade do |t|
54
52
  t.integer "foo_habtm_id"
55
53
  t.integer "bar_habtm_id"
54
+ t.index ["bar_habtm_id"], name: "index_bar_habtms_foo_habtms_on_bar_habtm_id"
55
+ t.index ["foo_habtm_id"], name: "index_bar_habtms_foo_habtms_on_foo_habtm_id"
56
56
  end
57
57
 
58
- add_index "bar_habtms_foo_habtms", ["bar_habtm_id"], name: "index_bar_habtms_foo_habtms_on_bar_habtm_id"
59
- add_index "bar_habtms_foo_habtms", ["foo_habtm_id"], name: "index_bar_habtms_foo_habtms_on_foo_habtm_id"
60
-
61
58
  create_table "books", force: :cascade do |t|
62
59
  t.string "title"
63
60
  end
@@ -87,15 +84,14 @@ ActiveRecord::Schema.define(version: 20110208155312) do
87
84
  t.string "whodunnit"
88
85
  t.text "object"
89
86
  t.datetime "created_at"
87
+ t.index ["item_type", "item_id"], name: "idx_cust_pk_item"
90
88
  end
91
89
 
92
- add_index "custom_primary_key_record_versions", ["item_type", "item_id"], name: "idx_cust_pk_item"
93
-
94
- create_table "custom_primary_key_records", id: false, force: :cascade do |t|
95
- t.string "uuid"
90
+ create_table "custom_primary_key_records", primary_key: "uuid", id: :string, force: :cascade do |t|
96
91
  t.string "name"
97
92
  t.datetime "created_at"
98
93
  t.datetime "updated_at"
94
+ t.index ["uuid"], unique: true
99
95
  end
100
96
 
101
97
  create_table "customers", force: :cascade do |t|
@@ -151,6 +147,22 @@ ActiveRecord::Schema.define(version: 20110208155312) do
151
147
  t.datetime "updated_at"
152
148
  end
153
149
 
150
+ create_table "on_create", force: :cascade do |t|
151
+ t.string "name", null: false
152
+ end
153
+
154
+ create_table "on_destroy", force: :cascade do |t|
155
+ t.string "name", null: false
156
+ end
157
+
158
+ create_table "on_empty_array", force: :cascade do |t|
159
+ t.string "name", null: false
160
+ end
161
+
162
+ create_table "on_update", force: :cascade do |t|
163
+ t.string "name", null: false
164
+ end
165
+
154
166
  create_table "orders", force: :cascade do |t|
155
167
  t.integer "customer_id"
156
168
  t.string "order_date"
@@ -162,8 +174,9 @@ ActiveRecord::Schema.define(version: 20110208155312) do
162
174
  end
163
175
 
164
176
  create_table "people", force: :cascade do |t|
165
- t.string "name"
166
- t.string "time_zone"
177
+ t.string "name"
178
+ t.string "time_zone"
179
+ t.integer "mentor_id"
167
180
  end
168
181
 
169
182
  create_table "post_versions", force: :cascade do |t|
@@ -175,10 +188,9 @@ ActiveRecord::Schema.define(version: 20110208155312) do
175
188
  t.datetime "created_at"
176
189
  t.string "ip"
177
190
  t.string "user_agent"
191
+ t.index ["item_type", "item_id"], name: "index_post_versions_on_item_type_and_item_id"
178
192
  end
179
193
 
180
- add_index "post_versions", ["item_type", "item_id"], name: "index_post_versions_on_item_type_and_item_id"
181
-
182
194
  create_table "post_with_statuses", force: :cascade do |t|
183
195
  t.integer "status"
184
196
  t.datetime "created_at", null: false
@@ -232,11 +244,10 @@ ActiveRecord::Schema.define(version: 20110208155312) do
232
244
  t.integer "version_id"
233
245
  t.string "foreign_key_name", null: false
234
246
  t.integer "foreign_key_id"
247
+ t.index ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key"
248
+ t.index ["version_id"], name: "index_version_associations_on_version_id"
235
249
  end
236
250
 
237
- add_index "version_associations", ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key"
238
- add_index "version_associations", ["version_id"], name: "index_version_associations_on_version_id"
239
-
240
251
  create_table "versions", force: :cascade do |t|
241
252
  t.string "item_type", null: false
242
253
  t.integer "item_id", null: false
@@ -253,10 +264,9 @@ ActiveRecord::Schema.define(version: 20110208155312) do
253
264
  t.string "title"
254
265
  t.string "ip"
255
266
  t.string "user_agent"
267
+ t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
256
268
  end
257
269
 
258
- add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
259
-
260
270
  create_table "whatchamajiggers", force: :cascade do |t|
261
271
  t.string "owner_type"
262
272
  t.integer "owner_id"