marty 1.2.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -9
  3. data/Gemfile.lock +93 -80
  4. data/app/components/marty/data_grid_view.rb +1 -1
  5. data/app/components/marty/main_auth_app.rb +1 -1
  6. data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +1 -1
  7. data/app/components/marty/posting_grid.rb +1 -1
  8. data/app/components/marty/promise_view.rb +1 -1
  9. data/app/components/marty/simple_app.rb +1 -1
  10. data/app/controllers/marty/application_controller.rb +2 -2
  11. data/app/controllers/marty/diagnostic/controller.rb +1 -5
  12. data/app/models/marty/api_auth.rb +6 -4
  13. data/app/models/marty/config.rb +1 -1
  14. data/app/models/marty/data_grid.rb +13 -13
  15. data/app/models/marty/delorean_rule.rb +2 -2
  16. data/app/models/marty/event.rb +1 -1
  17. data/app/models/marty/import_type.rb +2 -2
  18. data/app/models/marty/name_validator.rb +1 -1
  19. data/app/models/marty/posting.rb +0 -5
  20. data/app/models/marty/user.rb +1 -1
  21. data/app/views/marty/diagnostic/diag.html.erb +0 -2
  22. data/config/routes.rb +2 -2
  23. data/db/migrate/003_create_marty_users.rb +1 -1
  24. data/db/migrate/004_create_marty_roles.rb +1 -1
  25. data/db/migrate/005_create_marty_user_roles.rb +1 -1
  26. data/db/migrate/006_create_marty_tokens.rb +1 -1
  27. data/db/migrate/008_create_marty_posting_types.rb +1 -1
  28. data/db/migrate/068_create_marty_import_types.rb +1 -1
  29. data/db/migrate/069_create_marty_import_synonyms.rb +1 -1
  30. data/db/migrate/070_create_versions.rb +1 -1
  31. data/db/migrate/071_add_object_changes_column_to_versions.rb +1 -1
  32. data/db/migrate/072_add_validation_function_to_import_types.rb +1 -1
  33. data/db/migrate/073_add_preprocess_function_to_import_types.rb +1 -1
  34. data/db/migrate/090_create_delayed_jobs.rb +1 -1
  35. data/db/migrate/091_create_marty_promises.rb +1 -1
  36. data/db/migrate/096_add_user_roles_to_import_types.rb +1 -1
  37. data/db/migrate/097_drop_versions.rb +1 -1
  38. data/db/migrate/099_create_marty_configs.rb +1 -1
  39. data/db/migrate/101_create_marty_grid_index_numranges.rb +1 -1
  40. data/db/migrate/102_create_marty_grid_index_int4ranges.rb +1 -1
  41. data/db/migrate/103_create_marty_grid_index_integers.rb +1 -1
  42. data/db/migrate/104_create_marty_grid_index_strings.rb +1 -1
  43. data/db/migrate/105_create_marty_grid_index_booleans.rb +1 -1
  44. data/db/migrate/106_make_grid_indexes_nullable.rb +1 -1
  45. data/db/migrate/200_create_marty_event_operation_enum.rb +1 -1
  46. data/db/migrate/201_create_marty_events.rb +1 -1
  47. data/db/migrate/202_add_completion_status_to_event.rb +1 -1
  48. data/db/migrate/300_create_marty_api_configs.rb +1 -1
  49. data/db/migrate/301_create_marty_api_log.rb +1 -1
  50. data/db/migrate/302_add_api_configs_validate_result.rb +1 -1
  51. data/db/migrate/303_create_marty_logs.rb +1 -1
  52. data/db/migrate/304_drop_marty_api_logs.rb +1 -1
  53. data/db/migrate/400_create_dg_plv8_v1_fns.rb +1 -1
  54. data/lib/marty/migrations.rb +7 -8
  55. data/lib/marty/monkey.rb +2 -30
  56. data/lib/marty/version.rb +1 -1
  57. data/marty.gemspec +3 -4
  58. data/other/marty/diagnostic/aws/ec2_instance.rb +65 -25
  59. data/other/marty/diagnostic/base.rb +14 -5
  60. data/other/marty/diagnostic/collection.rb +1 -0
  61. data/other/marty/diagnostic/{delayed_job.rb → delayed_job_version.rb} +2 -8
  62. data/other/marty/diagnostic/delayed_job_workers.rb +11 -0
  63. data/other/marty/diagnostic/environment_variables.rb +4 -6
  64. data/other/marty/diagnostic/fatal.rb +0 -5
  65. data/other/marty/diagnostic/node.rb +4 -3
  66. data/other/marty/diagnostic/nodes.rb +46 -13
  67. data/other/marty/diagnostic/packer.rb +22 -25
  68. data/other/marty/diagnostic/version.rb +19 -21
  69. data/script_id, +0 -0
  70. data/spec/controllers/diagnostic/controller_spec.rb +8 -7
  71. data/spec/controllers/job_controller_spec.rb +5 -5
  72. data/spec/controllers/rpc_controller_spec.rb +52 -57
  73. data/spec/controllers/rpc_import_spec.rb +1 -1
  74. data/spec/dummy/config/environments/test.rb +4 -2
  75. data/spec/dummy/db/migrate/20140000000000_create_enums.rb +1 -1
  76. data/spec/dummy/db/migrate/20150406171536_create_categories.rb +2 -2
  77. data/spec/dummy/db/migrate/20150408200916_create_loan_programs.rb +1 -1
  78. data/spec/dummy/db/migrate/20150408201429_create_types.rb +1 -1
  79. data/spec/dummy/db/migrate/20151023000001_create_simple.rb +1 -1
  80. data/spec/dummy/db/migrate/20160100000038_create_gemini_states.rb +1 -1
  81. data/spec/dummy/db/migrate/20160923183516_add_bulk_pricing_event_ops.rb +1 -1
  82. data/spec/dummy/db/migrate/20170706081300_add_state_array_to_lp.rb +1 -1
  83. data/spec/dummy/db/migrate/20170725160000_add_misc_arrays_to_lp.rb +1 -1
  84. data/spec/dummy/db/migrate/20171220150101_add_rule_type_enums.rb +1 -1
  85. data/spec/dummy/db/migrate/20171222150100_add_rule_indices.rb +1 -1
  86. data/spec/features/auth_app_spec.rb +1 -0
  87. data/spec/features/data_import_spec.rb +2 -2
  88. data/spec/features/log_view_spec.rb +4 -4
  89. data/spec/features/reporting_spec.rb +16 -19
  90. data/spec/features/rule_spec.rb +11 -8
  91. data/spec/features/scripting_spec.rb +2 -2
  92. data/spec/features/scripting_test_spec.rb +0 -2
  93. data/spec/features/user_view_spec.rb +4 -6
  94. data/spec/lib/logger_spec.rb +4 -4
  95. data/spec/models/event_spec.rb +4 -4
  96. data/spec/models/promise_spec.rb +1 -1
  97. data/spec/other/diagnostic/base_spec.rb +12 -12
  98. data/spec/other/diagnostic/collection_spec.rb +8 -8
  99. data/spec/other/diagnostic/{delayed_job_spec.rb → delayed_job_version_spec.rb} +4 -4
  100. data/spec/other/diagnostic/delayed_job_workers_spec.rb +44 -0
  101. data/spec/other/diagnostic/reporter_spec.rb +13 -17
  102. data/spec/spec_helper.rb +36 -14
  103. data/spec/support/clean_db_helpers.rb +2 -2
  104. metadata +14 -39
@@ -2,7 +2,7 @@ class Marty::Config < Marty::Base
2
2
  class ConfigValidator < ActiveModel::Validator
3
3
  def validate(entry)
4
4
  v = entry.get_value
5
- entry.errors[:base] = "bad JSON value" if v.nil?
5
+ entry.errors[:base] << "bad JSON value" if v.nil?
6
6
  v
7
7
  end
8
8
  end
@@ -15,19 +15,19 @@ class Marty::DataGrid < Marty::Base
15
15
  class DataGridValidator < ActiveModel::Validator
16
16
  def validate(dg)
17
17
 
18
- dg.errors[:base] = "'#{dg.data_type}' not a defined type or class" unless
18
+ dg.errors.add(:base, "'#{dg.data_type}' not a defined type or class") unless
19
19
  Marty::DataGrid.convert_data_type(dg.data_type)
20
20
 
21
- dg.errors[:base] = "data must be array of arrays" unless
21
+ dg.errors.add(:base, "data must be array of arrays") unless
22
22
  dg.data.is_a?(Array) && dg.data.all? {|a| a.is_a? Array}
23
23
 
24
- dg.errors[:base] = "metadata must be an array of hashes" unless
24
+ dg.errors.add(:base, "metadata must be an array of hashes") unless
25
25
  dg.metadata.is_a?(Array) && dg.metadata.all? {|a| a.is_a? Hash}
26
26
 
27
- dg.errors[:base] = "metadata must contain only h/v dirs" unless
27
+ dg.errors.add(:base, "metadata must contain only h/v dirs") unless
28
28
  dg.metadata.all? {|h| ["h", "v"].member? h["dir"]}
29
29
 
30
- dg.errors[:base] = "metadata item attrs must be unique" unless
30
+ dg.errors.add(:base, "metadata item attrs must be unique") unless
31
31
  dg.metadata.map {|h| h["attr"]}.uniq.length == dg.metadata.length
32
32
 
33
33
  dg.metadata.each do
@@ -39,22 +39,22 @@ class Marty::DataGrid < Marty::Base
39
39
  unless rs_keep.nil? || rs_keep.empty?
40
40
  m = /\A *(<|<=|>|>=)? *([a-z_]+) *\z/.match(rs_keep)
41
41
  unless m
42
- dg.errors[:base] = "invalid grid modifier expression: #{rs_keep}"
42
+ dg.errors.add(:base, "invalid grid modifier expression: #{rs_keep}")
43
43
  next
44
44
  end
45
45
  end
46
46
 
47
- dg.errors[:base] = "metadata elements must have attr/type/keys" unless
47
+ dg.errors.add(:base, "metadata elements must have attr/type/keys") unless
48
48
  attr && type && keys
49
49
 
50
50
  # enforce Delorean attr syntax (a bit Draconian)
51
- dg.errors[:base] = "bad attribute '#{attr}'" unless
51
+ dg.errors.add(:base, "bad attribute '#{attr}'") unless
52
52
  attr =~ /^[a-z][A-Za-z0-9_]*$/
53
53
 
54
- dg.errors[:base] = "unknown metadata type #{type}" unless
54
+ dg.errors.add(:base, "unknown metadata type #{type}") unless
55
55
  Marty::DataGrid.type_to_index(type)
56
56
 
57
- dg.errors[:base] = "bad metadata keys" unless
57
+ dg.errors.add(:base, "bad metadata keys") unless
58
58
  keys.is_a?(Array) && keys.length>0
59
59
  end
60
60
 
@@ -68,10 +68,10 @@ class Marty::DataGrid < Marty::Base
68
68
  v_zip_keys = v_keys.empty? ? [] : v_keys[0].zip(*v_keys[1..-1])
69
69
  h_zip_keys = h_keys.empty? ? [] : h_keys[0].zip(*h_keys[1..-1])
70
70
 
71
- dg.errors[:base] = "duplicate horiz. key combination" unless
71
+ dg.errors.add(:base, "duplicate horiz. key combination") unless
72
72
  h_zip_keys.uniq.length == h_zip_keys.length
73
73
 
74
- dg.errors[:base] = "duplicate vertical key combination" unless
74
+ dg.errors.add(:base, "duplicate vertical key combination") unless
75
75
  v_zip_keys.uniq.length == v_zip_keys.length
76
76
  end
77
77
  end
@@ -589,7 +589,7 @@ class Marty::DataGrid < Marty::Base
589
589
  self.data = data
590
590
  self.data_type = data_type
591
591
  self.lenient = !!lenient
592
- self.metadata = metadata
592
+ self.metadata = metadata unless self.metadata == metadata # Otherwise changed will depend on order in hashes
593
593
  self.created_dt = created_dt if created_dt
594
594
  save!
595
595
  end
@@ -5,7 +5,7 @@ class Marty::DeloreanRule < Marty::BaseRule
5
5
 
6
6
  def validate
7
7
  super
8
- return errors[:base] = "Start date must be before end date" if
8
+ return errors[:base] << "Start date must be before end date" if
9
9
  start_dt && end_dt && start_dt >= end_dt
10
10
 
11
11
  if computed_guards.present? || results.present?
@@ -13,7 +13,7 @@ class Marty::DeloreanRule < Marty::BaseRule
13
13
  eclass = engine && engine.constantize || Marty::RuleScriptSet
14
14
  eng = eclass.new('infinity').get_engine(self_as_hash)
15
15
  rescue => e
16
- return errors[:computed] = "- " + e.message
16
+ return errors[:computed] << "- " + e.message
17
17
  end
18
18
  end
19
19
  end
@@ -2,7 +2,7 @@ class Marty::Event < Marty::Base
2
2
 
3
3
  class EventValidator < ActiveModel::Validator
4
4
  def validate(event)
5
- event.errors[:base] = "Must have promise_id or start_dt" unless
5
+ event.errors[:base] << "Must have promise_id or start_dt" unless
6
6
  event.promise_id || event.start_dt
7
7
  end
8
8
  end
@@ -4,7 +4,7 @@ class Marty::ImportType < Marty::Base
4
4
  klass = entry.get_model_class
5
5
 
6
6
  unless klass.is_a?(Class) && klass < ActiveRecord::Base
7
- entry.errors[:base] = "bad model name"
7
+ entry.errors.add :base, "bad model name"
8
8
  return
9
9
  end
10
10
 
@@ -13,7 +13,7 @@ class Marty::ImportType < Marty::Base
13
13
  entry.validation_function,
14
14
  entry.preprocess_function,
15
15
  ].each { |func|
16
- entry.errors[:base] = "unknown class method #{func}" if
16
+ entry.errors.add(:base, "unknown class method #{func}") if
17
17
  func && !klass.respond_to?(func.to_sym)
18
18
  }
19
19
  end
@@ -8,7 +8,7 @@ class Marty::NameValidator < ActiveModel::Validator
8
8
 
9
9
  # disallow leading, trailing, >1 internal spaces, special chars (|)
10
10
  if value =~ /\A\s|\s\z|\A.*\s\s.*\z|.*\|.*/
11
- entry.errors[field] =
11
+ entry.errors[field] <<
12
12
  I18n.t("activerecord.errors.messages.extraneous_spaces")
13
13
  end
14
14
  end
@@ -93,9 +93,4 @@ class Marty::Posting < Marty::Base
93
93
  q = q.where(posting_type_id: posting_type.id) if posting_type
94
94
  q.order("created_dt DESC").first
95
95
  end
96
-
97
- delorean_fn :is_today, sig: 1 do
98
- |posting|
99
- posting.created_dt.to_date == Date.today
100
- end
101
96
  end
@@ -137,6 +137,6 @@ private
137
137
  errors.add :base,
138
138
  "Users cannot be deleted - set 'Active' to false to disable the account"
139
139
 
140
- errors.blank?
140
+ throw :abort unless errors.blank?
141
141
  end
142
142
  end
@@ -26,5 +26,3 @@
26
26
  <% end %>
27
27
  </table>
28
28
  </div>
29
-
30
- <%= display_alert_message if fatal? %>
data/config/routes.rb CHANGED
@@ -3,8 +3,8 @@ Rails.application.routes.draw do
3
3
  end
4
4
 
5
5
  Marty::Engine.routes.draw do
6
- match via: [:get, :post], "rpc/:action(.:format)" => "rpc", as: :rpc
7
- get "job/:action" => "job", as: :job
6
+ match via: [:get, :post], "rpc/evaluate(.:format)" => "rpc", as: :rpc
8
7
  match via: [:get, :post], "report(.:format)" => "report#index", as: :report
8
+ get 'job/download' => 'job', as: :job
9
9
  get 'diag', to: 'diagnostic/#op'
10
10
  end
@@ -1,4 +1,4 @@
1
- class CreateMartyUsers < ActiveRecord::Migration
1
+ class CreateMartyUsers < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_users do |t|
4
4
  t.timestamps null: false
@@ -1,4 +1,4 @@
1
- class CreateMartyRoles < ActiveRecord::Migration
1
+ class CreateMartyRoles < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_roles do |t|
4
4
  t.string :name, null: false, limit: 255
@@ -1,4 +1,4 @@
1
- class CreateMartyUserRoles < ActiveRecord::Migration
1
+ class CreateMartyUserRoles < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyTokens < ActiveRecord::Migration
1
+ class CreateMartyTokens < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyPostingTypes < ActiveRecord::Migration
1
+ class CreateMartyPostingTypes < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_posting_types do |t|
4
4
  t.string :name, null: false, limit: 255
@@ -1,4 +1,4 @@
1
- class CreateMartyImportTypes < ActiveRecord::Migration
1
+ class CreateMartyImportTypes < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_import_types do |t|
4
4
  t.timestamps null: false
@@ -1,4 +1,4 @@
1
- class CreateMartyImportSynonyms < ActiveRecord::Migration
1
+ class CreateMartyImportSynonyms < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateVersions < ActiveRecord::Migration
1
+ class CreateVersions < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :versions do |t|
4
4
  t.string :item_type, null: false, limit: 255
@@ -1,4 +1,4 @@
1
- class AddObjectChangesColumnToVersions < ActiveRecord::Migration
1
+ class AddObjectChangesColumnToVersions < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  add_column :versions, :object_changes, :text
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddValidationFunctionToImportTypes < ActiveRecord::Migration
1
+ class AddValidationFunctionToImportTypes < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :marty_import_types, :validation_function, :string, limit: 255
4
4
  drop_table :marty_import_synonyms
@@ -1,4 +1,4 @@
1
- class AddPreprocessFunctionToImportTypes < ActiveRecord::Migration
1
+ class AddPreprocessFunctionToImportTypes < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :marty_import_types, :preprocess_function, :string, limit: 255
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateDelayedJobs < ActiveRecord::Migration
1
+ class CreateDelayedJobs < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :delayed_jobs, :force => true do |table|
4
4
  table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
@@ -1,4 +1,4 @@
1
- class CreateMartyPromises < ActiveRecord::Migration
1
+ class CreateMartyPromises < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change(*args)
@@ -1,4 +1,4 @@
1
- class AddUserRolesToImportTypes < ActiveRecord::Migration
1
+ class AddUserRolesToImportTypes < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class DropVersions < ActiveRecord::Migration
1
+ class DropVersions < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  drop_table :versions
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateMartyConfigs < ActiveRecord::Migration
1
+ class CreateMartyConfigs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_configs do |t|
4
4
  t.timestamps null: false
@@ -1,4 +1,4 @@
1
- class CreateMartyGridIndexNumranges < ActiveRecord::Migration
1
+ class CreateMartyGridIndexNumranges < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyGridIndexInt4ranges < ActiveRecord::Migration
1
+ class CreateMartyGridIndexInt4ranges < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyGridIndexIntegers < ActiveRecord::Migration
1
+ class CreateMartyGridIndexIntegers < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyGridIndexStrings < ActiveRecord::Migration
1
+ class CreateMartyGridIndexStrings < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyGridIndexBooleans < ActiveRecord::Migration
1
+ class CreateMartyGridIndexBooleans < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class MakeGridIndexesNullable < ActiveRecord::Migration
1
+ class MakeGridIndexesNullable < ActiveRecord::Migration[4.2]
2
2
  include Marty::Migrations
3
3
 
4
4
  def change
@@ -1,4 +1,4 @@
1
- class CreateMartyEventOperationEnum < ActiveRecord::Migration
1
+ class CreateMartyEventOperationEnum < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  values = Marty::EnumEventOperation::VALUES
4
4
  str_values = values.map {|v| ActiveRecord::Base.connection.quote v}.join ','
@@ -1,4 +1,4 @@
1
- class CreateMartyEvents < ActiveRecord::Migration
1
+ class CreateMartyEvents < ActiveRecord::Migration[4.2]
2
2
  def change(*args)
3
3
  # Giant hack to monkey patch connection so that we can create an
4
4
  # UNLOGGED table in PostgreSQL.
@@ -1,4 +1,4 @@
1
- class AddCompletionStatusToEvent < ActiveRecord::Migration
1
+ class AddCompletionStatusToEvent < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :marty_events, :error, :boolean, null: true
4
4
  execute "update marty_events set error = 'f'"
@@ -1,4 +1,4 @@
1
- class CreateMartyApiConfigs < ActiveRecord::Migration
1
+ class CreateMartyApiConfigs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_api_configs do |t|
4
4
  t.timestamps null: false
@@ -1,4 +1,4 @@
1
- class CreateMartyApiLog < ActiveRecord::Migration
1
+ class CreateMartyApiLog < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_api_logs do |t|
4
4
  t.string :script, null: false
@@ -1,4 +1,4 @@
1
- class AddApiConfigsValidateResult < ActiveRecord::Migration
1
+ class AddApiConfigsValidateResult < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  rename_column :marty_api_configs, :validated, :input_validated
4
4
  add_column :marty_api_configs, :output_validated, :boolean, null: false,
@@ -1,4 +1,4 @@
1
- class CreateMartyLogs < ActiveRecord::Migration
1
+ class CreateMartyLogs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :marty_logs do |t|
4
4
  t.string :message_type, null: false
@@ -1,4 +1,4 @@
1
- class DropMartyApiLogs < ActiveRecord::Migration
1
+ class DropMartyApiLogs < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  drop_table :marty_api_logs
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateDgPlv8V1Fns < ActiveRecord::Migration
1
+ class CreateDgPlv8V1Fns < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  connection.execute <<-SQL
4
4
  -- required to utilize plv8 extension
@@ -70,7 +70,7 @@ module Marty::Migrations
70
70
  fk_opts(from_table,
71
71
  to_table,
72
72
  options[:column]).update(options),
73
- )
73
+ )
74
74
  end
75
75
 
76
76
  # created_dt/obsoleted_dt need to be indexed since they appear in
@@ -101,11 +101,10 @@ module Marty::Migrations
101
101
  attrs,
102
102
  unique: true,
103
103
  name: unique_index_name(klass)
104
- ) unless index_exists?(klass.table_name.to_sym,
105
- attrs,
106
- name: unique_index_name(klass),
107
- unique: true)
108
-
104
+ ) unless index_exists?(klass.table_name.to_sym,
105
+ attrs,
106
+ name: unique_index_name(klass),
107
+ unique: true)
109
108
  end
110
109
 
111
110
  def remove_mcfly_unique_index(klass)
@@ -231,7 +230,7 @@ EOSQL
231
230
  # before EOL. GO in comments could trigger this and will cause an error
232
231
  File.open(mig_name, "w") do |f|
233
232
  f.print <<OUT
234
- class #{klass.camelcase} < ActiveRecord::Migration
233
+ class #{klass.camelcase} < ActiveRecord::Migration[4.2]
235
234
 
236
235
  def up
237
236
  path = #{sql_snap_call}
@@ -257,7 +256,7 @@ OUT
257
256
  ActiveRecord::Base.
258
257
  connection.execute(<<-SQL).to_a.first.try{|v| v['id']}
259
258
  select id from #{klass.table_name} where name =
260
- #{ActiveRecord::Base.sanitize(name)}
259
+ #{ActiveRecord::Base.connection.quote(name)}
261
260
  SQL
262
261
  end
263
262