Merge pull request #4288 from consul/dependabot/bundler/rubocop-rails-2.9.1
Bump rubocop-rails from 2.6.0 to 2.9.1
This commit is contained in:
14
.rubocop.yml
14
.rubocop.yml
@@ -217,6 +217,9 @@ Performance/EndWith:
|
|||||||
Performance/StartWith:
|
Performance/StartWith:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Rails/ActiveRecordCallbacksOrder:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Rails/CreateTableWithTimestamps:
|
Rails/CreateTableWithTimestamps:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -270,6 +273,9 @@ Rails/OutputSafety:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- app/helpers/text_with_links_helper.rb
|
- app/helpers/text_with_links_helper.rb
|
||||||
|
|
||||||
|
Rails/PluckId:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Rails/PluralizationGrammar:
|
Rails/PluralizationGrammar:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -295,7 +301,7 @@ Rails/SaveBang:
|
|||||||
|
|
||||||
Rails/SkipsModelValidations:
|
Rails/SkipsModelValidations:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Blacklist:
|
ForbiddenMethods:
|
||||||
- update_attribute
|
- update_attribute
|
||||||
Exclude:
|
Exclude:
|
||||||
- lib/acts_as_paranoid_aliases.rb
|
- lib/acts_as_paranoid_aliases.rb
|
||||||
@@ -322,6 +328,12 @@ Rails/UnknownEnv:
|
|||||||
Rails/Validation:
|
Rails/Validation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Rails/WhereEquals:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Rails/WhereNot:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
RSpec/AroundBlock:
|
RSpec/AroundBlock:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -109,7 +109,7 @@ group :development do
|
|||||||
gem "pronto-scss", "~> 0.11.0", require: false
|
gem "pronto-scss", "~> 0.11.0", require: false
|
||||||
gem "rubocop", "~> 0.93.1", require: false
|
gem "rubocop", "~> 0.93.1", require: false
|
||||||
gem "rubocop-performance", "~> 1.7.1", require: false
|
gem "rubocop-performance", "~> 1.7.1", require: false
|
||||||
gem "rubocop-rails", "~> 2.6.0", require: false
|
gem "rubocop-rails", "~> 2.9.1", require: false
|
||||||
gem "rubocop-rspec", "~> 1.44.1", require: false
|
gem "rubocop-rspec", "~> 1.44.1", require: false
|
||||||
gem "rvm1-capistrano3", "~> 1.4.0", require: false
|
gem "rvm1-capistrano3", "~> 1.4.0", require: false
|
||||||
gem "scss_lint", "~> 0.59.0", require: false
|
gem "scss_lint", "~> 0.59.0", require: false
|
||||||
|
|||||||
@@ -555,10 +555,10 @@ GEM
|
|||||||
parser (>= 3.0.1.1)
|
parser (>= 3.0.1.1)
|
||||||
rubocop-performance (1.7.1)
|
rubocop-performance (1.7.1)
|
||||||
rubocop (>= 0.82.0)
|
rubocop (>= 0.82.0)
|
||||||
rubocop-rails (2.6.0)
|
rubocop-rails (2.9.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 0.82.0)
|
rubocop (>= 0.90.0, < 2.0)
|
||||||
rubocop-rspec (1.44.1)
|
rubocop-rspec (1.44.1)
|
||||||
rubocop (~> 0.87)
|
rubocop (~> 0.87)
|
||||||
rubocop-ast (>= 0.7.1)
|
rubocop-ast (>= 0.7.1)
|
||||||
@@ -772,7 +772,7 @@ DEPENDENCIES
|
|||||||
rspec-rails (~> 4.0)
|
rspec-rails (~> 4.0)
|
||||||
rubocop (~> 0.93.1)
|
rubocop (~> 0.93.1)
|
||||||
rubocop-performance (~> 1.7.1)
|
rubocop-performance (~> 1.7.1)
|
||||||
rubocop-rails (~> 2.6.0)
|
rubocop-rails (~> 2.9.1)
|
||||||
rubocop-rspec (~> 1.44.1)
|
rubocop-rspec (~> 1.44.1)
|
||||||
rvm1-capistrano3 (~> 1.4.0)
|
rvm1-capistrano3 (~> 1.4.0)
|
||||||
sassc-rails (~> 2.1.2)
|
sassc-rails (~> 2.1.2)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Admin::StatsController < Admin::BaseController
|
|||||||
.count(:voter_id)
|
.count(:voter_id)
|
||||||
|
|
||||||
@user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals
|
@user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals
|
||||||
budgets_ids = Budget.where.not(phase: "finished").pluck(:id)
|
budgets_ids = Budget.where.not(phase: "finished").ids
|
||||||
@budgets = budgets_ids.size
|
@budgets = budgets_ids.size
|
||||||
@investments = Budget::Investment.where(budget_id: budgets_ids).count
|
@investments = Budget::Investment.where(budget_id: budgets_ids).count
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ module Budgets
|
|||||||
def index
|
def index
|
||||||
@investments = investments.page(params[:page]).per(PER_PAGE).for_render
|
@investments = investments.page(params[:page]).per(PER_PAGE).for_render
|
||||||
|
|
||||||
@investment_ids = @investments.pluck(:id)
|
@investment_ids = @investments.ids
|
||||||
@investments_map_coordinates = MapLocation.where(investment: investments).map(&:json_data)
|
@investments_map_coordinates = MapLocation.where(investment: investments).map(&:json_data)
|
||||||
|
|
||||||
@tag_cloud = tag_cloud
|
@tag_cloud = tag_cloud
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class DashboardController < Dashboard::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_done_and_pending_actions
|
def set_done_and_pending_actions
|
||||||
@done_actions = proposed_actions.joins(:proposals).where("proposals.id = ?", proposal.id)
|
@done_actions = proposed_actions.joins(:proposals).where(proposals: { id: proposal.id })
|
||||||
@pending_actions = proposed_actions - @done_actions
|
@pending_actions = proposed_actions - @done_actions
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Officing::BallotSheetsController < Officing::BaseController
|
|||||||
joins(:booth_assignment).
|
joins(:booth_assignment).
|
||||||
final.
|
final.
|
||||||
where(id: current_user.poll_officer.officer_assignment_ids).
|
where(id: current_user.poll_officer.officer_assignment_ids).
|
||||||
where("poll_booth_assignments.poll_id = ?", @poll.id).
|
where(poll_booth_assignments: { poll_id: @poll.id }).
|
||||||
where(date: Date.current)
|
where(date: Date.current)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class Officing::ResultsController < Officing::BaseController
|
|||||||
joins(:booth_assignment).
|
joins(:booth_assignment).
|
||||||
final.
|
final.
|
||||||
where(id: current_user.poll_officer.officer_assignment_ids).
|
where(id: current_user.poll_officer.officer_assignment_ids).
|
||||||
where("poll_booth_assignments.poll_id = ?", @poll.id).
|
where(poll_booth_assignments: { poll_id: @poll.id }).
|
||||||
where(date: Date.current)
|
where(date: Date.current)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ module ProposalsDashboardHelper
|
|||||||
|
|
||||||
def new_resources_since_last_login?(resources, new_actions_since_last_login)
|
def new_resources_since_last_login?(resources, new_actions_since_last_login)
|
||||||
if resources.present?
|
if resources.present?
|
||||||
resources.pluck(:id).any? { |id| new_actions_since_last_login.include?(id) }
|
resources.ids.any? { |id| new_actions_since_last_login.include?(id) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -104,19 +104,19 @@ class Budget
|
|||||||
scope :for_render, -> { includes(:heading) }
|
scope :for_render, -> { includes(:heading) }
|
||||||
|
|
||||||
def self.by_valuator(valuator_id)
|
def self.by_valuator(valuator_id)
|
||||||
where("budget_valuator_assignments.valuator_id = ?", valuator_id).joins(:valuator_assignments)
|
where(budget_valuator_assignments: { valuator_id: valuator_id }).joins(:valuator_assignments)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.by_valuator_group(valuator_group_id)
|
def self.by_valuator_group(valuator_group_id)
|
||||||
joins(:valuator_group_assignments).
|
joins(:valuator_group_assignments).
|
||||||
where("budget_valuator_group_assignments.valuator_group_id = ?", valuator_group_id)
|
where(budget_valuator_group_assignments: { valuator_group_id: valuator_group_id })
|
||||||
end
|
end
|
||||||
|
|
||||||
before_create :set_original_heading_id
|
|
||||||
before_save :calculate_confidence_score
|
|
||||||
after_save :recalculate_heading_winners
|
|
||||||
before_validation :set_responsible_name
|
before_validation :set_responsible_name
|
||||||
before_validation :set_denormalized_ids
|
before_validation :set_denormalized_ids
|
||||||
|
before_save :calculate_confidence_score
|
||||||
|
before_create :set_original_heading_id
|
||||||
|
after_save :recalculate_heading_winners
|
||||||
|
|
||||||
def comments_count
|
def comments_count
|
||||||
comments.count
|
comments.count
|
||||||
@@ -164,10 +164,10 @@ class Budget
|
|||||||
results = results.winners if params[:advanced_filters].include?("winners")
|
results = results.winners if params[:advanced_filters].include?("winners")
|
||||||
|
|
||||||
ids = []
|
ids = []
|
||||||
ids += results.valuation_finished_feasible.pluck(:id) if params[:advanced_filters].include?("feasible")
|
ids += results.valuation_finished_feasible.ids if params[:advanced_filters].include?("feasible")
|
||||||
ids += results.where(selected: true).pluck(:id) if params[:advanced_filters].include?("selected")
|
ids += results.where(selected: true).ids if params[:advanced_filters].include?("selected")
|
||||||
ids += results.undecided.pluck(:id) if params[:advanced_filters].include?("undecided")
|
ids += results.undecided.ids if params[:advanced_filters].include?("undecided")
|
||||||
ids += results.unfeasible.pluck(:id) if params[:advanced_filters].include?("unfeasible")
|
ids += results.unfeasible.ids if params[:advanced_filters].include?("unfeasible")
|
||||||
results = results.where(id: ids) if ids.any?
|
results = results.where(id: ids) if ids.any?
|
||||||
results
|
results
|
||||||
end
|
end
|
||||||
@@ -191,8 +191,8 @@ class Budget
|
|||||||
return results if max_per_heading <= 0
|
return results if max_per_heading <= 0
|
||||||
|
|
||||||
ids = []
|
ids = []
|
||||||
budget.headings.pluck(:id).each do |hid|
|
budget.headings.ids.each do |hid|
|
||||||
ids += Investment.where(heading_id: hid).order(confidence_score: :desc).limit(max_per_heading).pluck(:id)
|
ids += Investment.where(heading_id: hid).order(confidence_score: :desc).limit(max_per_heading).ids
|
||||||
end
|
end
|
||||||
|
|
||||||
results.where(id: ids)
|
results.where(id: ids)
|
||||||
|
|||||||
@@ -32,10 +32,8 @@ class Comment < ApplicationRecord
|
|||||||
before_save :calculate_confidence_score
|
before_save :calculate_confidence_score
|
||||||
|
|
||||||
scope :for_render, -> { with_hidden.includes(user: :organization) }
|
scope :for_render, -> { with_hidden.includes(user: :organization) }
|
||||||
scope :with_visible_author, -> { joins(:user).where("users.hidden_at IS NULL") }
|
scope :with_visible_author, -> { joins(:user).where(users: { hidden_at: nil }) }
|
||||||
scope :not_as_admin_or_moderator, -> do
|
scope :not_as_admin_or_moderator, -> { where(administrator_id: nil).where(moderator_id: nil) }
|
||||||
where("administrator_id IS NULL").where("moderator_id IS NULL")
|
|
||||||
end
|
|
||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :public_for_api, -> do
|
scope :public_for_api, -> do
|
||||||
not_valuations
|
not_valuations
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module Followable
|
|||||||
has_many :followers, through: :follows, source: :user
|
has_many :followers, through: :follows, source: :user
|
||||||
|
|
||||||
scope :followed_by_user, ->(user) {
|
scope :followed_by_user, ->(user) {
|
||||||
joins(:follows).where("follows.user_id = ?", user.id)
|
joins(:follows).where(follows: { user_id: user.id })
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module Randomizable
|
|||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
def sort_by_random(seed = rand(10_000_000))
|
def sort_by_random(seed = rand(10_000_000))
|
||||||
ids = order(:id).pluck(:id).shuffle(random: Random.new(seed))
|
ids = order(:id).ids.shuffle(random: Random.new(seed))
|
||||||
|
|
||||||
return all if ids.empty?
|
return all if ids.empty?
|
||||||
|
|
||||||
|
|||||||
@@ -86,10 +86,7 @@ class Dashboard::Action < ApplicationRecord
|
|||||||
actions_for_today = get_actions_for_today(proposal)
|
actions_for_today = get_actions_for_today(proposal)
|
||||||
actions_for_date = get_actions_for_date(proposal, date)
|
actions_for_date = get_actions_for_date(proposal, date)
|
||||||
|
|
||||||
actions_for_today_ids = actions_for_today.pluck(:id)
|
actions_for_today.ids - actions_for_date.ids
|
||||||
actions_for_date_ids = actions_for_date.pluck(:id)
|
|
||||||
|
|
||||||
actions_for_today_ids - actions_for_date_ids
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Debate < ApplicationRecord
|
|||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :sort_by_recommendations, -> { order(cached_votes_total: :desc) }
|
scope :sort_by_recommendations, -> { order(cached_votes_total: :desc) }
|
||||||
scope :last_week, -> { where("created_at >= ?", 7.days.ago) }
|
scope :last_week, -> { where("created_at >= ?", 7.days.ago) }
|
||||||
scope :featured, -> { where("featured_at is not null") }
|
scope :featured, -> { where.not(featured_at: nil) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
|
|
||||||
# Ahoy setup
|
# Ahoy setup
|
||||||
@@ -58,8 +58,7 @@ class Debate < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.recommendations(user)
|
def self.recommendations(user)
|
||||||
tagged_with(user.interests, any: true)
|
tagged_with(user.interests, any: true).where.not(author_id: user.id)
|
||||||
.where("author_id != ?", user.id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def searchable_translations_definitions
|
def searchable_translations_definitions
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ class Legislation::Question < ApplicationRecord
|
|||||||
scope :sorted, -> { order("id ASC") }
|
scope :sorted, -> { order("id ASC") }
|
||||||
|
|
||||||
def next_question_id
|
def next_question_id
|
||||||
@next_question_id ||= process.questions.where("id > ?", id).sorted.limit(1).pluck(:id).first
|
@next_question_id ||= process.questions.where("id > ?", id).sorted.limit(1).ids.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def first_question_id
|
def first_question_id
|
||||||
@first_question_id ||= process.questions.sorted.limit(1).pluck(:id).first
|
@first_question_id ||= process.questions.sorted.limit(1).ids.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def answer_for_user(user)
|
def answer_for_user(user)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Milestone < ApplicationRecord
|
|||||||
|
|
||||||
scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) }
|
scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) }
|
||||||
scope :published, -> { where("publication_date <= ?", Date.current.end_of_day) }
|
scope :published, -> { where("publication_date <= ?", Date.current.end_of_day) }
|
||||||
scope :with_status, -> { where("status_id IS NOT NULL") }
|
scope :with_status, -> { where.not(status_id: nil) }
|
||||||
|
|
||||||
def self.title_max_length
|
def self.title_max_length
|
||||||
80
|
80
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Poll < ApplicationRecord
|
|||||||
scope :current, -> { where("starts_at <= ? and ? <= ends_at", Date.current.beginning_of_day, Date.current.beginning_of_day) }
|
scope :current, -> { where("starts_at <= ? and ? <= ends_at", Date.current.beginning_of_day, Date.current.beginning_of_day) }
|
||||||
scope :expired, -> { where("ends_at < ?", Date.current.beginning_of_day) }
|
scope :expired, -> { where("ends_at < ?", Date.current.beginning_of_day) }
|
||||||
scope :recounting, -> { where(ends_at: (Date.current.beginning_of_day - RECOUNT_DURATION)..Date.current.beginning_of_day) }
|
scope :recounting, -> { where(ends_at: (Date.current.beginning_of_day - RECOUNT_DURATION)..Date.current.beginning_of_day) }
|
||||||
scope :published, -> { where("published = ?", true) }
|
scope :published, -> { where(published: true) }
|
||||||
scope :by_geozone_id, ->(geozone_id) { where(geozones: { id: geozone_id }.joins(:geozones)) }
|
scope :by_geozone_id, ->(geozone_id) { where(geozones: { id: geozone_id }.joins(:geozones)) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
scope :not_budget, -> { where(budget_id: nil) }
|
scope :not_budget, -> { where(budget_id: nil) }
|
||||||
@@ -122,7 +122,7 @@ class Poll < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.not_voted_by(user)
|
def self.not_voted_by(user)
|
||||||
where("polls.id not in (?)", poll_ids_voted_by(user))
|
where.not(id: poll_ids_voted_by(user))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.poll_ids_voted_by(user)
|
def self.poll_ids_voted_by(user)
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class Proposal < ApplicationRecord
|
|||||||
|
|
||||||
def self.recommendations(user)
|
def self.recommendations(user)
|
||||||
tagged_with(user.interests, any: true)
|
tagged_with(user.interests, any: true)
|
||||||
.where("author_id != ?", user.id)
|
.where.not(author_id: user.id)
|
||||||
.unsuccessful
|
.unsuccessful
|
||||||
.not_followed_by_user(user)
|
.not_followed_by_user(user)
|
||||||
.not_archived
|
.not_archived
|
||||||
@@ -114,7 +114,7 @@ class Proposal < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.not_followed_by_user(user)
|
def self.not_followed_by_user(user)
|
||||||
where.not(id: followed_by_user(user).pluck(:id))
|
where.not(id: followed_by_user(user).ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ class User < ApplicationRecord
|
|||||||
Comment.hide_all comment_ids
|
Comment.hide_all comment_ids
|
||||||
Proposal.hide_all proposal_ids
|
Proposal.hide_all proposal_ids
|
||||||
Budget::Investment.hide_all budget_investment_ids
|
Budget::Investment.hide_all budget_investment_ids
|
||||||
ProposalNotification.hide_all ProposalNotification.where(author_id: id).pluck(:id)
|
ProposalNotification.hide_all ProposalNotification.where(author_id: id).ids
|
||||||
end
|
end
|
||||||
|
|
||||||
def full_restore
|
def full_restore
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Verification::Management::ManagedUser
|
|||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
def self.find(document_type, document_number)
|
def self.find(document_type, document_number)
|
||||||
User.where("document_number is not null").
|
User.where.not(document_number: nil).
|
||||||
find_or_initialize_by(document_type: document_type,
|
find_or_initialize_by(document_type: document_type,
|
||||||
document_number: document_number)
|
document_number: document_number)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
section "Flagging Debates & Comments" do
|
section "Flagging Debates & Comments" do
|
||||||
40.times do
|
40.times do
|
||||||
debate = Debate.all.sample
|
debate = Debate.all.sample
|
||||||
flagger = User.where(["users.id <> ?", debate.author_id]).all.sample
|
flagger = User.where.not(id: debate.author_id).all.sample
|
||||||
Flag.flag(flagger, debate)
|
Flag.flag(flagger, debate)
|
||||||
end
|
end
|
||||||
|
|
||||||
40.times do
|
40.times do
|
||||||
comment = Comment.all.sample
|
comment = Comment.all.sample
|
||||||
flagger = User.where(["users.id <> ?", comment.user_id]).all.sample
|
flagger = User.where.not(id: comment.user_id).all.sample
|
||||||
Flag.flag(flagger, comment)
|
Flag.flag(flagger, comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
40.times do
|
40.times do
|
||||||
proposal = Proposal.all.sample
|
proposal = Proposal.all.sample
|
||||||
flagger = User.where(["users.id <> ?", proposal.author_id]).all.sample
|
flagger = User.where.not(id: proposal.author_id).all.sample
|
||||||
Flag.flag(flagger, proposal)
|
Flag.flag(flagger, proposal)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class AddPollShiftTaskIndex < ActiveRecord::Migration[4.2]
|
class AddPollShiftTaskIndex < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
remove_index "poll_shifts", name: "index_poll_shifts_on_booth_id_and_officer_id"
|
remove_index "poll_shifts", column: [:booth_id, :officer_id]
|
||||||
add_index :poll_shifts, :task
|
add_index :poll_shifts, :task
|
||||||
add_index :poll_shifts, [:booth_id, :officer_id, :task], unique: true
|
add_index :poll_shifts, [:booth_id, :officer_id, :task], unique: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class RemoveOfficerAssigmentComposedIndex < ActiveRecord::Migration[4.2]
|
class RemoveOfficerAssigmentComposedIndex < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
remove_index "poll_officer_assignments", name: "index_poll_officer_assignments_on_officer_id_and_date"
|
remove_index "poll_officer_assignments", column: [:officer_id, :date]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class AddDateToPollShiftComposedIndex < ActiveRecord::Migration[4.2]
|
class AddDateToPollShiftComposedIndex < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
remove_index "poll_shifts", name: "index_poll_shifts_on_booth_id_and_officer_id_and_task"
|
remove_index "poll_shifts", column: [:booth_id, :officer_id, :task]
|
||||||
remove_index "poll_shifts", name: "index_poll_shifts_on_task"
|
remove_index "poll_shifts", :task
|
||||||
add_index :poll_shifts, [:booth_id, :officer_id, :date, :task], unique: true
|
add_index :poll_shifts, [:booth_id, :officer_id, :date, :task], unique: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class AddConfigToDownloadSettings < ActiveRecord::Migration[4.2]
|
|||||||
def change
|
def change
|
||||||
add_column :download_settings, :config, :integer, default: 0, null: false
|
add_column :download_settings, :config, :integer, default: 0, null: false
|
||||||
|
|
||||||
remove_index :download_settings, name: "index_download_settings_on_name_model_and_name_field"
|
remove_index :download_settings, column: [:name_model, :name_field]
|
||||||
add_index :download_settings, [:name_model, :name_field, :config], unique: true
|
add_index :download_settings, [:name_model, :name_field, :config], unique: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user