audited 4.7.1 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of audited might be problematic. Click here for more details.

Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.standard.yml +5 -0
  4. data/.travis.yml +35 -26
  5. data/Appraisals +27 -18
  6. data/CHANGELOG.md +97 -4
  7. data/Gemfile +1 -1
  8. data/README.md +88 -19
  9. data/Rakefile +6 -6
  10. data/gemfiles/rails50.gemfile +3 -0
  11. data/gemfiles/rails51.gemfile +3 -0
  12. data/gemfiles/rails52.gemfile +3 -1
  13. data/gemfiles/rails60.gemfile +10 -0
  14. data/gemfiles/rails61.gemfile +10 -0
  15. data/lib/audited-rspec.rb +3 -1
  16. data/lib/audited.rb +26 -8
  17. data/lib/audited/audit.rb +48 -43
  18. data/lib/audited/auditor.rb +137 -57
  19. data/lib/audited/railtie.rb +16 -0
  20. data/lib/audited/rspec_matchers.rb +5 -3
  21. data/lib/audited/sweeper.rb +3 -10
  22. data/lib/audited/version.rb +3 -1
  23. data/lib/generators/audited/install_generator.rb +9 -7
  24. data/lib/generators/audited/migration.rb +2 -0
  25. data/lib/generators/audited/migration_helper.rb +3 -1
  26. data/lib/generators/audited/templates/add_association_to_audits.rb +2 -0
  27. data/lib/generators/audited/templates/add_comment_to_audits.rb +2 -0
  28. data/lib/generators/audited/templates/add_remote_address_to_audits.rb +2 -0
  29. data/lib/generators/audited/templates/add_request_uuid_to_audits.rb +2 -0
  30. data/lib/generators/audited/templates/add_version_to_auditable_index.rb +23 -0
  31. data/lib/generators/audited/templates/install.rb +3 -1
  32. data/lib/generators/audited/templates/rename_association_to_associated.rb +2 -0
  33. data/lib/generators/audited/templates/rename_changes_to_audited_changes.rb +2 -0
  34. data/lib/generators/audited/templates/rename_parent_to_association.rb +2 -0
  35. data/lib/generators/audited/templates/revert_polymorphic_indexes_order.rb +2 -0
  36. data/lib/generators/audited/upgrade_generator.rb +20 -14
  37. data/spec/audited/audit_spec.rb +151 -62
  38. data/spec/audited/auditor_spec.rb +456 -239
  39. data/spec/audited/sweeper_spec.rb +29 -20
  40. data/spec/audited_spec.rb +18 -0
  41. data/spec/audited_spec_helpers.rb +7 -7
  42. data/spec/rails_app/app/assets/config/manifest.js +2 -0
  43. data/spec/rails_app/config/application.rb +7 -2
  44. data/spec/rails_app/config/database.yml +1 -0
  45. data/spec/rails_app/config/environment.rb +1 -1
  46. data/spec/rails_app/config/environments/test.rb +5 -5
  47. data/spec/rails_app/config/initializers/secret_token.rb +2 -2
  48. data/spec/spec_helper.rb +15 -13
  49. data/spec/support/active_record/models.rb +37 -11
  50. data/spec/support/active_record/postgres/1_change_audited_changes_type_to_json.rb +1 -2
  51. data/spec/support/active_record/postgres/2_change_audited_changes_type_to_jsonb.rb +1 -2
  52. data/spec/support/active_record/schema.rb +28 -20
  53. data/test/db/version_1.rb +2 -2
  54. data/test/db/version_2.rb +2 -2
  55. data/test/db/version_3.rb +2 -3
  56. data/test/db/version_4.rb +2 -3
  57. data/test/db/version_5.rb +0 -1
  58. data/test/db/version_6.rb +2 -0
  59. data/test/install_generator_test.rb +18 -19
  60. data/test/test_helper.rb +6 -7
  61. data/test/upgrade_generator_test.rb +22 -17
  62. metadata +64 -29
  63. data/gemfiles/rails40.gemfile +0 -9
  64. data/gemfiles/rails41.gemfile +0 -8
  65. data/gemfiles/rails42.gemfile +0 -8
  66. data/spec/rails_app/config/environments/development.rb +0 -21
  67. data/spec/rails_app/config/environments/production.rb +0 -35
@@ -1,5 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
+ SingleCov.covered!
4
+
3
5
  class AuditsController < ActionController::Base
4
6
  before_action :populate_user
5
7
 
@@ -11,7 +13,7 @@ class AuditsController < ActionController::Base
11
13
  end
12
14
 
13
15
  def update
14
- current_user.update_attributes(password: 'foo')
16
+ current_user.update!(password: "foo")
15
17
  head :ok
16
18
  end
17
19
 
@@ -20,48 +22,58 @@ class AuditsController < ActionController::Base
20
22
  attr_accessor :current_user
21
23
  attr_accessor :custom_user
22
24
 
23
- def populate_user; end
25
+ def populate_user
26
+ end
24
27
  end
25
28
 
26
29
  describe AuditsController do
27
30
  include RSpec::Rails::ControllerExampleGroup
28
31
  render_views
29
32
 
30
- before(:each) do
33
+ before do
34
+ Audited::Railtie.initializers.each(&:run)
31
35
  Audited.current_user_method = :current_user
32
36
  end
33
37
 
34
38
  let(:user) { create_user }
35
39
 
36
40
  describe "POST audit" do
37
-
38
41
  it "should audit user" do
39
42
  controller.send(:current_user=, user)
40
43
  expect {
41
44
  post :create
42
- }.to change( Audited::Audit, :count )
45
+ }.to change(Audited::Audit, :count)
43
46
 
44
47
  expect(controller.company.audits.last.user).to eq(user)
45
48
  end
46
49
 
50
+ it "does not audit when method is not found" do
51
+ controller.send(:current_user=, user)
52
+ Audited.current_user_method = :nope
53
+ expect {
54
+ post :create
55
+ }.to change(Audited::Audit, :count)
56
+ expect(controller.company.audits.last.user).to eq(nil)
57
+ end
58
+
47
59
  it "should support custom users for sweepers" do
48
60
  controller.send(:custom_user=, user)
49
61
  Audited.current_user_method = :custom_user
50
62
 
51
63
  expect {
52
64
  post :create
53
- }.to change( Audited::Audit, :count )
65
+ }.to change(Audited::Audit, :count)
54
66
 
55
67
  expect(controller.company.audits.last.user).to eq(user)
56
68
  end
57
69
 
58
70
  it "should record the remote address responsible for the change" do
59
- request.env['REMOTE_ADDR'] = "1.2.3.4"
71
+ request.env["REMOTE_ADDR"] = "1.2.3.4"
60
72
  controller.send(:current_user=, user)
61
73
 
62
74
  post :create
63
75
 
64
- expect(controller.company.audits.last.remote_address).to eq('1.2.3.4')
76
+ expect(controller.company.audits.last.remote_address).to eq("1.2.3.4")
65
77
  end
66
78
 
67
79
  it "should record a UUID for the web request responsible for the change" do
@@ -80,11 +92,10 @@ describe AuditsController do
80
92
 
81
93
  expect {
82
94
  post :create
83
- }.to change( Audited::Audit, :count )
95
+ }.to change(Audited::Audit, :count)
84
96
 
85
97
  expect(controller.company.audits.last.user).to eq(user)
86
98
  end
87
-
88
99
  end
89
100
 
90
101
  describe "PUT update" do
@@ -92,33 +103,31 @@ describe AuditsController do
92
103
  controller.send(:current_user=, user)
93
104
 
94
105
  expect {
95
- put :update, Rails::VERSION::MAJOR == 4 ? {id: 123} : {params: {id: 123}}
96
- }.to_not change( Audited::Audit, :count )
106
+ put :update, params: {id: 123}
107
+ }.to_not change(Audited::Audit, :count)
97
108
  end
98
109
  end
99
110
  end
100
111
 
101
-
102
112
  describe Audited::Sweeper do
103
-
104
113
  it "should be thread-safe" do
105
114
  instance = Audited::Sweeper.new
106
115
 
107
116
  t1 = Thread.new do
108
117
  sleep 0.5
109
- instance.controller = 'thread1 controller instance'
110
- expect(instance.controller).to eq('thread1 controller instance')
118
+ instance.controller = "thread1 controller instance"
119
+ expect(instance.controller).to eq("thread1 controller instance")
111
120
  end
112
121
 
113
122
  t2 = Thread.new do
114
- instance.controller = 'thread2 controller instance'
123
+ instance.controller = "thread2 controller instance"
115
124
  sleep 1
116
- expect(instance.controller).to eq('thread2 controller instance')
125
+ expect(instance.controller).to eq("thread2 controller instance")
117
126
  end
118
127
 
119
- t1.join; t2.join
128
+ t1.join
129
+ t2.join
120
130
 
121
131
  expect(instance.controller).to be_nil
122
132
  end
123
-
124
133
  end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe Audited do
4
+ describe "#store" do
5
+ describe "maintains state of store" do
6
+ let(:current_user) { "current_user" }
7
+ before { Audited.store[:current_user] = current_user }
8
+
9
+ it "when executed without fibers" do
10
+ expect(Audited.store[:current_user]).to eq(current_user)
11
+ end
12
+
13
+ it "when executed with Fibers" do
14
+ Fiber.new { expect(Audited.store[:current_user]).to eq(current_user) }.resume
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,15 +1,14 @@
1
1
  module AuditedSpecHelpers
2
-
3
2
  def create_user(attrs = {})
4
- Models::ActiveRecord::User.create({name: 'Brandon', username: 'brandon', password: 'password', favourite_device: 'Android Phone'}.merge(attrs))
3
+ Models::ActiveRecord::User.create({name: "Brandon", username: "brandon", password: "password", favourite_device: "Android Phone"}.merge(attrs))
5
4
  end
6
5
 
7
6
  def build_user(attrs = {})
8
- Models::ActiveRecord::User.new({name: 'darth', username: 'darth', password: 'noooooooo'}.merge(attrs))
7
+ Models::ActiveRecord::User.new({name: "darth", username: "darth", password: "noooooooo"}.merge(attrs))
9
8
  end
10
9
 
11
10
  def create_versions(n = 2, attrs = {})
12
- Models::ActiveRecord::User.create(name: 'Foobar 1', **attrs).tap do |u|
11
+ Models::ActiveRecord::User.create(name: "Foobar 1", **attrs).tap do |u|
13
12
  (n - 1).times do |i|
14
13
  u.update_attribute :name, "Foobar #{i + 2}"
15
14
  end
@@ -18,15 +17,16 @@ module AuditedSpecHelpers
18
17
  end
19
18
 
20
19
  def run_migrations(direction, migrations_paths, target_version = nil)
21
- if rails_below?('5.2.0.rc1')
20
+ if rails_below?("5.2.0.rc1")
22
21
  ActiveRecord::Migrator.send(direction, migrations_paths, target_version)
23
- else
22
+ elsif rails_below?("6.0.0.rc1")
24
23
  ActiveRecord::MigrationContext.new(migrations_paths).send(direction, target_version)
24
+ else
25
+ ActiveRecord::MigrationContext.new(migrations_paths, ActiveRecord::SchemaMigration).send(direction, target_version)
25
26
  end
26
27
  end
27
28
 
28
29
  def rails_below?(rails_version)
29
30
  Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new(rails_version)
30
31
  end
31
-
32
32
  end
@@ -0,0 +1,2 @@
1
+ //= link application.js
2
+ //= link application.css
@@ -1,8 +1,13 @@
1
- require 'rails/all'
1
+ require "active_record/railtie"
2
2
 
3
3
  module RailsApp
4
4
  class Application < Rails::Application
5
- config.root = File.expand_path('../../', __FILE__)
5
+ config.root = File.expand_path("../../", __FILE__)
6
6
  config.i18n.enforce_available_locales = true
7
7
  end
8
8
  end
9
+
10
+ require "active_record/connection_adapters/sqlite3_adapter"
11
+ if ActiveRecord::ConnectionAdapters::SQLite3Adapter.respond_to?(:represent_boolean_as_integer)
12
+ ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer = true
13
+ end
@@ -19,6 +19,7 @@ mysql: &MYSQL
19
19
  username: root
20
20
  password:
21
21
  database: audited_test
22
+ charset: utf8
22
23
 
23
24
  test:
24
25
  <<: *<%= ENV['DB'] || 'SQLITE3MEM' %>
@@ -1,5 +1,5 @@
1
1
  # Load the rails application
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path("../application", __FILE__)
3
3
 
4
4
  # Initialize the rails application
5
5
  RailsApp::Application.initialize!
@@ -15,14 +15,14 @@ RailsApp::Application.configure do
15
15
  # Configure static file server for tests with Cache-Control for performance.
16
16
  if config.respond_to?(:public_file_server)
17
17
  config.public_file_server.enabled = true
18
- config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
18
+ config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"}
19
19
  else
20
- config.static_cache_control = 'public, max-age=3600'
21
- config.serve_static_files = true
20
+ config.static_cache_control = "public, max-age=3600"
21
+ config.serve_static_files = true
22
22
  end
23
23
 
24
24
  # Show full error reports and disable caching.
25
- config.consider_all_requests_local = true
25
+ config.consider_all_requests_local = true
26
26
  # config.action_controller.perform_caching = false
27
27
 
28
28
  # Raise exceptions instead of rendering exception templates.
@@ -34,7 +34,7 @@ RailsApp::Application.configure do
34
34
  # Tell Action Mailer not to deliver emails to the real world.
35
35
  # The :test delivery method accumulates sent emails in the
36
36
  # ActionMailer::Base.deliveries array.
37
- config.action_mailer.delivery_method = :test
37
+ # config.action_mailer.delivery_method = :test
38
38
 
39
39
  # Randomize the order test cases are executed.
40
40
  config.active_support.test_order = :random
@@ -1,3 +1,3 @@
1
- Rails.application.config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
1
+ Rails.application.config.secret_token = "ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571"
2
2
  Rails.application.config.session_store :cookie_store, key: "_my_app"
3
- Rails.application.config.secret_key_base = 'secret value'
3
+ Rails.application.config.secret_key_base = "secret value"
data/spec/spec_helper.rb CHANGED
@@ -1,22 +1,24 @@
1
- ENV['RAILS_ENV'] = 'test'
1
+ ENV["RAILS_ENV"] = "test"
2
+ require "bundler/setup"
3
+ require "single_cov"
4
+ SingleCov.setup :rspec
2
5
 
3
- require 'bundler'
4
- if Bundler.definition.dependencies.map(&:name).include?('protected_attributes')
5
- require 'protected_attributes'
6
+ if Bundler.definition.dependencies.map(&:name).include?("protected_attributes")
7
+ require "protected_attributes"
6
8
  end
7
- require 'rails_app/config/environment'
8
- require 'rspec/rails'
9
- require 'audited'
10
- require 'audited-rspec'
11
- require 'audited_spec_helpers'
12
- require 'support/active_record/models'
9
+ require "rails_app/config/environment"
10
+ require "rspec/rails"
11
+ require "audited"
12
+ require "audited-rspec"
13
+ require "audited_spec_helpers"
14
+ require "support/active_record/models"
13
15
 
14
- SPEC_ROOT = Pathname.new(File.expand_path('../', __FILE__))
16
+ SPEC_ROOT = Pathname.new(File.expand_path("../", __FILE__))
15
17
 
16
- Dir[SPEC_ROOT.join('support/*.rb')].each{|f| require f }
18
+ Dir[SPEC_ROOT.join("support/*.rb")].sort.each { |f| require f }
17
19
 
18
20
  RSpec.configure do |config|
19
21
  config.include AuditedSpecHelpers
20
- config.use_transactional_fixtures = false if Rails.version.start_with?('4.')
22
+ config.use_transactional_fixtures = false if Rails.version.start_with?("4.")
21
23
  config.use_transactional_tests = false if config.respond_to?(:use_transactional_tests=)
22
24
  end
@@ -1,12 +1,14 @@
1
- require 'cgi'
2
- require File.expand_path('../schema', __FILE__)
1
+ require "cgi"
2
+ require File.expand_path("../schema", __FILE__)
3
3
 
4
4
  module Models
5
5
  module ActiveRecord
6
6
  class User < ::ActiveRecord::Base
7
7
  audited except: :password
8
- attribute :non_column_attr if Rails.version >= '5.1'
8
+ attribute :non_column_attr if Rails.version >= "5.1"
9
9
  attr_protected :logins if respond_to?(:attr_protected)
10
+ enum status: {active: 0, reliable: 1, banned: 2}
11
+ serialize :phone_numbers, Array
10
12
 
11
13
  def name=(val)
12
14
  write_attribute(:name, CGI.escapeHTML(val))
@@ -20,13 +22,28 @@ module Models
20
22
 
21
23
  class UserOnlyPassword < ::ActiveRecord::Base
22
24
  self.table_name = :users
23
- attribute :non_column_attr if Rails.version >= '5.1'
25
+ attribute :non_column_attr if Rails.version >= "5.1"
24
26
  audited only: :password
25
27
  end
26
28
 
29
+ class UserRedactedPassword < ::ActiveRecord::Base
30
+ self.table_name = :users
31
+ audited redacted: :password
32
+ end
33
+
34
+ class UserMultipleRedactedAttributes < ::ActiveRecord::Base
35
+ self.table_name = :users
36
+ audited redacted: [:password, :ssn]
37
+ end
38
+
39
+ class UserRedactedPasswordCustomRedaction < ::ActiveRecord::Base
40
+ self.table_name = :users
41
+ audited redacted: :password, redaction_value: ["My", "Custom", "Value", 7]
42
+ end
43
+
27
44
  class CommentRequiredUser < ::ActiveRecord::Base
28
45
  self.table_name = :users
29
- audited comment_required: true
46
+ audited except: :password, comment_required: true
30
47
  end
31
48
 
32
49
  class OnCreateCommentRequiredUser < ::ActiveRecord::Base
@@ -44,6 +61,11 @@ module Models
44
61
  audited comment_required: true, on: :destroy
45
62
  end
46
63
 
64
+ class NoUpdateWithCommentOnlyUser < ::ActiveRecord::Base
65
+ self.table_name = :users
66
+ audited update_with_comment_only: false
67
+ end
68
+
47
69
  class AccessibleAfterDeclarationUser < ::ActiveRecord::Base
48
70
  self.table_name = :users
49
71
  audited
@@ -90,35 +112,39 @@ module Models
90
112
  end
91
113
 
92
114
  class Owner < ::ActiveRecord::Base
93
- self.table_name = 'users'
115
+ self.table_name = "users"
116
+ audited
94
117
  has_associated_audits
95
118
  has_many :companies, class_name: "OwnedCompany", dependent: :destroy
96
119
  end
97
120
 
98
121
  class OwnedCompany < ::ActiveRecord::Base
99
- self.table_name = 'companies'
122
+ self.table_name = "companies"
100
123
  belongs_to :owner, class_name: "Owner"
101
124
  attr_accessible :name, :owner if respond_to?(:attr_accessible) # declare attr_accessible before calling aaa
102
125
  audited associated_with: :owner
103
126
  end
104
127
 
128
+ class OwnedCompany::STICompany < OwnedCompany
129
+ end
130
+
105
131
  class OnUpdateDestroy < ::ActiveRecord::Base
106
- self.table_name = 'companies'
132
+ self.table_name = "companies"
107
133
  audited on: [:update, :destroy]
108
134
  end
109
135
 
110
136
  class OnCreateDestroy < ::ActiveRecord::Base
111
- self.table_name = 'companies'
137
+ self.table_name = "companies"
112
138
  audited on: [:create, :destroy]
113
139
  end
114
140
 
115
141
  class OnCreateDestroyExceptName < ::ActiveRecord::Base
116
- self.table_name = 'companies'
142
+ self.table_name = "companies"
117
143
  audited except: :name, on: [:create, :destroy]
118
144
  end
119
145
 
120
146
  class OnCreateUpdate < ::ActiveRecord::Base
121
- self.table_name = 'companies'
147
+ self.table_name = "companies"
122
148
  audited on: [:create, :update]
123
149
  end
124
150
  end
@@ -1,5 +1,4 @@
1
- parent = Rails::VERSION::MAJOR == 4 ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
2
- class ChangeAuditedChangesTypeToJson < parent
1
+ class ChangeAuditedChangesTypeToJson < ActiveRecord::Migration[5.0]
3
2
  def self.up
4
3
  remove_column :audits, :audited_changes
5
4
  add_column :audits, :audited_changes, :json
@@ -1,5 +1,4 @@
1
- parent = Rails::VERSION::MAJOR == 4 ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
2
- class ChangeAuditedChangesTypeToJsonb < parent
1
+ class ChangeAuditedChangesTypeToJsonb < ActiveRecord::Migration[5.0]
3
2
  def self.up
4
3
  remove_column :audits, :audited_changes
5
4
  add_column :audits, :audited_changes, :jsonb
@@ -1,28 +1,33 @@
1
- require 'active_record'
2
- require 'logger'
1
+ require "active_record"
2
+ require "logger"
3
3
 
4
4
  begin
5
- db_config = ActiveRecord::Base.configurations[Rails.env].clone
6
- db_type = db_config['adapter']
7
- db_name = db_config.delete('database')
8
- raise Exception.new('No database name specified.') if db_name.blank?
9
- if db_type == 'sqlite3'
10
- db_file = Pathname.new(__FILE__).dirname.join(db_name)
11
- db_file.unlink if db_file.file?
5
+ if ActiveRecord.version >= Gem::Version.new("6.1.0")
6
+ db_config = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first
7
+ ActiveRecord::Tasks::DatabaseTasks.create(db_config)
12
8
  else
13
- if defined?(JRUBY_VERSION)
14
- db_config.symbolize_keys!
15
- db_config[:configure_connection] = false
9
+ db_config = ActiveRecord::Base.configurations[Rails.env].clone
10
+ db_type = db_config["adapter"]
11
+ db_name = db_config.delete("database")
12
+ raise StandardError.new("No database name specified.") if db_name.blank?
13
+ if db_type == "sqlite3"
14
+ db_file = Pathname.new(__FILE__).dirname.join(db_name)
15
+ db_file.unlink if db_file.file?
16
+ else
17
+ if defined?(JRUBY_VERSION)
18
+ db_config.symbolize_keys!
19
+ db_config[:configure_connection] = false
20
+ end
21
+ adapter = ActiveRecord::Base.send("#{db_type}_connection", db_config)
22
+ adapter.recreate_database db_name, db_config.slice("charset").symbolize_keys
23
+ adapter.disconnect!
16
24
  end
17
- adapter = ActiveRecord::Base.send("#{db_type}_connection", db_config)
18
- adapter.recreate_database db_name
19
- adapter.disconnect!
20
25
  end
21
- rescue Exception => e
26
+ rescue => e
22
27
  Kernel.warn e
23
28
  end
24
29
 
25
- logfile = Pathname.new(__FILE__).dirname.join('debug.log')
30
+ logfile = Pathname.new(__FILE__).dirname.join("debug.log")
26
31
  logfile.unlink if logfile.file?
27
32
  ActiveRecord::Base.logger = Logger.new(logfile)
28
33
 
@@ -35,11 +40,14 @@ ActiveRecord::Schema.define do
35
40
  t.column :username, :string
36
41
  t.column :password, :string
37
42
  t.column :activated, :boolean
43
+ t.column :status, :integer, default: 0
38
44
  t.column :suspended_at, :datetime
39
45
  t.column :logins, :integer, default: 0
40
46
  t.column :created_at, :datetime
41
47
  t.column :updated_at, :datetime
42
48
  t.column :favourite_device, :string
49
+ t.column :ssn, :integer
50
+ t.column :phone_numbers, :string
43
51
  end
44
52
 
45
53
  create_table :companies do |t|
@@ -74,9 +82,9 @@ ActiveRecord::Schema.define do
74
82
  t.column :created_at, :datetime
75
83
  end
76
84
 
77
- add_index :audits, [:auditable_id, :auditable_type], name: 'auditable_index'
78
- add_index :audits, [:associated_id, :associated_type], name: 'associated_index'
79
- add_index :audits, [:user_id, :user_type], name: 'user_index'
85
+ add_index :audits, [:auditable_id, :auditable_type], name: "auditable_index"
86
+ add_index :audits, [:associated_id, :associated_type], name: "associated_index"
87
+ add_index :audits, [:user_id, :user_type], name: "user_index"
80
88
  add_index :audits, :request_uuid
81
89
  add_index :audits, :created_at
82
90
  end