diff --git a/Gemfile b/Gemfile index c44b24cc9..c7b49ad24 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "4.2.11.1" +gem "rails", "5.0.7.2" gem "acts-as-taggable-on", "~> 5.0.0" gem "acts_as_votable", "~> 0.11.1" @@ -15,11 +15,13 @@ gem "coffee-rails", "~> 4.2.2" gem "daemons", "~> 1.2.4" gem "dalli", "~> 2.7.6" gem "delayed_job_active_record", "~> 4.1.3" -gem "devise", "~> 3.5.7" -gem "devise-async", "~> 0.10.2" -gem "devise_security_extension", "~> 0.10.0" +gem "devise", "~> 4.6.0" +gem "devise-async", "~> 1.0.0" +gem "devise_security_extension", git: "https://github.com/phatworx/devise_security_extension.git" #, "~> 0.10" gem "foundation-rails", "~> 6.4.3.0" gem "foundation_rails_helper", "~> 2.0.0" +gem "globalize", "~> 5.2.0" +gem "globalize-accessors", "~> 0.2.1" gem "graphiql-rails", "~> 1.4.1" gem "graphql", "~> 1.7.8" gem "groupdate", "~> 3.2.0" @@ -38,6 +40,7 @@ gem "paperclip", "~> 5.2.1" gem "paranoia", "~> 2.4.1" gem "pg", "~> 0.21.0" gem "pg_search", "~> 2.0.1" +gem "record_tag_helper", "~> 1.0" gem "redcarpet", "~> 3.4.0" gem "responders", "~> 2.4.0" gem "rinku", "~> 2.0.2", require: "rails_rinku" @@ -52,8 +55,6 @@ gem "turnout", "~> 2.4.0" gem "uglifier", "~> 4.1.19" gem "unicorn", "~> 5.4.1" gem "whenever", "~> 0.10.0", require: false -gem "globalize", "~> 5.0.0" -gem "globalize-accessors", "~> 0.2.1" gem "recipient_interceptor", "~> 0.2.0" source "https://rails-assets.org" do @@ -70,7 +71,6 @@ group :development, :test do gem "knapsack_pro", "~> 1.1.0" gem "launchy", "~> 2.4.3" gem "letter_opener_web", "~> 1.3.4" - gem "quiet_assets", "~> 1.1.0" gem "spring", "~> 2.0.1" gem "spring-commands-rspec", "~> 1.0.4" end @@ -81,7 +81,7 @@ group :test do gem "database_cleaner", "~> 1.7.0" gem "email_spec", "~> 2.1.0" gem "rspec-rails", "~> 3.8" - gem "selenium-webdriver", "~> 3.10" + gem "selenium-webdriver", "~> 3.141" end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 07fdf7c89..c54bde921 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,40 +1,51 @@ +GIT + remote: https://github.com/phatworx/devise_security_extension.git + revision: b2ee978af7d49f0fb0e7271c6ac074dfb4d39353 + specs: + devise_security_extension (0.10.0) + devise (>= 3.0.0, < 5.0) + railties (>= 3.2.6, < 6.0) + GEM remote: https://rubygems.org/ remote: https://rails-assets.org/ specs: - actionmailer (4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.1) - actionview (= 4.2.11.1) - activesupport (= 4.2.11.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.1) - activesupport (= 4.2.11.1) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.11.1) - activesupport (= 4.2.11.1) - globalid (>= 0.3.0) - activemodel (4.2.11.1) - activesupport (= 4.2.11.1) - builder (~> 3.1) - activerecord (4.2.11.1) - activemodel (= 4.2.11.1) - activesupport (= 4.2.11.1) - arel (~> 6.0) - activesupport (4.2.11.1) - i18n (~> 0.7) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) + globalid (>= 0.3.6) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) + arel (~> 7.0) + activesupport (5.0.7.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) acts-as-taggable-on (5.0.0) activerecord (>= 4.2.8) @@ -59,7 +70,7 @@ GEM nokogiri ancestry (3.0.2) activerecord (>= 3.2.0) - arel (6.0.4) + arel (7.1.4) ast (2.4.0) autoprefixer-rails (8.2.0) execjs @@ -67,7 +78,7 @@ GEM babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) - bcrypt (3.1.11) + bcrypt (3.1.12) better_html (1.0.13) actionview (>= 4.0) activesupport (>= 4.0) @@ -104,7 +115,7 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - childprocess (0.8.0) + childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) chronic (0.10.2) ckeditor (4.2.4) @@ -138,18 +149,15 @@ GEM delayed_job_active_record (4.1.3) activerecord (>= 3.0, < 5.3) delayed_job (>= 3.0, < 5) - devise (3.5.10) + devise (4.6.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0, < 6.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) - devise-async (0.10.2) - devise (>= 3.2, < 4.0) - devise_security_extension (0.10.0) - devise (>= 3.0.0, < 4.0) - railties (>= 3.2.6, < 5.0) + devise-async (1.0.0) + activejob (>= 5.0) + devise (>= 4.0) diff-lcs (1.3) docile (1.3.1) email_spec (2.1.1) @@ -174,9 +182,9 @@ GEM railties (>= 3.0.0) faker (1.8.7) i18n (>= 0.7) - faraday (0.12.1) + faraday (0.12.2) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ffi (1.10.0) foundation-rails (6.4.3.0) railties (>= 3.1.0) sass (>= 3.3.0, < 3.5) @@ -187,12 +195,13 @@ GEM activesupport (>= 4.1) railties (>= 4.1) tzinfo (~> 1.2, >= 1.2.2) - geocoder (1.4.4) + geocoder (1.4.5) globalid (0.4.2) activesupport (>= 4.2.0) - globalize (5.0.1) - activemodel (>= 4.2.0, < 4.3) - activerecord (>= 4.2.0, < 4.3) + globalize (5.2.0) + activemodel (>= 4.2, < 5.3) + activerecord (>= 4.2, < 5.3) + request_store (~> 1.0) globalize-accessors (0.2.1) globalize (~> 5.0, >= 5.0.0) graphiql-rails (1.4.8) @@ -269,6 +278,7 @@ GEM kramdown (~> 1.12, >= 1.12.0) mixlib-cli (~> 1.7, >= 1.7.0) mixlib-config (~> 2.2, >= 2.2.1) + method_source (0.9.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) @@ -286,10 +296,11 @@ GEM net-ssh (>= 2.6.5) net-ssh (5.0.2) newrelic_rpm (4.1.0.333) - nokogiri (1.10.1) + nio4r (2.3.1) + nokogiri (1.10.2) mini_portile2 (~> 2.4.0) nori (2.6.0) - oauth (0.5.3) + oauth (0.5.4) oauth2 (1.4.0) faraday (>= 0.8, < 0.13) jwt (~> 1.0) @@ -309,8 +320,8 @@ GEM omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.4.0) - oauth2 (~> 1.0) + omniauth-oauth2 (1.5.0) + oauth2 (~> 1.1) omniauth (~> 1.2) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) @@ -334,39 +345,36 @@ GEM arel (>= 6) powerpack (0.1.2) public_suffix (3.0.3) - quiet_assets (1.1.0) - railties (>= 3.1, < 5.0) - rack (1.6.11) + rack (2.0.6) rack-accept (0.4.5) rack (>= 0.4) rack-attack (5.0.1) rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.11.1) - actionmailer (= 4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - activemodel (= 4.2.11.1) - activerecord (= 4.2.11.1) - activesupport (= 4.2.11.1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.1) - sprockets-rails - rails-assets-leaflet (1.1.0) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) + bundler (>= 1.3.0) + railties (= 5.0.7.2) + sprockets-rails (>= 2.0.0) + rails-assets-leaflet (1.2.0) rails-assets-markdown-it (8.2.2) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (4.2.11.1) - actionpack (= 4.2.11.1) - activesupport (= 4.2.11.1) + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) @@ -374,12 +382,15 @@ GEM rake (12.3.2) recipient_interceptor (0.2.0) mail + record_tag_helper (1.0.0) + actionview (~> 5.x) redcarpet (3.4.0) referer-parser (0.3.0) - request_store (1.3.2) - responders (2.4.0) - actionpack (>= 4.2.0, < 5.3) - railties (>= 4.2.0, < 5.3) + request_store (1.4.0) + rack (>= 1.4) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) rinku (2.0.4) rollbar (2.18.0) multi_json @@ -391,7 +402,7 @@ GEM rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-rails (3.8.1) + rspec-rails (3.8.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -434,9 +445,9 @@ GEM scss_lint (0.55.0) rake (>= 0.9, < 13) sass (~> 3.4.20) - selenium-webdriver (3.10.0) + selenium-webdriver (3.141.0) childprocess (~> 0.5) - rubyzip (~> 1.2) + rubyzip (~> 1.2, >= 1.2.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -475,9 +486,9 @@ GEM tilt (2.0.8) tins (1.16.3) tomlrb (1.2.7) - turbolinks (2.5.3) + turbolinks (2.5.4) coffee-rails - turnout (2.4.0) + turnout (2.4.1) i18n (~> 0.7) rack (>= 1.3, < 3) rack-accept (~> 0.4) @@ -491,10 +502,10 @@ GEM kgio (~> 2.6) raindrops (~> 0.7) uniform_notifier (1.11.0) - user_agent_parser (2.3.1) + user_agent_parser (2.4.1) uuidtools (2.1.5) - warden (1.2.7) - rack (>= 1.0) + warden (1.2.8) + rack (>= 2.0.6) wasabi (3.5.0) httpi (~> 2.0) nokogiri (>= 1.4.2) @@ -502,6 +513,9 @@ GEM activemodel (>= 4.2) debug_inspector railties (>= 4.2) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) whenever (0.10.0) chronic (>= 0.6.3) xpath (3.0.0) @@ -533,16 +547,16 @@ DEPENDENCIES dalli (~> 2.7.6) database_cleaner (~> 1.7.0) delayed_job_active_record (~> 4.1.3) - devise (~> 3.5.7) - devise-async (~> 0.10.2) - devise_security_extension (~> 0.10.0) + devise (~> 4.6.0) + devise-async (~> 1.0.0) + devise_security_extension! email_spec (~> 2.1.0) erb_lint factory_bot_rails (~> 4.8.2) faker (~> 1.8.7) foundation-rails (~> 6.4.3.0) foundation_rails_helper (~> 2.0.0) - globalize (~> 5.0.0) + globalize (~> 5.2.0) globalize-accessors (~> 0.2.1) graphiql-rails (~> 1.4.1) graphql (~> 1.7.8) @@ -567,11 +581,11 @@ DEPENDENCIES paranoia (~> 2.4.1) pg (~> 0.21.0) pg_search (~> 2.0.1) - quiet_assets (~> 1.1.0) - rails (= 4.2.11.1) + rails (= 5.0.7.2) rails-assets-leaflet! rails-assets-markdown-it (~> 8.2.1)! recipient_interceptor (~> 0.2.0) + record_tag_helper (~> 1.0) redcarpet (~> 3.4.0) responders (~> 2.4.0) rinku (~> 2.0.2) @@ -583,7 +597,7 @@ DEPENDENCIES sass-rails (~> 5.0, >= 5.0.4) savon (~> 2.12.0) scss_lint (~> 0.55.0) - selenium-webdriver (~> 3.10) + selenium-webdriver (~> 3.141) sitemap_generator (~> 6.0.1) social-share-button (~> 1.1) spring (~> 2.0.1) diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index a451d67a5..156d74f34 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -39,7 +39,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController if @investment.update(budget_investment_params) redirect_to admin_budget_budget_investment_path(@budget, @investment, - Budget::Investment.filter_params(params)), + Budget::Investment.filter_params(params).to_h), notice: t("flash.actions.update.budget_investment") else load_admins @@ -69,7 +69,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController end def resource_name - resource_model.parameterize("_") + resource_model.parameterize(separator: "_") end def load_investments @@ -107,7 +107,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController end def load_tags - @tags = Budget::Investment.tags_on(:valuation).order(:name).uniq + @tags = Budget::Investment.tags_on(:valuation).order(:name).distinct end def load_ballot diff --git a/app/controllers/admin/legislation/homepages_controller.rb b/app/controllers/admin/legislation/homepages_controller.rb index 6b2084448..72ff890e9 100644 --- a/app/controllers/admin/legislation/homepages_controller.rb +++ b/app/controllers/admin/legislation/homepages_controller.rb @@ -9,7 +9,8 @@ class Admin::Legislation::HomepagesController < Admin::Legislation::BaseControll def update if @process.update(process_params) link = legislation_process_path(@process).html_safe - redirect_to :back, notice: t("admin.legislation.processes.update.notice", link: link) + redirect_back(fallback_location: (request.referrer || root_path), + notice: t("admin.legislation.processes.update.notice", link: link)) else flash.now[:error] = t("admin.legislation.processes.update.error") render :edit diff --git a/app/controllers/admin/legislation/processes_controller.rb b/app/controllers/admin/legislation/processes_controller.rb index 6c0d2ea6f..f0b9c6de3 100644 --- a/app/controllers/admin/legislation/processes_controller.rb +++ b/app/controllers/admin/legislation/processes_controller.rb @@ -27,7 +27,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll set_tag_list link = legislation_process_path(@process).html_safe - redirect_to :back, notice: t("admin.legislation.processes.update.notice", link: link) + redirect_back(fallback_location: (request.referrer || root_path), + notice: t("admin.legislation.processes.update.notice", link: link)) else flash.now[:error] = t("admin.legislation.processes.update.error") render :edit diff --git a/app/controllers/admin/poll/polls_controller.rb b/app/controllers/admin/poll/polls_controller.rb index 04a94cce3..a543093b2 100644 --- a/app/controllers/admin/poll/polls_controller.rb +++ b/app/controllers/admin/poll/polls_controller.rb @@ -11,9 +11,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController end def show - @poll = Poll.includes(:questions). - order("poll_questions.title"). - find(params[:id]) + @poll = Poll.find(params[:id]) end def new @@ -67,6 +65,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController end def poll_params + image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :results_enabled, :stats_enabled, :budget_id, geozone_ids: [], image_attributes: image_attributes] diff --git a/app/controllers/admin/poll/questions/answers/videos_controller.rb b/app/controllers/admin/poll/questions/answers/videos_controller.rb index e9262b6dd..7628ab081 100644 --- a/app/controllers/admin/poll/questions/answers/videos_controller.rb +++ b/app/controllers/admin/poll/questions/answers/videos_controller.rb @@ -38,7 +38,7 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr else t("flash.actions.destroy.error") end - redirect_to :back, notice: notice + redirect_back(fallback_location: (request.referrer || root_path), notice: notice) end private diff --git a/app/controllers/admin/site_customization/information_texts_controller.rb b/app/controllers/admin/site_customization/information_texts_controller.rb index 277ec91a6..85e765cb4 100644 --- a/app/controllers/admin/site_customization/information_texts_controller.rb +++ b/app/controllers/admin/site_customization/information_texts_controller.rb @@ -46,7 +46,7 @@ class Admin::SiteCustomization::InformationTextsController < Admin::SiteCustomiz .keys languages_to_delete.each do |locale| - I18nContentTranslation.destroy_all(locale: locale) + I18nContentTranslation.where(locale: locale).destroy_all end end diff --git a/app/controllers/admin/spending_proposals_controller.rb b/app/controllers/admin/spending_proposals_controller.rb index 899a32486..4ef96a3c0 100644 --- a/app/controllers/admin/spending_proposals_controller.rb +++ b/app/controllers/admin/spending_proposals_controller.rb @@ -1,5 +1,6 @@ class Admin::SpendingProposalsController < Admin::BaseController include FeatureFlags + before_action :load_filter_params feature_flag :spending_proposals has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index @@ -7,7 +8,7 @@ class Admin::SpendingProposalsController < Admin::BaseController load_and_authorize_resource def index - @spending_proposals = SpendingProposal.scoped_filter(params, @current_filter) + @spending_proposals = SpendingProposal.scoped_filter(filter_params, @current_filter) .order(cached_votes_up: :desc, created_at: :desc) .page(params[:page]) end @@ -23,7 +24,7 @@ class Admin::SpendingProposalsController < Admin::BaseController def update if @spending_proposal.update(spending_proposal_params) - redirect_to admin_spending_proposal_path(@spending_proposal, SpendingProposal.filter_params(params)), + redirect_to admin_spending_proposal_path(@spending_proposal, filter_params), notice: t("flash.actions.update.spending_proposal") else load_admins @@ -46,6 +47,14 @@ class Admin::SpendingProposalsController < Admin::BaseController :administrator_id, :tag_list, valuator_ids: []) end + def filter_params + params.permit(:geozone_id, :administrator_id, :tag_name, :valuator_id) + end + + def load_filter_params + @filter_params ||= filter_params + end + def load_admins @admins = Administrator.includes(:user).all end diff --git a/app/controllers/admin/widget/feeds_controller.rb b/app/controllers/admin/widget/feeds_controller.rb index ab4a5a474..2becdf28a 100644 --- a/app/controllers/admin/widget/feeds_controller.rb +++ b/app/controllers/admin/widget/feeds_controller.rb @@ -4,7 +4,7 @@ class Admin::Widget::FeedsController < Admin::BaseController @feed = ::Widget::Feed.find(params[:id]) @feed.update(feed_params) - render nothing: true + head :ok end private @@ -13,4 +13,4 @@ class Admin::Widget::FeedsController < Admin::BaseController params.require(:widget_feed).permit(:limit) end -end \ No newline at end of file +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5df842899..38ce20f34 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base before_action :set_locale before_action :track_email_campaign before_action :set_return_url + before_action :set_fallbacks_to_all_available_locales check_authorization unless: :devise_controller? self.responder = ApplicationResponder @@ -128,4 +129,8 @@ class ApplicationController < ActionController::Base def current_budget Budget.current end + + def set_fallbacks_to_all_available_locales + Globalize.set_fallbacks_to_all_available_locales + end end diff --git a/app/controllers/budgets/executions_controller.rb b/app/controllers/budgets/executions_controller.rb index 54decebee..0d4c25134 100644 --- a/app/controllers/budgets/executions_controller.rb +++ b/app/controllers/budgets/executions_controller.rb @@ -19,7 +19,7 @@ module Budgets .group_by(&:heading) else @budget.investments.winners - .joins(:milestones).includes(:milestones) + .joins(milestones: :translations) .distinct.group_by(&:heading) end end diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb index 05f0e8f96..78185b5b4 100644 --- a/app/controllers/follows_controller.rb +++ b/app/controllers/follows_controller.rb @@ -22,7 +22,7 @@ class FollowsController < ApplicationController end def followable_translation_key(followable) - followable.class.name.parameterize("_") + followable.class.name.parameterize(separator: "_") end end diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index 587a9578e..a25248032 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -1,4 +1,4 @@ -class Legislation::AnnotationsController < ApplicationController +class Legislation::AnnotationsController < Legislation::BaseController skip_before_action :verify_authenticity_token before_action :authenticate_user!, only: [:create, :new_comment] diff --git a/app/controllers/management/document_verifications_controller.rb b/app/controllers/management/document_verifications_controller.rb index 1b3abc398..cb7ff1d7e 100644 --- a/app/controllers/management/document_verifications_controller.rb +++ b/app/controllers/management/document_verifications_controller.rb @@ -16,7 +16,7 @@ class Management::DocumentVerificationsController < Management::BaseController elsif @document_verification.user? render :new elsif @document_verification.in_census? - redirect_to new_management_email_verification_path(email_verification: document_verification_params) + redirect_to new_management_email_verification_path(email_verification: document_verification_params.to_h) else render :invalid_document end diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index 5f67aa506..7a063e82e 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -17,7 +17,7 @@ class Management::UsersController < Management::BaseController @user.residence_verified_at = Time.current @user.verified_at = Time.current - if @user.save then + if @user.save render :show else render :new diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 652a9eaae..5fab93a0f 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -11,7 +11,7 @@ class PollsController < ApplicationController ::Poll::Answer # trigger autoload def index - @polls = @polls.not_budget.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page]) + @polls = @polls.not_budget.send(@current_filter).sort_for_list.page(params[:page]) end def show diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 0e0f741a3..67edc4e26 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -25,7 +25,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def sign_in_with(feature, provider) raise ActionController::RoutingError.new("Not Found") unless Setting["feature.#{feature}"] - auth = env["omniauth.auth"] + auth = request.env["omniauth.auth"] identity = Identity.first_or_create_from_oauth(auth) @user = current_user || identity.user || User.first_or_initialize_for_oauth(auth) diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index a63945342..0270b36c7 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,6 +1,6 @@ class Users::RegistrationsController < Devise::RegistrationsController prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy, :finish_signup, :do_finish_signup] - before_filter :configure_permitted_parameters + before_action :configure_permitted_parameters invisible_captcha only: [:create], honeypot: :address, scope: :user @@ -66,7 +66,7 @@ class Users::RegistrationsController < Devise::RegistrationsController end def configure_permitted_parameters - devise_parameter_sanitizer.for(:account_update).push(:email) + devise_parameter_sanitizer.permit(:account_update, keys: [:email]) end def erase_params diff --git a/app/controllers/valuation/budget_investments_controller.rb b/app/controllers/valuation/budget_investments_controller.rb index 2ee531f27..aa29120f1 100644 --- a/app/controllers/valuation/budget_investments_controller.rb +++ b/app/controllers/valuation/budget_investments_controller.rb @@ -61,7 +61,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController end def resource_name - resource_model.parameterize("_") + resource_model.parameterize(separator: "_") end def load_budget @@ -97,8 +97,8 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController end def params_for_current_valuator - Budget::Investment.filter_params(params).merge(valuator_id: current_user.valuator.id, - budget_id: @budget.id) + Budget::Investment.filter_params(params).to_h.merge({ valuator_id: current_user.valuator.id, + budget_id: @budget.id }) end def valuation_params diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index e4a47557b..15fdc91a8 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -12,7 +12,8 @@ module BudgetsHelper end def csv_params - csv_params = params.clone.merge(format: :csv).symbolize_keys + csv_params = params.clone.merge(format: :csv) + csv_params = csv_params.to_unsafe_h.map { |k, v| [k.to_sym, v] }.to_h csv_params.delete(:page) csv_params end diff --git a/app/helpers/documentables_helper.rb b/app/helpers/documentables_helper.rb index b17278019..ef1a2d6b9 100644 --- a/app/helpers/documentables_helper.rb +++ b/app/helpers/documentables_helper.rb @@ -1,7 +1,7 @@ module DocumentablesHelper def documentable_class(documentable) - documentable.class.name.parameterize("_") + documentable.class.name.parameterize(separator: "_") end def max_documents_allowed(documentable) diff --git a/app/helpers/followables_helper.rb b/app/helpers/followables_helper.rb index 5641a33bc..bf6cbd8f6 100644 --- a/app/helpers/followables_helper.rb +++ b/app/helpers/followables_helper.rb @@ -22,7 +22,7 @@ module FollowablesHelper end def followable_class_name(followable) - followable.class.to_s.parameterize("_") + followable.class.to_s.parameterize(separator: "_") end def find_or_build_follow(user, followable) diff --git a/app/helpers/globalize_helper.rb b/app/helpers/globalize_helper.rb index 575e81c8e..92d02b63e 100644 --- a/app/helpers/globalize_helper.rb +++ b/app/helpers/globalize_helper.rb @@ -12,7 +12,7 @@ module GlobalizeHelper def display_translation?(resource, locale) if !resource || resource.translations.blank? || - resource.translations.map(&:locale).include?(I18n.locale) + resource.locales_not_marked_for_destruction.include?(I18n.locale) locale == I18n.locale else locale == resource.translations.first.locale diff --git a/app/helpers/imageables_helper.rb b/app/helpers/imageables_helper.rb index 768578f75..1a85362d8 100644 --- a/app/helpers/imageables_helper.rb +++ b/app/helpers/imageables_helper.rb @@ -5,7 +5,7 @@ module ImageablesHelper end def imageable_class(imageable) - imageable.class.name.parameterize("_") + imageable.class.name.parameterize(separator: "_") end def imageable_max_file_size diff --git a/app/helpers/translatable_form_helper.rb b/app/helpers/translatable_form_helper.rb index 01b0dd2a7..a65221b79 100644 --- a/app/helpers/translatable_form_helper.rb +++ b/app/helpers/translatable_form_helper.rb @@ -6,7 +6,13 @@ module TranslatableFormHelper end class TranslatableFormBuilder < FoundationRailsHelper::FormBuilder + attr_accessor :translations + def translatable_fields(&block) + @translations = {} + @object.globalize_locales.map do |locale| + @translations[locale] = translation_for(locale) + end @object.globalize_locales.map do |locale| Globalize.with_locale(locale) { fields_for_locale(locale, &block) } end.join.html_safe @@ -15,7 +21,7 @@ module TranslatableFormHelper private def fields_for_locale(locale, &block) - fields_for_translation(translation_for(locale)) do |translations_form| + fields_for_translation(@translations[locale]) do |translations_form| @template.content_tag :div, translations_options(translations_form.object, locale) do @template.concat translations_form.hidden_field( :_destroy, diff --git a/app/models/active_poll.rb b/app/models/active_poll.rb index 50e185ea5..040a33451 100644 --- a/app/models/active_poll.rb +++ b/app/models/active_poll.rb @@ -1,4 +1,4 @@ -class ActivePoll < ActiveRecord::Base +class ActivePoll < ApplicationRecord include Measurable translates :description, touch: true diff --git a/app/models/activity.rb b/app/models/activity.rb index b5f3e0281..ed617c97a 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -1,4 +1,4 @@ -class Activity < ActiveRecord::Base +class Activity < ApplicationRecord belongs_to :actionable, -> { with_hidden }, polymorphic: true belongs_to :user, -> { with_hidden } diff --git a/app/models/admin_notification.rb b/app/models/admin_notification.rb index 6fc3e83e3..5e86f3d28 100644 --- a/app/models/admin_notification.rb +++ b/app/models/admin_notification.rb @@ -1,4 +1,4 @@ -class AdminNotification < ActiveRecord::Base +class AdminNotification < ApplicationRecord include Notifiable translates :title, touch: true diff --git a/app/models/administrator.rb b/app/models/administrator.rb index 6cfafe8d9..b8b6cc1c0 100644 --- a/app/models/administrator.rb +++ b/app/models/administrator.rb @@ -1,4 +1,4 @@ -class Administrator < ActiveRecord::Base +class Administrator < ApplicationRecord belongs_to :user, touch: true delegate :name, :email, :name_and_email, to: :user diff --git a/app/models/ahoy/event.rb b/app/models/ahoy/event.rb index 2aac3c59c..ec7e9c57e 100644 --- a/app/models/ahoy/event.rb +++ b/app/models/ahoy/event.rb @@ -1,5 +1,5 @@ module Ahoy - class Event < ActiveRecord::Base + class Event < ApplicationRecord self.table_name = "ahoy_events" belongs_to :visit diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 000000000..10a4cba84 --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/banner.rb b/app/models/banner.rb index cc05b3970..9b8ce7b3c 100644 --- a/app/models/banner.rb +++ b/app/models/banner.rb @@ -1,4 +1,4 @@ -class Banner < ActiveRecord::Base +class Banner < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/banner/section.rb b/app/models/banner/section.rb index 493093731..5a09aaf36 100644 --- a/app/models/banner/section.rb +++ b/app/models/banner/section.rb @@ -1,4 +1,4 @@ -class Banner::Section < ActiveRecord::Base +class Banner::Section < ApplicationRecord belongs_to :banner belongs_to :web_section end diff --git a/app/models/budget.rb b/app/models/budget.rb index 28fb8c5ca..8c34e030d 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -1,4 +1,4 @@ -class Budget < ActiveRecord::Base +class Budget < ApplicationRecord include Measurable include Sluggable @@ -6,6 +6,18 @@ class Budget < ActiveRecord::Base translates :name, touch: true include Globalizable + class Translation + validate :name_uniqueness_by_budget + + def name_uniqueness_by_budget + if Budget.joins(:translations) + .where(name: name) + .where.not("budget_translations.budget_id": budget_id).any? + errors.add(:name, I18n.t("errors.messages.taken")) + end + end + end + CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze before_validation :assign_model_to_translations diff --git a/app/models/budget/ballot.rb b/app/models/budget/ballot.rb index b53e8b8e6..9539119b0 100644 --- a/app/models/budget/ballot.rb +++ b/app/models/budget/ballot.rb @@ -1,13 +1,13 @@ class Budget - class Ballot < ActiveRecord::Base + class Ballot < ApplicationRecord belongs_to :user belongs_to :budget belongs_to :poll_ballot, class_name: "Poll::Ballot" has_many :lines, dependent: :destroy has_many :investments, through: :lines - has_many :groups, -> { uniq }, through: :lines - has_many :headings, -> { uniq }, through: :groups + has_many :groups, -> { distinct }, through: :lines + has_many :headings, -> { distinct }, through: :groups def add_investment(investment) lines.create(investment: investment).persisted? diff --git a/app/models/budget/ballot/line.rb b/app/models/budget/ballot/line.rb index 2d75c1cd4..54b26f4b4 100644 --- a/app/models/budget/ballot/line.rb +++ b/app/models/budget/ballot/line.rb @@ -1,6 +1,6 @@ class Budget class Ballot - class Line < ActiveRecord::Base + class Line < ApplicationRecord belongs_to :ballot belongs_to :investment, counter_cache: :ballot_lines_count belongs_to :heading diff --git a/app/models/budget/content_block.rb b/app/models/budget/content_block.rb index bba830cec..ae3bf44e9 100644 --- a/app/models/budget/content_block.rb +++ b/app/models/budget/content_block.rb @@ -1,5 +1,5 @@ class Budget - class ContentBlock < ActiveRecord::Base + class ContentBlock < ApplicationRecord validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) } validates :heading, presence: true validates_uniqueness_of :heading, scope: :locale diff --git a/app/models/budget/group.rb b/app/models/budget/group.rb index 37d6e658b..d77c840c0 100644 --- a/app/models/budget/group.rb +++ b/app/models/budget/group.rb @@ -1,9 +1,22 @@ class Budget - class Group < ActiveRecord::Base + class Group < ApplicationRecord include Sluggable translates :name, touch: true include Globalizable + translation_class_delegate :budget + + class Translation + validate :name_uniqueness_by_budget + + def name_uniqueness_by_budget + if budget.groups.joins(:translations) + .where(name: name) + .where.not("budget_group_translations.budget_group_id": budget_group_id).any? + errors.add(:name, I18n.t("errors.messages.taken")) + end + end + end belongs_to :budget @@ -15,7 +28,7 @@ class Budget validates :budget_id, presence: true validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/ - scope :sort_by_name, -> { includes(:translations).order(:name) } + scope :sort_by_name, -> { joins(:translations).order(:name) } def single_heading_group? headings.count == 1 diff --git a/app/models/budget/group/translation.rb b/app/models/budget/group/translation.rb deleted file mode 100644 index 36489eb10..000000000 --- a/app/models/budget/group/translation.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Budget::Group::Translation < Globalize::ActiveRecord::Translation - delegate :budget, to: :globalized_model - - validate :name_uniqueness_by_budget - - def name_uniqueness_by_budget - if budget.groups.joins(:translations) - .where(name: name) - .where.not("budget_group_translations.budget_group_id": budget_group_id).any? - errors.add(:name, I18n.t("errors.messages.taken")) - end - end -end diff --git a/app/models/budget/heading.rb b/app/models/budget/heading.rb index ac9ac6492..0b94aac67 100644 --- a/app/models/budget/heading.rb +++ b/app/models/budget/heading.rb @@ -1,11 +1,25 @@ class Budget - class Heading < ActiveRecord::Base + class Heading < ApplicationRecord OSM_DISTRICT_LEVEL_ZOOM = 12.freeze include Sluggable translates :name, touch: true include Globalizable + translation_class_delegate :budget + + class Translation + validate :name_uniqueness_by_budget + + def name_uniqueness_by_budget + if budget.headings + .joins(:translations) + .where(name: name) + .where.not("budget_heading_translations.budget_heading_id": budget_heading_id).any? + errors.add(:name, I18n.t("errors.messages.taken")) + end + end + end belongs_to :group @@ -26,8 +40,8 @@ class Budget delegate :budget, :budget_id, to: :group, allow_nil: true - scope :i18n, -> { includes(:translations) } - scope :allow_custom_content, -> { i18n.where(allow_custom_content: true).order(:name) } + scope :i18n, -> { joins(:translations) } + scope :allow_custom_content, -> { i18n.where(allow_custom_content: true).order("budget_heading_translations.name") } def self.sort_by_name all.sort do |heading, other_heading| diff --git a/app/models/budget/heading/translation.rb b/app/models/budget/heading/translation.rb deleted file mode 100644 index 3cf930f66..000000000 --- a/app/models/budget/heading/translation.rb +++ /dev/null @@ -1,14 +0,0 @@ -class Budget::Heading::Translation < Globalize::ActiveRecord::Translation - delegate :budget, to: :globalized_model - - validate :name_uniqueness_by_budget - - def name_uniqueness_by_budget - if budget.headings - .joins(:translations) - .where(name: name) - .where.not("budget_heading_translations.budget_heading_id": budget_heading_id).any? - errors.add(:name, I18n.t("errors.messages.taken")) - end - end -end diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 3bf62613d..2eaf801c1 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -1,5 +1,5 @@ class Budget - class Investment < ActiveRecord::Base + class Investment < ApplicationRecord SORTING_OPTIONS = {id: "id", title: "title", supports: "cached_votes_up"}.freeze include Rails.application.routes.url_helpers @@ -109,7 +109,7 @@ class Budget end def self.filter_params(params) - params.select{ |x, _| %w{heading_id group_id administrator_id tag_name valuator_id}.include?(x.to_s) } + params.permit(%i[heading_id group_id administrator_id tag_name valuator_id]) end def self.scoped_filter(params, current_filter) @@ -368,7 +368,7 @@ class Budget end def self.with_milestone_status_id(status_id) - joins(:milestones).includes(:milestones).select do |investment| + includes(milestones: :translations).select do |investment| investment.milestone_status_id == status_id.to_i end end diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index cd877e0cc..5912a1453 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -1,5 +1,5 @@ class Budget - class Phase < ActiveRecord::Base + class Phase < ApplicationRecord PHASE_KINDS = %w(drafting informing accepting reviewing selecting valuating publishing_prices balloting reviewing_ballots finished).freeze PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze @@ -9,6 +9,7 @@ class Budget translates :summary, touch: true translates :description, touch: true include Globalizable + include Sanitizable belongs_to :budget belongs_to :next_phase, class_name: "Budget::Phase", foreign_key: :next_phase_id diff --git a/app/models/budget/phase/translation.rb b/app/models/budget/phase/translation.rb deleted file mode 100644 index 53390143a..000000000 --- a/app/models/budget/phase/translation.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Budget::Phase::Translation < Globalize::ActiveRecord::Translation - before_validation :sanitize_description - - private - - def sanitize_description - self.description = WYSIWYGSanitizer.new.sanitize(description) - end -end diff --git a/app/models/budget/reclassified_vote.rb b/app/models/budget/reclassified_vote.rb index 0eb44d8cc..3f11aa388 100644 --- a/app/models/budget/reclassified_vote.rb +++ b/app/models/budget/reclassified_vote.rb @@ -1,5 +1,5 @@ class Budget - class ReclassifiedVote < ActiveRecord::Base + class ReclassifiedVote < ApplicationRecord REASONS = %w(heading_changed unfeasible) belongs_to :user diff --git a/app/models/budget/translation.rb b/app/models/budget/translation.rb deleted file mode 100644 index 1f3d93ea1..000000000 --- a/app/models/budget/translation.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Budget::Translation < Globalize::ActiveRecord::Translation - validate :name_uniqueness_by_budget - - def name_uniqueness_by_budget - if Budget.joins(:translations) - .where(name: name) - .where.not("budget_translations.budget_id": budget_id).any? - errors.add(:name, I18n.t("errors.messages.taken")) - end - end -end diff --git a/app/models/budget/valuator_assignment.rb b/app/models/budget/valuator_assignment.rb index 18ef73812..9f60caf1e 100644 --- a/app/models/budget/valuator_assignment.rb +++ b/app/models/budget/valuator_assignment.rb @@ -1,5 +1,5 @@ class Budget - class ValuatorAssignment < ActiveRecord::Base + class ValuatorAssignment < ApplicationRecord belongs_to :valuator, counter_cache: :budget_investments_count belongs_to :investment, counter_cache: true end diff --git a/app/models/budget/valuator_group_assignment.rb b/app/models/budget/valuator_group_assignment.rb index 88a04ae1a..3aa93cb14 100644 --- a/app/models/budget/valuator_group_assignment.rb +++ b/app/models/budget/valuator_group_assignment.rb @@ -1,5 +1,5 @@ class Budget - class ValuatorGroupAssignment < ActiveRecord::Base + class ValuatorGroupAssignment < ApplicationRecord belongs_to :valuator_group, counter_cache: :budget_investments_count belongs_to :investment, counter_cache: true end diff --git a/app/models/campaign.rb b/app/models/campaign.rb index 3ce027734..69ab7c811 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -1,2 +1,2 @@ -class Campaign < ActiveRecord::Base +class Campaign < ApplicationRecord end diff --git a/app/models/ckeditor/asset.rb b/app/models/ckeditor/asset.rb index cf636ed19..5c166fdfc 100644 --- a/app/models/ckeditor/asset.rb +++ b/app/models/ckeditor/asset.rb @@ -1,4 +1,4 @@ -class Ckeditor::Asset < ActiveRecord::Base +class Ckeditor::Asset < ApplicationRecord include Ckeditor::Orm::ActiveRecord::AssetBase include Ckeditor::Backend::Paperclip end diff --git a/app/models/comment.rb b/app/models/comment.rb index f940a5b3c..76e314c23 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,4 +1,4 @@ -class Comment < ActiveRecord::Base +class Comment < ApplicationRecord include Flaggable include HasPublicAuthor include Graphqlable @@ -22,7 +22,7 @@ class Comment < ActiveRecord::Base validate :validate_body_length validate :comment_valuation, if: -> { valuation } - belongs_to :commentable, -> { with_hidden }, polymorphic: true, counter_cache: true + belongs_to :commentable, -> { with_hidden }, polymorphic: true, counter_cache: true, touch: true belongs_to :user, -> { with_hidden } before_save :calculate_confidence_score diff --git a/app/models/community.rb b/app/models/community.rb index c9dd0ddfb..b41dd45fc 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -1,4 +1,4 @@ -class Community < ActiveRecord::Base +class Community < ApplicationRecord has_one :proposal has_one :investment, class_name: Budget::Investment has_many :topics diff --git a/app/models/concerns/galleryable.rb b/app/models/concerns/galleryable.rb index 1063c5571..5ddf322f6 100644 --- a/app/models/concerns/galleryable.rb +++ b/app/models/concerns/galleryable.rb @@ -6,7 +6,7 @@ module Galleryable accepts_nested_attributes_for :images, allow_destroy: true, update_only: true def image_url(style) - image.attachment.url(style) if image && image.attachment.exists? + image&.attachment&.url(style) || "" end end -end \ No newline at end of file +end diff --git a/app/models/concerns/globalizable.rb b/app/models/concerns/globalizable.rb index e8772f19c..f963787c7 100644 --- a/app/models/concerns/globalizable.rb +++ b/app/models/concerns/globalizable.rb @@ -12,6 +12,10 @@ module Globalizable def assign_model_to_translations translations.each { |translation| translation.globalized_model = self } end + + def description + self.read_attribute(:description).try :html_safe + end end class_methods do @@ -19,5 +23,9 @@ module Globalizable validates(method, options.merge(if: lambda { |resource| resource.translations.blank? })) translation_class.instance_eval { validates method, options } end + + def translation_class_delegate(method) + translation_class.instance_eval { delegate method, to: :globalized_model } + end end end diff --git a/app/models/concerns/imageable.rb b/app/models/concerns/imageable.rb index 727ff9a6b..3e3b15685 100644 --- a/app/models/concerns/imageable.rb +++ b/app/models/concerns/imageable.rb @@ -6,7 +6,7 @@ module Imageable accepts_nested_attributes_for :image, allow_destroy: true, update_only: true def image_url(style) - image.attachment.url(style) if image && image.attachment.exists? + image&.attachment&.url(style) || "" end end end diff --git a/app/models/concerns/sanitizable.rb b/app/models/concerns/sanitizable.rb index 055859c8b..8602257ef 100644 --- a/app/models/concerns/sanitizable.rb +++ b/app/models/concerns/sanitizable.rb @@ -4,20 +4,47 @@ module Sanitizable included do before_validation :sanitize_description before_validation :sanitize_tag_list - end - def description - super.try :html_safe + unless included_modules.include? Globalizable + def description + super.try :html_safe + end + end end protected def sanitize_description - self.description = WYSIWYGSanitizer.new.sanitize(description) + if translatable_description? + sanitize_description_translations + else + self.description = WYSIWYGSanitizer.new.sanitize(description) + end end def sanitize_tag_list self.tag_list = TagSanitizer.new.sanitize_tag_list(tag_list) if self.class.taggable? end + def translatable_description? + self.class.included_modules.include?(Globalizable) && + self.class.translated_attribute_names.include?(:description) + end + + def sanitize_description_translations + # Sanitize description when using attribute accessor in place of nested translations. + # This is because Globalize gem create translations on after save callback + # https://github.com/globalize/globalize/blob/e37c471775d196cd4318e61954572c300c015467/lib/globalize/active_record/act_macro.rb#L105 + if translations.empty? + Globalize.with_locale(I18n.locale) do + self.description = WYSIWYGSanitizer.new.sanitize(description) + end + end + + translations.reject(&:_destroy).each do |translation| + Globalize.with_locale(translation.locale) do + self.description = WYSIWYGSanitizer.new.sanitize(description) + end + end + end end diff --git a/app/models/debate.rb b/app/models/debate.rb index e3b1aad68..fa4130038 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -1,5 +1,5 @@ require "numeric" -class Debate < ActiveRecord::Base +class Debate < ApplicationRecord include Rails.application.routes.url_helpers include Flaggable include Taggable diff --git a/app/models/direct_message.rb b/app/models/direct_message.rb index b4907ae7a..4f3b08482 100644 --- a/app/models/direct_message.rb +++ b/app/models/direct_message.rb @@ -1,4 +1,4 @@ -class DirectMessage < ActiveRecord::Base +class DirectMessage < ApplicationRecord belongs_to :sender, class_name: "User", foreign_key: "sender_id" belongs_to :receiver, class_name: "User", foreign_key: "receiver_id" diff --git a/app/models/direct_upload.rb b/app/models/direct_upload.rb index c4d1456e7..088c8ea64 100644 --- a/app/models/direct_upload.rb +++ b/app/models/direct_upload.rb @@ -51,7 +51,7 @@ class DirectUpload @relation.valid? if @relation.errors.key? :attachment - errors[:attachment] = @relation.errors[:attachment] + errors.add(:attachment, @relation.errors.full_messages_for(:attachment)) end end diff --git a/app/models/document.rb b/app/models/document.rb index 108f29fad..3a78231f1 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -1,4 +1,4 @@ -class Document < ActiveRecord::Base +class Document < ApplicationRecord include DocumentsHelper include DocumentablesHelper has_attached_file :attachment, url: "/system/:class/:prefix/:style/:hash.:extension", @@ -80,24 +80,26 @@ class Document < ActiveRecord::Base def validate_attachment_size if documentable_class.present? && attachment_file_size > documentable_class.max_file_size - errors[:attachment] = I18n.t("documents.errors.messages.in_between", + errors.add(:attachment, I18n.t("documents.errors.messages.in_between", min: "0 Bytes", - max: "#{max_file_size(documentable_class)} MB") + max: "#{max_file_size(documentable_class)} MB")) end end def validate_attachment_content_type if documentable_class && !accepted_content_types(documentable_class).include?(attachment_content_type) - errors[:attachment] = I18n.t("documents.errors.messages.wrong_content_type", - content_type: attachment_content_type, - accepted_content_types: documentable_humanized_accepted_content_types(documentable_class)) + accepted_content_types = documentable_humanized_accepted_content_types(documentable_class) + message = I18n.t("documents.errors.messages.wrong_content_type", + content_type: attachment_content_type, + accepted_content_types: accepted_content_types) + errors.add(:attachment, message) end end def attachment_presence if attachment.blank? && cached_attachment.blank? - errors[:attachment] = I18n.t("errors.messages.blank") + errors.add(:attachment, I18n.t("errors.messages.blank")) end end diff --git a/app/models/failed_census_call.rb b/app/models/failed_census_call.rb index c0add2070..7b3c994d8 100644 --- a/app/models/failed_census_call.rb +++ b/app/models/failed_census_call.rb @@ -1,4 +1,4 @@ -class FailedCensusCall < ActiveRecord::Base +class FailedCensusCall < ApplicationRecord belongs_to :user, counter_cache: true belongs_to :poll_officer, class_name: "Poll::Officer", counter_cache: true end diff --git a/app/models/flag.rb b/app/models/flag.rb index a05d8a737..e69393d49 100644 --- a/app/models/flag.rb +++ b/app/models/flag.rb @@ -1,4 +1,4 @@ -class Flag < ActiveRecord::Base +class Flag < ApplicationRecord belongs_to :user belongs_to :flaggable, polymorphic: true, counter_cache: true, touch: true diff --git a/app/models/follow.rb b/app/models/follow.rb index 51628f7d4..8062ffecc 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -1,4 +1,4 @@ -class Follow < ActiveRecord::Base +class Follow < ApplicationRecord belongs_to :user belongs_to :followable, polymorphic: true diff --git a/app/models/geozone.rb b/app/models/geozone.rb index 7cdcbab27..f32af5ec6 100644 --- a/app/models/geozone.rb +++ b/app/models/geozone.rb @@ -1,4 +1,4 @@ -class Geozone < ActiveRecord::Base +class Geozone < ApplicationRecord include Graphqlable diff --git a/app/models/i18n_content.rb b/app/models/i18n_content.rb index 81c4ebee7..173c7310a 100644 --- a/app/models/i18n_content.rb +++ b/app/models/i18n_content.rb @@ -1,4 +1,4 @@ -class I18nContent < ActiveRecord::Base +class I18nContent < ApplicationRecord scope :by_key, ->(key) { where(key: key) } scope :begins_with_key, ->(key) { where("key ILIKE ?", "#{key}%") } diff --git a/app/models/i18n_content_translation.rb b/app/models/i18n_content_translation.rb index 76447d83e..4e754a3a5 100644 --- a/app/models/i18n_content_translation.rb +++ b/app/models/i18n_content_translation.rb @@ -1,5 +1,5 @@ -class I18nContentTranslation < ActiveRecord::Base +class I18nContentTranslation < ApplicationRecord def self.existing_languages - self.select(:locale).uniq.map{ |l| l.locale.to_sym }.to_a + self.select(:locale).distinct.map { |l| l.locale.to_sym }.to_a end end diff --git a/app/models/identity.rb b/app/models/identity.rb index e3704da01..311ac61e4 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -1,4 +1,4 @@ -class Identity < ActiveRecord::Base +class Identity < ApplicationRecord belongs_to :user validates :provider, presence: true diff --git a/app/models/image.rb b/app/models/image.rb index 8f62f94d8..eefcd3926 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -1,4 +1,4 @@ -class Image < ActiveRecord::Base +class Image < ApplicationRecord include ImagesHelper include ImageablesHelper @@ -79,23 +79,24 @@ class Image < ActiveRecord::Base def validate_attachment_size if imageable_class && attachment_file_size > 1.megabytes - errors[:attachment] = I18n.t("images.errors.messages.in_between", - min: "0 Bytes", - max: "#{imageable_max_file_size} MB") + errors.add(:attachment, I18n.t("images.errors.messages.in_between", + min: "0 Bytes", + max: "#{imageable_max_file_size} MB")) end end def validate_attachment_content_type if imageable_class && !attachment_of_valid_content_type? - errors[:attachment] = I18n.t("images.errors.messages.wrong_content_type", - content_type: attachment_content_type, - accepted_content_types: imageable_humanized_accepted_content_types) + message = I18n.t("images.errors.messages.wrong_content_type", + content_type: attachment_content_type, + accepted_content_types: imageable_humanized_accepted_content_types) + errors.add(:attachment, message) end end def attachment_presence if attachment.blank? && cached_attachment.blank? - errors[:attachment] = I18n.t("errors.messages.blank") + errors.add(:attachment, I18n.t("errors.messages.blank")) end end diff --git a/app/models/legislation/annotation.rb b/app/models/legislation/annotation.rb index 5cb190cc2..93a6c1acf 100644 --- a/app/models/legislation/annotation.rb +++ b/app/models/legislation/annotation.rb @@ -1,4 +1,4 @@ -class Legislation::Annotation < ActiveRecord::Base +class Legislation::Annotation < ApplicationRecord COMMENTS_PAGE_SIZE = 5 acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/legislation/answer.rb b/app/models/legislation/answer.rb index 298fe9f6d..3bf052167 100644 --- a/app/models/legislation/answer.rb +++ b/app/models/legislation/answer.rb @@ -1,4 +1,4 @@ -class Legislation::Answer < ActiveRecord::Base +class Legislation::Answer < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/legislation/draft_version.rb b/app/models/legislation/draft_version.rb index 99dafac76..57f1039a4 100644 --- a/app/models/legislation/draft_version.rb +++ b/app/models/legislation/draft_version.rb @@ -1,4 +1,4 @@ -class Legislation::DraftVersion < ActiveRecord::Base +class Legislation::DraftVersion < ApplicationRecord VALID_STATUSES = %w(draft published) acts_as_paranoid column: :hidden_at diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index 46d879b63..3d2c72c27 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -1,4 +1,4 @@ -class Legislation::Process < ActiveRecord::Base +class Legislation::Process < ApplicationRecord include ActsAsParanoidAliases include Taggable include Milestoneable diff --git a/app/models/legislation/proposal.rb b/app/models/legislation/proposal.rb index 0e1a39c90..16ab2d7dd 100644 --- a/app/models/legislation/proposal.rb +++ b/app/models/legislation/proposal.rb @@ -1,4 +1,4 @@ -class Legislation::Proposal < ActiveRecord::Base +class Legislation::Proposal < ApplicationRecord include ActsAsParanoidAliases include Flaggable include Taggable diff --git a/app/models/legislation/question.rb b/app/models/legislation/question.rb index acee09088..6c60eb9f3 100644 --- a/app/models/legislation/question.rb +++ b/app/models/legislation/question.rb @@ -1,4 +1,4 @@ -class Legislation::Question < ActiveRecord::Base +class Legislation::Question < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases include Notifiable diff --git a/app/models/legislation/question_option.rb b/app/models/legislation/question_option.rb index f69c60894..c6f846120 100644 --- a/app/models/legislation/question_option.rb +++ b/app/models/legislation/question_option.rb @@ -1,4 +1,4 @@ -class Legislation::QuestionOption < ActiveRecord::Base +class Legislation::QuestionOption < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/local_census_record.rb b/app/models/local_census_record.rb index 1c2c42d44..d275ec130 100644 --- a/app/models/local_census_record.rb +++ b/app/models/local_census_record.rb @@ -1,4 +1,4 @@ -class LocalCensusRecord < ActiveRecord::Base +class LocalCensusRecord < ApplicationRecord validates :document_number, presence: true validates :document_type, presence: true validates :date_of_birth, presence: true diff --git a/app/models/lock.rb b/app/models/lock.rb index c0d5fae39..bcfa41196 100644 --- a/app/models/lock.rb +++ b/app/models/lock.rb @@ -1,4 +1,4 @@ -class Lock < ActiveRecord::Base +class Lock < ApplicationRecord belongs_to :user before_save :set_locked_until @@ -21,7 +21,7 @@ class Lock < ActiveRecord::Base end def self.increase_tries(user) - Lock.find_or_create_by(user: user).increment!(:tries) + Lock.find_or_create_by(user: user).increment!(:tries).save end def self.max_tries diff --git a/app/models/manager.rb b/app/models/manager.rb index d9c1aff07..c0e2987e0 100644 --- a/app/models/manager.rb +++ b/app/models/manager.rb @@ -1,4 +1,4 @@ -class Manager < ActiveRecord::Base +class Manager < ApplicationRecord belongs_to :user, touch: true delegate :name, :email, :name_and_email, to: :user diff --git a/app/models/map_location.rb b/app/models/map_location.rb index 892ba8f20..d69c97ea3 100644 --- a/app/models/map_location.rb +++ b/app/models/map_location.rb @@ -1,4 +1,4 @@ -class MapLocation < ActiveRecord::Base +class MapLocation < ApplicationRecord belongs_to :proposal, touch: true belongs_to :investment, class_name: Budget::Investment, touch: true diff --git a/app/models/milestone.rb b/app/models/milestone.rb index d4ef41137..69d46149a 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -1,4 +1,4 @@ -class Milestone < ActiveRecord::Base +class Milestone < ApplicationRecord include Imageable include Documentable documentable max_documents_allowed: 3, @@ -7,6 +7,7 @@ class Milestone < ActiveRecord::Base translates :title, :description, touch: true include Globalizable + translation_class_delegate :status_id belongs_to :milestoneable, polymorphic: true belongs_to :status diff --git a/app/models/milestone/status.rb b/app/models/milestone/status.rb index 51b03427d..5f99cac22 100644 --- a/app/models/milestone/status.rb +++ b/app/models/milestone/status.rb @@ -1,4 +1,4 @@ -class Milestone::Status < ActiveRecord::Base +class Milestone::Status < ApplicationRecord acts_as_paranoid column: :hidden_at has_many :milestones diff --git a/app/models/milestone/translation.rb b/app/models/milestone/translation.rb deleted file mode 100644 index e1b589d96..000000000 --- a/app/models/milestone/translation.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Milestone::Translation < Globalize::ActiveRecord::Translation - delegate :status_id, to: :globalized_model -end diff --git a/app/models/moderator.rb b/app/models/moderator.rb index 6a5af7a52..6871f4cc5 100644 --- a/app/models/moderator.rb +++ b/app/models/moderator.rb @@ -1,4 +1,4 @@ -class Moderator < ActiveRecord::Base +class Moderator < ApplicationRecord belongs_to :user, touch: true delegate :name, :email, to: :user diff --git a/app/models/newsletter.rb b/app/models/newsletter.rb index 35ed57b91..bac4d8ef7 100644 --- a/app/models/newsletter.rb +++ b/app/models/newsletter.rb @@ -1,4 +1,4 @@ -class Newsletter < ActiveRecord::Base +class Newsletter < ApplicationRecord has_many :activities, as: :actionable validates :subject, presence: true diff --git a/app/models/notification.rb b/app/models/notification.rb index f99cbc1ca..738e5ab5f 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,4 +1,4 @@ -class Notification < ActiveRecord::Base +class Notification < ApplicationRecord belongs_to :user, counter_cache: true belongs_to :notifiable, polymorphic: true diff --git a/app/models/organization.rb b/app/models/organization.rb index 0c7aa92e9..2b9be5071 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,4 +1,4 @@ -class Organization < ActiveRecord::Base +class Organization < ApplicationRecord include Graphqlable diff --git a/app/models/poll.rb b/app/models/poll.rb index 012fce912..22b2d8902 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -1,4 +1,4 @@ -class Poll < ActiveRecord::Base +class Poll < ApplicationRecord include Imageable acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases @@ -37,7 +37,7 @@ class Poll < ActiveRecord::Base scope :public_for_api, -> { all } scope :not_budget, -> { where(budget_id: nil) } - scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) } + scope :sort_for_list, -> { joins(:translations).order(:geozone_restricted, :starts_at, "poll_translations.name") } def title name diff --git a/app/models/poll/answer.rb b/app/models/poll/answer.rb index 8e92988ad..1e602086b 100644 --- a/app/models/poll/answer.rb +++ b/app/models/poll/answer.rb @@ -1,4 +1,4 @@ -class Poll::Answer < ActiveRecord::Base +class Poll::Answer < ApplicationRecord belongs_to :question, -> { with_hidden } belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" diff --git a/app/models/poll/booth.rb b/app/models/poll/booth.rb index e794a0190..d10270064 100644 --- a/app/models/poll/booth.rb +++ b/app/models/poll/booth.rb @@ -1,5 +1,5 @@ class Poll - class Booth < ActiveRecord::Base + class Booth < ApplicationRecord has_many :booth_assignments, class_name: "Poll::BoothAssignment" has_many :polls, through: :booth_assignments has_many :shifts @@ -12,7 +12,7 @@ class Poll end def self.available - where(polls: { id: Poll.current_or_recounting }).includes(:polls) + where(polls: { id: Poll.current_or_recounting }).joins(polls: :translations) end def assignment_on_poll(poll) diff --git a/app/models/poll/booth_assignment.rb b/app/models/poll/booth_assignment.rb index 811b98923..fa037ed21 100644 --- a/app/models/poll/booth_assignment.rb +++ b/app/models/poll/booth_assignment.rb @@ -1,5 +1,5 @@ class Poll - class BoothAssignment < ActiveRecord::Base + class BoothAssignment < ApplicationRecord belongs_to :booth belongs_to :poll diff --git a/app/models/poll/officer.rb b/app/models/poll/officer.rb index ef96cfa91..c44256a5a 100644 --- a/app/models/poll/officer.rb +++ b/app/models/poll/officer.rb @@ -1,5 +1,5 @@ class Poll - class Officer < ActiveRecord::Base + class Officer < ApplicationRecord belongs_to :user has_many :officer_assignments, class_name: "Poll::OfficerAssignment" has_many :shifts, class_name: "Poll::Shift" diff --git a/app/models/poll/officer_assignment.rb b/app/models/poll/officer_assignment.rb index c997c9a5a..5714d8e74 100644 --- a/app/models/poll/officer_assignment.rb +++ b/app/models/poll/officer_assignment.rb @@ -1,5 +1,5 @@ class Poll - class OfficerAssignment < ActiveRecord::Base + class OfficerAssignment < ApplicationRecord belongs_to :officer belongs_to :booth_assignment has_many :ballot_sheets diff --git a/app/models/poll/partial_result.rb b/app/models/poll/partial_result.rb index b24ae9750..7c4a6657e 100644 --- a/app/models/poll/partial_result.rb +++ b/app/models/poll/partial_result.rb @@ -1,4 +1,4 @@ -class Poll::PartialResult < ActiveRecord::Base +class Poll::PartialResult < ApplicationRecord VALID_ORIGINS = %w{web booth} diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index 3dc19dabb..16cbe69b7 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -1,4 +1,4 @@ -class Poll::Question < ActiveRecord::Base +class Poll::Question < ApplicationRecord include Measurable include Searchable diff --git a/app/models/poll/question/answer.rb b/app/models/poll/question/answer.rb index 2efa2b824..f3eb0c97e 100644 --- a/app/models/poll/question/answer.rb +++ b/app/models/poll/question/answer.rb @@ -1,4 +1,4 @@ -class Poll::Question::Answer < ActiveRecord::Base +class Poll::Question::Answer < ApplicationRecord include Galleryable include Documentable diff --git a/app/models/poll/question/answer/video.rb b/app/models/poll/question/answer/video.rb index 4804f5188..f7b9e9676 100644 --- a/app/models/poll/question/answer/video.rb +++ b/app/models/poll/question/answer/video.rb @@ -1,4 +1,4 @@ -class Poll::Question::Answer::Video < ActiveRecord::Base +class Poll::Question::Answer::Video < ApplicationRecord belongs_to :answer, class_name: "Poll::Question::Answer", foreign_key: "answer_id" VIMEO_REGEX = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/ diff --git a/app/models/poll/recount.rb b/app/models/poll/recount.rb index 878b1ee55..9cd744cc0 100644 --- a/app/models/poll/recount.rb +++ b/app/models/poll/recount.rb @@ -1,4 +1,4 @@ -class Poll::Recount < ActiveRecord::Base +class Poll::Recount < ApplicationRecord VALID_ORIGINS = %w{web booth letter}.freeze diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb index dd5c1db32..828fba66e 100644 --- a/app/models/poll/shift.rb +++ b/app/models/poll/shift.rb @@ -1,5 +1,5 @@ class Poll - class Shift < ActiveRecord::Base + class Shift < ApplicationRecord belongs_to :booth belongs_to :officer diff --git a/app/models/poll/voter.rb b/app/models/poll/voter.rb index 1e4a0d204..522c28de2 100644 --- a/app/models/poll/voter.rb +++ b/app/models/poll/voter.rb @@ -1,5 +1,5 @@ class Poll - class Voter < ActiveRecord::Base + class Voter < ApplicationRecord VALID_ORIGINS = %w{web booth}.freeze diff --git a/app/models/progress_bar.rb b/app/models/progress_bar.rb index 2f494196e..c0bacc7ba 100644 --- a/app/models/progress_bar.rb +++ b/app/models/progress_bar.rb @@ -1,4 +1,4 @@ -class ProgressBar < ActiveRecord::Base +class ProgressBar < ApplicationRecord self.inheritance_column = nil RANGE = 0..100 @@ -8,6 +8,7 @@ class ProgressBar < ActiveRecord::Base translates :title, touch: true include Globalizable + translation_class_delegate :primary? validates :progressable, presence: true validates :kind, presence: true, diff --git a/app/models/progress_bar/translation.rb b/app/models/progress_bar/translation.rb deleted file mode 100644 index d61f1d47b..000000000 --- a/app/models/progress_bar/translation.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ProgressBar::Translation < Globalize::ActiveRecord::Translation - delegate :primary?, to: :globalized_model -end diff --git a/app/models/proposal.rb b/app/models/proposal.rb index dfba48df1..807944b47 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -1,4 +1,4 @@ -class Proposal < ActiveRecord::Base +class Proposal < ApplicationRecord include Rails.application.routes.url_helpers include Flaggable include Taggable diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index bdb9f7698..20fe1f0cb 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -1,4 +1,4 @@ -class ProposalNotification < ActiveRecord::Base +class ProposalNotification < ApplicationRecord include Graphqlable include Notifiable diff --git a/app/models/related_content.rb b/app/models/related_content.rb index f9facb47a..4a74ba3c7 100644 --- a/app/models/related_content.rb +++ b/app/models/related_content.rb @@ -1,4 +1,4 @@ -class RelatedContent < ActiveRecord::Base +class RelatedContent < ApplicationRecord RELATED_CONTENT_SCORE_THRESHOLD = Setting["related_content_score_threshold"].to_f RELATIONABLE_MODELS = %w{proposals debates budgets investments}.freeze diff --git a/app/models/related_content_score.rb b/app/models/related_content_score.rb index da37fc07d..3d7684545 100644 --- a/app/models/related_content_score.rb +++ b/app/models/related_content_score.rb @@ -1,4 +1,4 @@ -class RelatedContentScore < ActiveRecord::Base +class RelatedContentScore < ApplicationRecord SCORES = { POSITIVE: 1, NEGATIVE: -1 diff --git a/app/models/setting.rb b/app/models/setting.rb index 764408d27..858d22b0f 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -1,4 +1,4 @@ -class Setting < ActiveRecord::Base +class Setting < ApplicationRecord validates :key, presence: true, uniqueness: true default_scope { order(id: :asc) } diff --git a/app/models/signature.rb b/app/models/signature.rb index 3f5729058..9daf8cbe5 100644 --- a/app/models/signature.rb +++ b/app/models/signature.rb @@ -1,4 +1,4 @@ -class Signature < ActiveRecord::Base +class Signature < ApplicationRecord belongs_to :signature_sheet belongs_to :user diff --git a/app/models/signature_sheet.rb b/app/models/signature_sheet.rb index a8a10a150..86aaf8f3d 100644 --- a/app/models/signature_sheet.rb +++ b/app/models/signature_sheet.rb @@ -1,4 +1,4 @@ -class SignatureSheet < ActiveRecord::Base +class SignatureSheet < ApplicationRecord belongs_to :signable, polymorphic: true belongs_to :author, class_name: "User", foreign_key: "author_id" diff --git a/app/models/site_customization/content_block.rb b/app/models/site_customization/content_block.rb index 6903303e7..2219ef5d4 100644 --- a/app/models/site_customization/content_block.rb +++ b/app/models/site_customization/content_block.rb @@ -1,4 +1,4 @@ -class SiteCustomization::ContentBlock < ActiveRecord::Base +class SiteCustomization::ContentBlock < ApplicationRecord VALID_BLOCKS = %w[top_links footer subnavigation_left subnavigation_right] validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) } diff --git a/app/models/site_customization/image.rb b/app/models/site_customization/image.rb index e933c40a0..12a61dad8 100644 --- a/app/models/site_customization/image.rb +++ b/app/models/site_customization/image.rb @@ -1,4 +1,4 @@ -class SiteCustomization::Image < ActiveRecord::Base +class SiteCustomization::Image < ApplicationRecord VALID_IMAGES = { "logo_header" => [260, 80], "social_media_icon" => [470, 246], diff --git a/app/models/site_customization/page.rb b/app/models/site_customization/page.rb index 6dd8f8d2f..11ced8f07 100644 --- a/app/models/site_customization/page.rb +++ b/app/models/site_customization/page.rb @@ -1,4 +1,4 @@ -class SiteCustomization::Page < ActiveRecord::Base +class SiteCustomization::Page < ApplicationRecord VALID_STATUSES = %w[draft published] has_many :cards, class_name: "Widget::Card", foreign_key: "site_customization_page_id" diff --git a/app/models/spending_proposal.rb b/app/models/spending_proposal.rb index 2b6b9fd67..03fb45e79 100644 --- a/app/models/spending_proposal.rb +++ b/app/models/spending_proposal.rb @@ -1,4 +1,4 @@ -class SpendingProposal < ActiveRecord::Base +class SpendingProposal < ApplicationRecord include Measurable include Sanitizable include Taggable @@ -43,10 +43,6 @@ class SpendingProposal < ActiveRecord::Base super.try :html_safe end - def self.filter_params(params) - params.select{|x, _| %w{geozone_id administrator_id tag_name valuator_id}.include? x.to_s } - end - def self.scoped_filter(params, current_filter) results = self results = results.by_geozone(params[:geozone_id]) if params[:geozone_id].present? diff --git a/app/models/topic.rb b/app/models/topic.rb index e9e463aa5..8130c03da 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -1,4 +1,4 @@ -class Topic < ActiveRecord::Base +class Topic < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases include Notifiable diff --git a/app/models/user.rb b/app/models/user.rb index e62b55273..35bff958a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,9 +1,9 @@ -class User < ActiveRecord::Base +class User < ApplicationRecord include Verification devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, - :trackable, :validatable, :omniauthable, :async, :password_expirable, :secure_validatable, + :trackable, :validatable, :omniauthable, :password_expirable, :secure_validatable, authentication_keys: [:login] acts_as_voter @@ -64,7 +64,7 @@ class User < ActiveRecord::Base scope :active, -> { where(erased_at: nil) } scope :erased, -> { where.not(erased_at: nil) } scope :public_for_api, -> { all } - scope :by_comments, ->(query, topics_ids) { joins(:comments).where(query, topics_ids).uniq } + scope :by_comments, ->(query, topics_ids) { joins(:comments).where(query, topics_ids).distinct } scope :by_authors, ->(author_ids) { where("users.id IN (?)", author_ids) } scope :by_username_email_or_document_number, ->(search_string) do string = "%#{search_string}%" @@ -128,7 +128,9 @@ class User < ActiveRecord::Base end def headings_voted_within_group(group) - Budget::Heading.order("name").where(id: voted_investments.by_group(group).pluck(:heading_id)) + Budget::Heading.joins(:translations) + .order("name") + .where(id: voted_investments.by_group(group).pluck(:heading_id)) end def voted_investments @@ -346,6 +348,10 @@ class User < ActiveRecord::Base followables.compact.map { |followable| followable.tags.map(&:name) }.flatten.compact.uniq end + def send_devise_notification(notification, *args) + devise_mailer.send(notification, self, *args).deliver_later + end + private def clean_document_number diff --git a/app/models/valuation_assignment.rb b/app/models/valuation_assignment.rb index a0505a8aa..2aaea14fb 100644 --- a/app/models/valuation_assignment.rb +++ b/app/models/valuation_assignment.rb @@ -1,4 +1,4 @@ -class ValuationAssignment < ActiveRecord::Base +class ValuationAssignment < ApplicationRecord belongs_to :valuator, counter_cache: :spending_proposals_count belongs_to :spending_proposal, counter_cache: true end diff --git a/app/models/valuator.rb b/app/models/valuator.rb index 2aedfc8f6..70c0a8201 100644 --- a/app/models/valuator.rb +++ b/app/models/valuator.rb @@ -1,4 +1,4 @@ -class Valuator < ActiveRecord::Base +class Valuator < ApplicationRecord belongs_to :user, touch: true belongs_to :valuator_group diff --git a/app/models/valuator_group.rb b/app/models/valuator_group.rb index 26738b542..9e8d388b5 100644 --- a/app/models/valuator_group.rb +++ b/app/models/valuator_group.rb @@ -1,4 +1,4 @@ -class ValuatorGroup < ActiveRecord::Base +class ValuatorGroup < ApplicationRecord has_many :valuators has_many :valuator_group_assignments, dependent: :destroy, class_name: "Budget::ValuatorGroupAssignment" has_many :investments, through: :valuator_group_assignments, class_name: "Budget::Investment" diff --git a/app/models/verified_user.rb b/app/models/verified_user.rb index 6b0ddb822..205c2dfe9 100644 --- a/app/models/verified_user.rb +++ b/app/models/verified_user.rb @@ -1,4 +1,4 @@ -class VerifiedUser < ActiveRecord::Base +class VerifiedUser < ApplicationRecord scope :by_user, ->(user) { where(document_number: user.document_number) } scope :by_email, ->(email) { where(email: email) } diff --git a/app/models/visit.rb b/app/models/visit.rb index 6bb47fed0..9bcf891d7 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,4 +1,4 @@ -class Visit < ActiveRecord::Base +class Visit < ApplicationRecord has_many :ahoy_events, class_name: "Ahoy::Event" belongs_to :user end diff --git a/app/models/web_section.rb b/app/models/web_section.rb index ffeca96f2..3c2dd5790 100644 --- a/app/models/web_section.rb +++ b/app/models/web_section.rb @@ -1,4 +1,4 @@ -class WebSection < ActiveRecord::Base +class WebSection < ApplicationRecord has_many :sections has_many :banners, through: :sections end diff --git a/app/models/widget/card.rb b/app/models/widget/card.rb index 5ec0d4944..bbc87e33b 100644 --- a/app/models/widget/card.rb +++ b/app/models/widget/card.rb @@ -1,4 +1,4 @@ -class Widget::Card < ActiveRecord::Base +class Widget::Card < ApplicationRecord include Imageable belongs_to :page, class_name: "SiteCustomization::Page", foreign_key: "site_customization_page_id" diff --git a/app/models/widget/feed.rb b/app/models/widget/feed.rb index 997f9e8b6..2ddd00d62 100644 --- a/app/models/widget/feed.rb +++ b/app/models/widget/feed.rb @@ -1,4 +1,4 @@ -class Widget::Feed < ActiveRecord::Base +class Widget::Feed < ApplicationRecord self.table_name = "widget_feeds" KINDS = %w(proposals debates processes) diff --git a/app/views/admin/budget_investments/_select_investment.html.erb b/app/views/admin/budget_investments/_select_investment.html.erb index e4c7f5355..040d128e1 100644 --- a/app/views/admin/budget_investments/_select_investment.html.erb +++ b/app/views/admin/budget_investments/_select_investment.html.erb @@ -5,7 +5,7 @@ <%= link_to investment.title, admin_budget_budget_investment_path(budget_id: @budget.id, id: investment.id, - params: Budget::Investment.filter_params(params)), + params: Budget::Investment.filter_params(params).to_h), target: "_blank" %> diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index 6cfcfbe63..a9c81dd39 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -1,11 +1,11 @@ -<%= link_to admin_budget_budget_investment_path(@budget, @investment, Budget::Investment.filter_params(params)), class: "back" do %> +<%= link_to admin_budget_budget_investment_path(@budget, @investment, Budget::Investment.filter_params(params).to_h), class: "back" do %> <%= t("shared.back") %> <% end %> <%= form_for @investment, url: admin_budget_budget_investment_path(@budget, @investment) do |f| %> - <% Budget::Investment.filter_params(params).each do |filter_name, filter_value| %> + <% Budget::Investment.filter_params(params).to_h.each do |filter_name, filter_value| %> <%= hidden_field_tag filter_name, filter_value %> <% end %> diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index 191b498ef..d364118ca 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -1,4 +1,4 @@ -<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params)), +<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params).to_h), class: "back", data: {no_turbolink: true} do %> <%= t("shared.back") %> <% end %> @@ -7,7 +7,7 @@ <%= link_to t("admin.budget_investments.show.edit"), edit_admin_budget_budget_investment_path(@budget, @investment, - Budget::Investment.filter_params(params)) unless @budget.finished? %> + Budget::Investment.filter_params(params).to_h) unless @budget.finished? %>
@@ -44,7 +44,7 @@

<%= link_to t("admin.budget_investments.show.edit_classification"), edit_admin_budget_budget_investment_path(@budget, @investment, - {anchor: "classification"}.merge(Budget::Investment.filter_params(params))) unless @budget.finished? %> + {anchor: "classification"}.merge(Budget::Investment.filter_params(params).to_h)) unless @budget.finished? %>


diff --git a/app/views/admin/spending_proposals/edit.html.erb b/app/views/admin/spending_proposals/edit.html.erb index f7a4d545d..29438f28b 100644 --- a/app/views/admin/spending_proposals/edit.html.erb +++ b/app/views/admin/spending_proposals/edit.html.erb @@ -1,11 +1,11 @@ -<%= link_to admin_spending_proposal_path(@spending_proposal, SpendingProposal.filter_params(params)), class: "back" do %> +<%= link_to admin_spending_proposal_path(@spending_proposal, @filter_params.to_h), class: 'back' do %> <%= t("admin.spending_proposals.show.back") %> <% end %> <%= form_for @spending_proposal, url: admin_spending_proposal_path(@spending_proposal) do |f| %> - <% SpendingProposal.filter_params(params).each do |filter_name, filter_value| %> + <% @filter_params.to_h.each do |filter_name, filter_value| %> <%= hidden_field_tag filter_name, filter_value %> <% end %> @@ -15,7 +15,9 @@
- <%= f.cktext_area :description, maxlength: SpendingProposal.description_max_length, ckeditor: { language: I18n.locale } %> + <%= f.cktext_area :description, + maxlength: SpendingProposal.description_max_length, + ckeditor: { language: I18n.locale } %>
diff --git a/app/views/admin/spending_proposals/index.html.erb b/app/views/admin/spending_proposals/index.html.erb index 8f2711c29..a36c19d35 100644 --- a/app/views/admin/spending_proposals/index.html.erb +++ b/app/views/admin/spending_proposals/index.html.erb @@ -55,7 +55,8 @@ <%= spending_proposal.id %> - <%= link_to spending_proposal.title, admin_spending_proposal_path(spending_proposal, SpendingProposal.filter_params(params)) %> + <%= link_to spending_proposal.title, + admin_spending_proposal_path(spending_proposal, @filter_params.to_h) %> <% if spending_proposal.administrator.present? %> diff --git a/app/views/admin/spending_proposals/show.html.erb b/app/views/admin/spending_proposals/show.html.erb index ddb47e359..6569a0036 100644 --- a/app/views/admin/spending_proposals/show.html.erb +++ b/app/views/admin/spending_proposals/show.html.erb @@ -1,4 +1,4 @@ -<%= link_to admin_spending_proposals_path(SpendingProposal.filter_params(params)), data: {no_turbolink: true} do %> +<%= link_to admin_spending_proposals_path(@filter_params.to_h), data: {no_turbolink: true} do %> <%= t("admin.spending_proposals.show.back") %> <% end %> @@ -6,7 +6,7 @@ <%= link_to t("admin.spending_proposals.show.edit"), edit_admin_spending_proposal_path(@spending_proposal, - SpendingProposal.filter_params(params)) %> + @filter_params.to_h) %>
@@ -34,7 +34,7 @@

<%= link_to t("admin.spending_proposals.show.edit_classification"), edit_admin_spending_proposal_path(@spending_proposal, - {anchor: "classification"}.merge(SpendingProposal.filter_params(params))) %> + {anchor: 'classification'}.merge(@filter_params.to_h)) %>


@@ -44,6 +44,7 @@ <%= render "valuation/spending_proposals/written_by_valuators" %>

- <%= link_to t("admin.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %> + <%= link_to t("admin.spending_proposals.show.edit_dossier"), + edit_valuation_spending_proposal_path(@spending_proposal) %>

diff --git a/app/views/devise/_omniauth_form.html.erb b/app/views/devise/_omniauth_form.html.erb index f2c567259..3f2ad28c8 100644 --- a/app/views/devise/_omniauth_form.html.erb +++ b/app/views/devise/_omniauth_form.html.erb @@ -10,7 +10,7 @@ <% if feature? :twitter_login %>
- <%= link_to t("omniauth.twitter.name"), user_omniauth_authorize_path(:twitter), + <%= link_to t("omniauth.twitter.name"), user_twitter_omniauth_authorize_path, title: t("omniauth.twitter.sign_in"), class: "button-twitter button expanded" %>
@@ -18,7 +18,7 @@ <% if feature? :facebook_login %>
- <%= link_to t("omniauth.facebook.name"), user_omniauth_authorize_path(:facebook), + <%= link_to t("omniauth.facebook.name"), user_facebook_omniauth_authorize_path, title: t("omniauth.facebook.sign_in"), class: "button-facebook button expanded" %>
@@ -26,7 +26,7 @@ <% if feature? :google_login %>
- <%= link_to t("omniauth.google_oauth2.name"), user_omniauth_authorize_path(:google_oauth2), + <%= link_to t("omniauth.google_oauth2.name"), user_google_oauth2_omniauth_authorize_path, title: t("omniauth.google_oauth2.sign_in"), class: "button-google button expanded" %>
@@ -47,7 +47,7 @@ <% if feature? :twitter_login %>
- <%= link_to t("omniauth.twitter.name"), user_omniauth_authorize_path(:twitter), + <%= link_to t("omniauth.twitter.name"), user_twitter_omniauth_authorize_path, title: t("omniauth.twitter.sign_up"), class: "button-twitter button expanded" %>
@@ -55,7 +55,7 @@ <% if feature? :facebook_login %>
- <%= link_to t("omniauth.facebook.name"), user_omniauth_authorize_path(:facebook), + <%= link_to t("omniauth.facebook.name"), user_facebook_omniauth_authorize_path, title: t("omniauth.facebook.sign_up"), class: "button-facebook button expanded" %>
@@ -63,7 +63,7 @@ <% if feature? :google_login %>
- <%= link_to t("omniauth.google_oauth2.name"), user_omniauth_authorize_path(:google_oauth2), + <%= link_to t("omniauth.google_oauth2.name"), user_google_oauth2_omniauth_authorize_path, title: t("omniauth.google_oauth2.sign_up"), class: "button-google button expanded" %>
diff --git a/app/views/management/email_verifications/new.html.erb b/app/views/management/email_verifications/new.html.erb index cb173d7aa..6dea2f0f7 100644 --- a/app/views/management/email_verifications/new.html.erb +++ b/app/views/management/email_verifications/new.html.erb @@ -23,7 +23,11 @@ <%= t("management.email_verifications.if_no_existing_account") %>

- <%= link_to t("management.users.create_user"), new_management_user_path(user: params[:email_verification]), class: "button success" %> + <%= link_to t("management.users.create_user"), + new_management_user_path(user: { + document_number: @email_verification.document_number, + document_type: @email_verification.document_type }), + class: "button success" %>

diff --git a/app/views/users/registrations/delete_form.html.erb b/app/views/users/registrations/delete_form.html.erb index c52b85638..0da21e44e 100644 --- a/app/views/users/registrations/delete_form.html.erb +++ b/app/views/users/registrations/delete_form.html.erb @@ -5,7 +5,7 @@ <%= form_for(resource, as: resource_name, url: users_registrations_path, html: { method: :delete }) do |f| %> - <%= devise_error_messages! %> + <%= render "shared/errors", resource: resource %>
<%= t("devise_views.users.registrations.delete_form.info") %> diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb index 4dcc388b2..b02fbda8f 100644 --- a/app/views/users/registrations/edit.html.erb +++ b/app/views/users/registrations/edit.html.erb @@ -3,7 +3,7 @@

<%= t("devise_views.users.registrations.edit.edit") %>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> + <%= render "shared/errors", resource: resource %>
<%= f.label :email, t("devise_views.users.registrations.edit.email_label") %> diff --git a/app/views/welcome/_feeds.html.erb b/app/views/welcome/_feeds.html.erb index b255ed526..37f21df18 100644 --- a/app/views/welcome/_feeds.html.erb +++ b/app/views/welcome/_feeds.html.erb @@ -8,7 +8,7 @@

<%= t("welcome.feed.most_active.#{feed.kind}") %>

<% feed.items.each do |item| %> -
row"> +
row">
"> <%= link_to item.title, url_for(item) %>
@@ -37,7 +37,7 @@

<%= t("welcome.feed.most_active.#{feed.kind}") %>

<% feed.items.each do |item| %> -
"> +
"> <%= link_to item.title, url_for(item) %>
<% end %> diff --git a/app/views/welcome/_processes.html.erb b/app/views/welcome/_processes.html.erb index 3433d7182..556c6e066 100644 --- a/app/views/welcome/_processes.html.erb +++ b/app/views/welcome/_processes.html.erb @@ -8,7 +8,7 @@ <% feed.items.each do |item| %> <%= link_to url_for(item) do %> -
"> +
"> <%= image_tag("welcome_process.png", alt: "") %>
<%= t("welcome.feed.process_label") %>
diff --git a/bin/rails b/bin/rails index 0138d79b7..073966023 100755 --- a/bin/rails +++ b/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index d87d5f578..17240489f 100755 --- a/bin/rake +++ b/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index d3bb99760..e620b4dad 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,34 @@ #!/usr/bin/env ruby require 'pathname' +require 'fileutils' +include FileUtils # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) -Dir.chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file: +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + system! 'bin/rails restart' end diff --git a/bin/update b/bin/update new file mode 100755 index 000000000..a8e4462f2 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/config/application.rb b/config/application.rb index 22eceee59..6ef88f5ea 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path("../boot", __FILE__) +require_relative "boot" require "rails/all" @@ -55,9 +55,6 @@ module Consul config.assets.paths << Rails.root.join("app", "assets", "fonts") - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true - # Add lib to the autoload path config.autoload_paths << Rails.root.join("lib") config.time_zone = "Madrid" @@ -74,4 +71,14 @@ module Consul end end +class Rails::Engine + initializer :prepend_custom_assets_path, group: :all do |app| + if self.class.name == "Consul::Application" + %w[images fonts javascripts].each do |asset| + app.config.assets.paths.unshift(Rails.root.join("app", "assets", asset, "custom").to_s) + end + end + end +end + require "./config/application_custom.rb" diff --git a/config/boot.rb b/config/boot.rb index fb24cf2ed..282011619 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,3 @@ -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index 171198560..cac531577 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path("../application", __FILE__) +require_relative "application" # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 49c9ab830..fc032e333 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -9,9 +9,22 @@ Rails.application.configure do # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join("tmp/caching-dev.txt").exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + "Cache-Control" => "public, max-age=172800" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -20,6 +33,7 @@ Rails.application.configure do # Deliver emails to a development mailbox at /letter_opener config.action_mailer.delivery_method = :letter_opener + config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -40,6 +54,8 @@ Rails.application.configure do # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true + # Suppress logger output for asset requests. + config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true @@ -54,4 +70,7 @@ Rails.application.configure do Bullet.add_footer = true end end + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/preproduction.rb b/config/environments/preproduction.rb index 7eb169ce1..5dfdcacd6 100644 --- a/config/environments/preproduction.rb +++ b/config/environments/preproduction.rb @@ -10,6 +10,11 @@ Rails.application.configure do # Rake tasks automatically ignore this option for performance. config.eager_load = true + # Because autoloading is disabled in production environments with Rails 5, + # using autoload_paths will not load needed classes from specified paths. + # The solution to this, is to ask Rails to eager load classes. + config.eager_load_paths << "#{config.root}/lib" + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true @@ -22,7 +27,7 @@ Rails.application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier diff --git a/config/environments/production.rb b/config/environments/production.rb index ff3d9d2ad..d66dd3b3d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -10,19 +10,18 @@ Rails.application.configure do # Rake tasks automatically ignore this option for performance. config.eager_load = true + # Because autoloading is disabled in production environments with Rails 5, + # using autoload_paths will not load needed classes from specified paths. + # The solution to this, is to ask Rails to eager load classes. + config.eager_load_paths << "#{config.root}/lib" + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # NGINX, varnish or squid. - # config.action_dispatch.rack_cache = true - # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -37,10 +36,18 @@ Rails.application.configure do # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true @@ -49,16 +56,15 @@ Rails.application.configure do config.log_level = :warn # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [ :request_id ] # Use a different cache store in production. config.cache_store = :dalli_store, { value_max_bytes: 2000000 } - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "consul_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -88,6 +94,16 @@ Rails.application.configure do # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index de8f707c7..5a47275cc 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -10,6 +10,11 @@ Rails.application.configure do # Rake tasks automatically ignore this option for performance. config.eager_load = true + # Because autoloading is disabled in production environments with Rails 5, + # using autoload_paths will not load needed classes from specified paths. + # The solution to this, is to ask Rails to eager load classes. + config.eager_load_paths << "#{config.root}/lib" + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true @@ -22,7 +27,7 @@ Rails.application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier diff --git a/config/environments/test.rb b/config/environments/test.rb index a237b95de..06430ed91 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -10,16 +10,13 @@ Rails.application.configure do # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. - config.eager_load = true + config.eager_load = false - # Setting allow_corrency to false tells rails to force every request to - # "wait in line", serving one after the other - # Setting eager_load to true also sets allow_concurrency to true. - config.allow_concurrency = false - - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + "Cache-Control" => "public, max-age=3600" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -30,6 +27,7 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index d19b6181f..d8ebeeec5 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -74,7 +74,10 @@ module ActsAsTaggableOn end def self.spending_proposal_tags - ActsAsTaggableOn::Tag.where("taggings.taggable_type" => "SpendingProposal").includes(:taggings).order(:name).uniq + ActsAsTaggableOn::Tag.where("taggings.taggable_type" => "SpendingProposal") + .includes(:taggings) + .order(:name) + .distinct end def self.graphql_field_name diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..51639b67a --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index cbd07efbf..4990ba4d0 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -16,8 +16,3 @@ Rails.application.config.assets.precompile += %w( print.css ) Rails.application.config.assets.precompile += %w( ie.css ) # Loads custom images and custom fonts before app/assets/images and app/assets/fonts -assets_path = Rails.application.config.assets.paths - -%w[images fonts javascripts].each do |asset| - assets_path.insert(0, Rails.root.join("app", "assets", asset, "custom").to_s) -end diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458de..5a6a32d37 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 7bff2d029..97fa34288 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -12,7 +12,7 @@ Devise.setup do |config| # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - if Rails.env.test? || !ActiveRecord::Base.connection.table_exists?("settings") + if Rails.env.test? || !ActiveRecord::Base.connection.data_source_exists?("settings") config.mailer_sender = "noreply@consul.dev" else config.mailer_sender = "'#{Setting["mailer_from_name"]}' <#{Setting["mailer_from_address"]}>" diff --git a/config/initializers/devise_async.rb b/config/initializers/devise_async.rb deleted file mode 100644 index 47b01e7f4..000000000 --- a/config/initializers/devise_async.rb +++ /dev/null @@ -1,8 +0,0 @@ -Devise::Async.setup do |config| - if Rails.env.test? || Rails.env.development? - config.enabled = false - else - config.enabled = true - end - config.backend = :delayed_job -end \ No newline at end of file diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95f..bbfc3961b 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 000000000..c7f311f81 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,47 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 000000000..c9119b40c --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index eb9b0d99f..f990f00bd 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -1,3 +1,6 @@ +require_dependency "poll/answer" +require_dependency "poll/question/answer" + section "Creating polls" do Poll.create(name: I18n.t("seeds.polls.current_poll"), diff --git a/db/migrate/20150715190041_create_debates.rb b/db/migrate/20150715190041_create_debates.rb index d84b9ed3a..eb3d4dede 100644 --- a/db/migrate/20150715190041_create_debates.rb +++ b/db/migrate/20150715190041_create_debates.rb @@ -1,4 +1,4 @@ -class CreateDebates < ActiveRecord::Migration +class CreateDebates < ActiveRecord::Migration[4.2] def change create_table :debates do |t| t.string :title diff --git a/db/migrate/20150716154501_remove_external_link_from_debates.rb b/db/migrate/20150716154501_remove_external_link_from_debates.rb index 5991b363d..9b59db739 100644 --- a/db/migrate/20150716154501_remove_external_link_from_debates.rb +++ b/db/migrate/20150716154501_remove_external_link_from_debates.rb @@ -1,4 +1,4 @@ -class RemoveExternalLinkFromDebates < ActiveRecord::Migration +class RemoveExternalLinkFromDebates < ActiveRecord::Migration[4.2] def change remove_column :debates, :external_link end diff --git a/db/migrate/20150716174358_devise_create_users.rb b/db/migrate/20150716174358_devise_create_users.rb index c18355f3d..03f8179bb 100644 --- a/db/migrate/20150716174358_devise_create_users.rb +++ b/db/migrate/20150716174358_devise_create_users.rb @@ -1,4 +1,4 @@ -class DeviseCreateUsers < ActiveRecord::Migration +class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| ## Database authenticatable diff --git a/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb b/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb index 3be763bfd..bd0f98b0d 100644 --- a/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb +++ b/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb @@ -1,4 +1,4 @@ -class AddFirstNameAndLastNameToUsers < ActiveRecord::Migration +class AddFirstNameAndLastNameToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :first_name, :string add_column :users, :last_name, :string diff --git a/db/migrate/20150717180105_acts_as_votable_migration.rb b/db/migrate/20150717180105_acts_as_votable_migration.rb index 798dd48f9..2770b4cef 100644 --- a/db/migrate/20150717180105_acts_as_votable_migration.rb +++ b/db/migrate/20150717180105_acts_as_votable_migration.rb @@ -1,4 +1,4 @@ -class ActsAsVotableMigration < ActiveRecord::Migration +class ActsAsVotableMigration < ActiveRecord::Migration[4.2] def self.up create_table :votes do |t| diff --git a/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index 2cf5741f8..cdf0ae25b 100644 --- a/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 1) -class ActsAsTaggableOnMigration < ActiveRecord::Migration +class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2] def self.up create_table :tags do |t| t.string :name diff --git a/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 6bbd5ab3d..4fd0d989c 100644 --- a/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 3) -class AddTaggingsCounterCacheToTags < ActiveRecord::Migration +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2] def self.up add_column :tags, :taggings_count, :integer, default: 0 end diff --git a/db/migrate/20150718091702_acts_as_commentable_with_threading_migration.rb b/db/migrate/20150718091702_acts_as_commentable_with_threading_migration.rb index 977fc79df..2aa7eab6a 100644 --- a/db/migrate/20150718091702_acts_as_commentable_with_threading_migration.rb +++ b/db/migrate/20150718091702_acts_as_commentable_with_threading_migration.rb @@ -1,4 +1,4 @@ -class ActsAsCommentableWithThreadingMigration < ActiveRecord::Migration +class ActsAsCommentableWithThreadingMigration < ActiveRecord::Migration[4.2] def self.up create_table :comments, force: true do |t| t.integer :commentable_id diff --git a/db/migrate/20150731110702_add_confirmable_to_devise_for_users.rb b/db/migrate/20150731110702_add_confirmable_to_devise_for_users.rb index c6b4310e6..048e1d4b1 100644 --- a/db/migrate/20150731110702_add_confirmable_to_devise_for_users.rb +++ b/db/migrate/20150731110702_add_confirmable_to_devise_for_users.rb @@ -1,4 +1,4 @@ -class AddConfirmableToDeviseForUsers < ActiveRecord::Migration +class AddConfirmableToDeviseForUsers < ActiveRecord::Migration[4.2] def change # Confirmable add_column :users, :confirmation_token, :string diff --git a/db/migrate/20150804144230_create_visits.rb b/db/migrate/20150804144230_create_visits.rb index 6f5156c0e..2de0b71ee 100644 --- a/db/migrate/20150804144230_create_visits.rb +++ b/db/migrate/20150804144230_create_visits.rb @@ -1,4 +1,4 @@ -class CreateVisits < ActiveRecord::Migration +class CreateVisits < ActiveRecord::Migration[4.2] def change create_table :visits, id: false do |t| t.uuid :id, default: nil, primary_key: true diff --git a/db/migrate/20150804144231_create_ahoy_events.rb b/db/migrate/20150804144231_create_ahoy_events.rb index 81fb71f37..2b9f5931c 100644 --- a/db/migrate/20150804144231_create_ahoy_events.rb +++ b/db/migrate/20150804144231_create_ahoy_events.rb @@ -1,4 +1,4 @@ -class CreateAhoyEvents < ActiveRecord::Migration +class CreateAhoyEvents < ActiveRecord::Migration[4.2] def change create_table :ahoy_events, id: false do |t| t.uuid :id, default: nil, primary_key: true diff --git a/db/migrate/20150806111435_change_debates_title_length.rb b/db/migrate/20150806111435_change_debates_title_length.rb index 7c170bc15..bbf50b4ed 100644 --- a/db/migrate/20150806111435_change_debates_title_length.rb +++ b/db/migrate/20150806111435_change_debates_title_length.rb @@ -1,4 +1,4 @@ -class ChangeDebatesTitleLength < ActiveRecord::Migration +class ChangeDebatesTitleLength < ActiveRecord::Migration[4.2] def change change_column :debates, :title, :string, limit: 80 end diff --git a/db/migrate/20150806135245_add_nickname_to_user.rb b/db/migrate/20150806135245_add_nickname_to_user.rb index 06bf046f9..4e33ff63c 100644 --- a/db/migrate/20150806135245_add_nickname_to_user.rb +++ b/db/migrate/20150806135245_add_nickname_to_user.rb @@ -1,4 +1,4 @@ -class AddNicknameToUser < ActiveRecord::Migration +class AddNicknameToUser < ActiveRecord::Migration[4.2] def change add_column :users, :nickname, :string end diff --git a/db/migrate/20150806140048_add_use_nickname_to_users.rb b/db/migrate/20150806140048_add_use_nickname_to_users.rb index 032a791cd..1c0dfa18c 100644 --- a/db/migrate/20150806140048_add_use_nickname_to_users.rb +++ b/db/migrate/20150806140048_add_use_nickname_to_users.rb @@ -1,4 +1,4 @@ -class AddUseNicknameToUsers < ActiveRecord::Migration +class AddUseNicknameToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :use_nickname, :boolean, null: false, default: false end diff --git a/db/migrate/20150806163142_add_preferences_to_users.rb b/db/migrate/20150806163142_add_preferences_to_users.rb index 8c3ae57cc..cd72264ab 100644 --- a/db/migrate/20150806163142_add_preferences_to_users.rb +++ b/db/migrate/20150806163142_add_preferences_to_users.rb @@ -1,4 +1,4 @@ -class AddPreferencesToUsers < ActiveRecord::Migration +class AddPreferencesToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :email_on_debate_comment, :boolean, default: false add_column :users, :email_on_comment_reply, :boolean, default: false diff --git a/db/migrate/20150807140235_create_administrators.rb b/db/migrate/20150807140235_create_administrators.rb index d844531a4..d4f9342fa 100644 --- a/db/migrate/20150807140235_create_administrators.rb +++ b/db/migrate/20150807140235_create_administrators.rb @@ -1,4 +1,4 @@ -class CreateAdministrators < ActiveRecord::Migration +class CreateAdministrators < ActiveRecord::Migration[4.2] def change create_table :administrators do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20150807140346_create_moderators.rb b/db/migrate/20150807140346_create_moderators.rb index 526a29944..103011395 100644 --- a/db/migrate/20150807140346_create_moderators.rb +++ b/db/migrate/20150807140346_create_moderators.rb @@ -1,4 +1,4 @@ -class CreateModerators < ActiveRecord::Migration +class CreateModerators < ActiveRecord::Migration[4.2] def change create_table :moderators do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20150808100936_add_ip_to_ahoy_event.rb b/db/migrate/20150808100936_add_ip_to_ahoy_event.rb index 2c6d9d9b2..1e1500d07 100644 --- a/db/migrate/20150808100936_add_ip_to_ahoy_event.rb +++ b/db/migrate/20150808100936_add_ip_to_ahoy_event.rb @@ -1,4 +1,4 @@ -class AddIpToAhoyEvent < ActiveRecord::Migration +class AddIpToAhoyEvent < ActiveRecord::Migration[4.2] def change add_column :ahoy_events, :ip, :string end diff --git a/db/migrate/20150808102442_add_visit_id_to_debate.rb b/db/migrate/20150808102442_add_visit_id_to_debate.rb index 4d09f2cd0..469a5b41f 100644 --- a/db/migrate/20150808102442_add_visit_id_to_debate.rb +++ b/db/migrate/20150808102442_add_visit_id_to_debate.rb @@ -1,4 +1,4 @@ -class AddVisitIdToDebate < ActiveRecord::Migration +class AddVisitIdToDebate < ActiveRecord::Migration[4.2] def change add_column :debates, :visit_id, :string end diff --git a/db/migrate/20150808141306_create_simple_captcha_data.rb b/db/migrate/20150808141306_create_simple_captcha_data.rb index d636631f0..dae8a3543 100644 --- a/db/migrate/20150808141306_create_simple_captcha_data.rb +++ b/db/migrate/20150808141306_create_simple_captcha_data.rb @@ -1,4 +1,4 @@ -class CreateSimpleCaptchaData < ActiveRecord::Migration +class CreateSimpleCaptchaData < ActiveRecord::Migration[4.2] def self.up create_table :simple_captcha_data do |t| t.string :key, limit: 40 diff --git a/db/migrate/20150810201448_add_hidden_at_to_comments.rb b/db/migrate/20150810201448_add_hidden_at_to_comments.rb index 55d652087..d777f4b31 100644 --- a/db/migrate/20150810201448_add_hidden_at_to_comments.rb +++ b/db/migrate/20150810201448_add_hidden_at_to_comments.rb @@ -1,4 +1,4 @@ -class AddHiddenAtToComments < ActiveRecord::Migration +class AddHiddenAtToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :hidden_at, :datetime add_index :comments, :hidden_at diff --git a/db/migrate/20150811145628_add_hidden_at_to_debates.rb b/db/migrate/20150811145628_add_hidden_at_to_debates.rb index 5fbb29532..bf44db62b 100644 --- a/db/migrate/20150811145628_add_hidden_at_to_debates.rb +++ b/db/migrate/20150811145628_add_hidden_at_to_debates.rb @@ -1,4 +1,4 @@ -class AddHiddenAtToDebates < ActiveRecord::Migration +class AddHiddenAtToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :hidden_at, :datetime add_index :debates, :hidden_at diff --git a/db/migrate/20150811161459_add_children_count_to_comments.rb b/db/migrate/20150811161459_add_children_count_to_comments.rb index ce233542d..c17589f05 100644 --- a/db/migrate/20150811161459_add_children_count_to_comments.rb +++ b/db/migrate/20150811161459_add_children_count_to_comments.rb @@ -1,4 +1,4 @@ -class AddChildrenCountToComments < ActiveRecord::Migration +class AddChildrenCountToComments < ActiveRecord::Migration[4.2] def up add_column :comments, :children_count, :integer, default: 0 end diff --git a/db/migrate/20150813142213_create_organizations.rb b/db/migrate/20150813142213_create_organizations.rb index a0974df7f..df35bea3a 100644 --- a/db/migrate/20150813142213_create_organizations.rb +++ b/db/migrate/20150813142213_create_organizations.rb @@ -1,4 +1,4 @@ -class CreateOrganizations < ActiveRecord::Migration +class CreateOrganizations < ActiveRecord::Migration[4.2] def change create_table :organizations do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20150813161654_add_phone_number_to_users.rb b/db/migrate/20150813161654_add_phone_number_to_users.rb index 070b99586..7980ecec9 100644 --- a/db/migrate/20150813161654_add_phone_number_to_users.rb +++ b/db/migrate/20150813161654_add_phone_number_to_users.rb @@ -1,4 +1,4 @@ -class AddPhoneNumberToUsers < ActiveRecord::Migration +class AddPhoneNumberToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :phone_number, :string, limit: 30 end diff --git a/db/migrate/20150814074250_add_official_position_to_user.rb b/db/migrate/20150814074250_add_official_position_to_user.rb index 49719f510..c170de20b 100644 --- a/db/migrate/20150814074250_add_official_position_to_user.rb +++ b/db/migrate/20150814074250_add_official_position_to_user.rb @@ -1,4 +1,4 @@ -class AddOfficialPositionToUser < ActiveRecord::Migration +class AddOfficialPositionToUser < ActiveRecord::Migration[4.2] def change add_column :users, :official_position, :string add_column :users, :official_level, :integer, default: 0 diff --git a/db/migrate/20150815154430_add_featured_to_tags.rb b/db/migrate/20150815154430_add_featured_to_tags.rb index 6ad4d5658..183b80554 100644 --- a/db/migrate/20150815154430_add_featured_to_tags.rb +++ b/db/migrate/20150815154430_add_featured_to_tags.rb @@ -1,4 +1,4 @@ -class AddFeaturedToTags < ActiveRecord::Migration +class AddFeaturedToTags < ActiveRecord::Migration[4.2] def change add_column :tags, :featured, :boolean, default: false end diff --git a/db/migrate/20150817150457_add_settings.rb b/db/migrate/20150817150457_add_settings.rb index 1ba7fe9c6..1e7a35419 100644 --- a/db/migrate/20150817150457_add_settings.rb +++ b/db/migrate/20150817150457_add_settings.rb @@ -1,4 +1,4 @@ -class AddSettings < ActiveRecord::Migration +class AddSettings < ActiveRecord::Migration[4.2] def change create_table :settings do |t| t.string :key diff --git a/db/migrate/20150819135933_add_hidden_at_to_users.rb b/db/migrate/20150819135933_add_hidden_at_to_users.rb index fa54e00e1..265e31dee 100644 --- a/db/migrate/20150819135933_add_hidden_at_to_users.rb +++ b/db/migrate/20150819135933_add_hidden_at_to_users.rb @@ -1,4 +1,4 @@ -class AddHiddenAtToUsers < ActiveRecord::Migration +class AddHiddenAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :hidden_at, :datetime add_index :users, :hidden_at diff --git a/db/migrate/20150819193457_add_sms_verification_code_to_users.rb b/db/migrate/20150819193457_add_sms_verification_code_to_users.rb index d886a5ad6..516b38c58 100644 --- a/db/migrate/20150819193457_add_sms_verification_code_to_users.rb +++ b/db/migrate/20150819193457_add_sms_verification_code_to_users.rb @@ -1,4 +1,4 @@ -class AddSmsVerificationCodeToUsers < ActiveRecord::Migration +class AddSmsVerificationCodeToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :sms_verification_code, :string add_column :users, :sms_verified_at, :datetime diff --git a/db/migrate/20150819203410_add_phone_to_users.rb b/db/migrate/20150819203410_add_phone_to_users.rb index 7f94bae93..63d9a9cda 100644 --- a/db/migrate/20150819203410_add_phone_to_users.rb +++ b/db/migrate/20150819203410_add_phone_to_users.rb @@ -1,4 +1,4 @@ -class AddPhoneToUsers < ActiveRecord::Migration +class AddPhoneToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :phone, :string end diff --git a/db/migrate/20150820103351_create_inappropiate_flags.rb b/db/migrate/20150820103351_create_inappropiate_flags.rb index 45bb5cba8..3e69fd15c 100644 --- a/db/migrate/20150820103351_create_inappropiate_flags.rb +++ b/db/migrate/20150820103351_create_inappropiate_flags.rb @@ -1,4 +1,4 @@ -class CreateInappropiateFlags < ActiveRecord::Migration +class CreateInappropiateFlags < ActiveRecord::Migration[4.2] def change create_table :inappropiate_flags do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20150820103800_add_inappropiate_flag_fields_to_comments.rb b/db/migrate/20150820103800_add_inappropiate_flag_fields_to_comments.rb index 92a53581b..410f6f20f 100644 --- a/db/migrate/20150820103800_add_inappropiate_flag_fields_to_comments.rb +++ b/db/migrate/20150820103800_add_inappropiate_flag_fields_to_comments.rb @@ -1,4 +1,4 @@ -class AddInappropiateFlagFieldsToComments < ActiveRecord::Migration +class AddInappropiateFlagFieldsToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :flagged_as_inappropiate_at, :datetime add_column :comments, :inappropiate_flags_count, :integer, default: 0 diff --git a/db/migrate/20150820104552_add_inappropiate_flag_fields_to_debates.rb b/db/migrate/20150820104552_add_inappropiate_flag_fields_to_debates.rb index c5376ed62..d5c90520b 100644 --- a/db/migrate/20150820104552_add_inappropiate_flag_fields_to_debates.rb +++ b/db/migrate/20150820104552_add_inappropiate_flag_fields_to_debates.rb @@ -1,4 +1,4 @@ -class AddInappropiateFlagFieldsToDebates < ActiveRecord::Migration +class AddInappropiateFlagFieldsToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :flagged_as_inappropiate_at, :datetime add_column :debates, :inappropiate_flags_count, :integer, default: 0 diff --git a/db/migrate/20150821130019_changes_user_registrations_fields.rb b/db/migrate/20150821130019_changes_user_registrations_fields.rb index 600762324..61ca5c5bf 100644 --- a/db/migrate/20150821130019_changes_user_registrations_fields.rb +++ b/db/migrate/20150821130019_changes_user_registrations_fields.rb @@ -1,4 +1,4 @@ -class ChangesUserRegistrationsFields < ActiveRecord::Migration +class ChangesUserRegistrationsFields < ActiveRecord::Migration[4.2] def change add_column :users, :username, :string diff --git a/db/migrate/20150821180131_add_reviewed_at_to_comments.rb b/db/migrate/20150821180131_add_reviewed_at_to_comments.rb index b854002ac..7dcff0802 100644 --- a/db/migrate/20150821180131_add_reviewed_at_to_comments.rb +++ b/db/migrate/20150821180131_add_reviewed_at_to_comments.rb @@ -1,4 +1,4 @@ -class AddReviewedAtToComments < ActiveRecord::Migration +class AddReviewedAtToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :reviewed_at, :datetime end diff --git a/db/migrate/20150821180155_add_reviewed_at_to_debates.rb b/db/migrate/20150821180155_add_reviewed_at_to_debates.rb index c02ed3e3b..7945717a6 100644 --- a/db/migrate/20150821180155_add_reviewed_at_to_debates.rb +++ b/db/migrate/20150821180155_add_reviewed_at_to_debates.rb @@ -1,4 +1,4 @@ -class AddReviewedAtToDebates < ActiveRecord::Migration +class AddReviewedAtToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :reviewed_at, :datetime end diff --git a/db/migrate/20150822095305_create_verified_users.rb b/db/migrate/20150822095305_create_verified_users.rb index bb0c54042..1f23e0b5b 100644 --- a/db/migrate/20150822095305_create_verified_users.rb +++ b/db/migrate/20150822095305_create_verified_users.rb @@ -1,6 +1,6 @@ -class CreateVerifiedUsers < ActiveRecord::Migration +class CreateVerifiedUsers < ActiveRecord::Migration[4.2] def change - unless ActiveRecord::Base.connection.table_exists? 'verified_users' + unless ActiveRecord::Base.connection.data_source_exists?("verified_users") create_table :verified_users do |t| t.string :document_number t.string :document_type diff --git a/db/migrate/20150822100557_add_document_to_users.rb b/db/migrate/20150822100557_add_document_to_users.rb index 48259c417..45c5df8e7 100644 --- a/db/migrate/20150822100557_add_document_to_users.rb +++ b/db/migrate/20150822100557_add_document_to_users.rb @@ -1,4 +1,4 @@ -class AddDocumentToUsers < ActiveRecord::Migration +class AddDocumentToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :document_number, :string add_column :users, :document_type, :string diff --git a/db/migrate/20150822132547_add_residence_verified_at_to_users.rb b/db/migrate/20150822132547_add_residence_verified_at_to_users.rb index 65750fe82..4c5dc2f6d 100644 --- a/db/migrate/20150822132547_add_residence_verified_at_to_users.rb +++ b/db/migrate/20150822132547_add_residence_verified_at_to_users.rb @@ -1,4 +1,4 @@ -class AddResidenceVerifiedAtToUsers < ActiveRecord::Migration +class AddResidenceVerifiedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :residence_verified_at, :datetime end diff --git a/db/migrate/20150823111403_add_letter_to_users.rb b/db/migrate/20150823111403_add_letter_to_users.rb index bdb7c8684..0423ba959 100644 --- a/db/migrate/20150823111403_add_letter_to_users.rb +++ b/db/migrate/20150823111403_add_letter_to_users.rb @@ -1,4 +1,4 @@ -class AddLetterToUsers < ActiveRecord::Migration +class AddLetterToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :letter_requested, :boolean, default: false add_column :users, :letter_sent_at, :datetime diff --git a/db/migrate/20150823114519_add_email_verified_at_to_users.rb b/db/migrate/20150823114519_add_email_verified_at_to_users.rb index 69a6b6ec1..97071989e 100644 --- a/db/migrate/20150823114519_add_email_verified_at_to_users.rb +++ b/db/migrate/20150823114519_add_email_verified_at_to_users.rb @@ -1,4 +1,4 @@ -class AddEmailVerifiedAtToUsers < ActiveRecord::Migration +class AddEmailVerifiedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :email_verified_at, :datetime end diff --git a/db/migrate/20150823121109_add_email_verification_to_users.rb b/db/migrate/20150823121109_add_email_verification_to_users.rb index 4342cc174..a0990a49b 100644 --- a/db/migrate/20150823121109_add_email_verification_to_users.rb +++ b/db/migrate/20150823121109_add_email_verification_to_users.rb @@ -1,4 +1,4 @@ -class AddEmailVerificationToUsers < ActiveRecord::Migration +class AddEmailVerificationToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :email_verification_token, :string add_column :users, :email_for_verification, :string diff --git a/db/migrate/20150824110104_add_verified_user_sms_verified_at_to_users.rb b/db/migrate/20150824110104_add_verified_user_sms_verified_at_to_users.rb index 06d8f47d0..86da8989b 100644 --- a/db/migrate/20150824110104_add_verified_user_sms_verified_at_to_users.rb +++ b/db/migrate/20150824110104_add_verified_user_sms_verified_at_to_users.rb @@ -1,4 +1,4 @@ -class AddVerifiedUserSmsVerifiedAtToUsers < ActiveRecord::Migration +class AddVerifiedUserSmsVerifiedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :verified_user_sms_verified_at, :datetime end diff --git a/db/migrate/20150824111844_add_moderator_id_to_comment.rb b/db/migrate/20150824111844_add_moderator_id_to_comment.rb index 014c3ecf3..7e46415cf 100644 --- a/db/migrate/20150824111844_add_moderator_id_to_comment.rb +++ b/db/migrate/20150824111844_add_moderator_id_to_comment.rb @@ -1,4 +1,4 @@ -class AddModeratorIdToComment < ActiveRecord::Migration +class AddModeratorIdToComment < ActiveRecord::Migration[4.2] def change add_column :comments, :moderator_id, :integer, default: nil end diff --git a/db/migrate/20150824113326_add_administrator_id_to_comment.rb b/db/migrate/20150824113326_add_administrator_id_to_comment.rb index 7be8274cb..943419e0a 100644 --- a/db/migrate/20150824113326_add_administrator_id_to_comment.rb +++ b/db/migrate/20150824113326_add_administrator_id_to_comment.rb @@ -1,4 +1,4 @@ -class AddAdministratorIdToComment < ActiveRecord::Migration +class AddAdministratorIdToComment < ActiveRecord::Migration[4.2] def change add_column :comments, :administrator_id, :integer, default: nil end diff --git a/db/migrate/20150824144524_create_identities.rb b/db/migrate/20150824144524_create_identities.rb index 38a5e603a..57d36e38e 100644 --- a/db/migrate/20150824144524_create_identities.rb +++ b/db/migrate/20150824144524_create_identities.rb @@ -1,4 +1,4 @@ -class CreateIdentities < ActiveRecord::Migration +class CreateIdentities < ActiveRecord::Migration[4.2] def change create_table :identities do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20150825124821_adds_votable_cache_field_to_comments.rb b/db/migrate/20150825124821_adds_votable_cache_field_to_comments.rb index e2da7e12f..50297aa9c 100644 --- a/db/migrate/20150825124821_adds_votable_cache_field_to_comments.rb +++ b/db/migrate/20150825124821_adds_votable_cache_field_to_comments.rb @@ -1,4 +1,4 @@ -class AddsVotableCacheFieldToComments < ActiveRecord::Migration +class AddsVotableCacheFieldToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :cached_votes_total, :integer, default: 0 add_column :comments, :cached_votes_up, :integer, default: 0 diff --git a/db/migrate/20150825124827_adds_votable_cache_field_to_debates.rb b/db/migrate/20150825124827_adds_votable_cache_field_to_debates.rb index 07df8cf22..834d5310d 100644 --- a/db/migrate/20150825124827_adds_votable_cache_field_to_debates.rb +++ b/db/migrate/20150825124827_adds_votable_cache_field_to_debates.rb @@ -1,4 +1,4 @@ -class AddsVotableCacheFieldToDebates < ActiveRecord::Migration +class AddsVotableCacheFieldToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :cached_votes_total, :integer, default: 0 add_column :debates, :cached_votes_up, :integer, default: 0 diff --git a/db/migrate/20150825165517_add_sms_tried_to_users.rb b/db/migrate/20150825165517_add_sms_tried_to_users.rb index 280ab5b15..82a55d96d 100644 --- a/db/migrate/20150825165517_add_sms_tried_to_users.rb +++ b/db/migrate/20150825165517_add_sms_tried_to_users.rb @@ -1,4 +1,4 @@ -class AddSmsTriedToUsers < ActiveRecord::Migration +class AddSmsTriedToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :sms_tries, :integer, default: 0 end diff --git a/db/migrate/20150825175647_add_residence_verification_tries_to_users.rb b/db/migrate/20150825175647_add_residence_verification_tries_to_users.rb index fb8a9ed6c..f2fd9492c 100644 --- a/db/migrate/20150825175647_add_residence_verification_tries_to_users.rb +++ b/db/migrate/20150825175647_add_residence_verification_tries_to_users.rb @@ -1,4 +1,4 @@ -class AddResidenceVerificationTriesToUsers < ActiveRecord::Migration +class AddResidenceVerificationTriesToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :residence_verification_tries, :integer, default: 0 end diff --git a/db/migrate/20150825201922_create_addresses.rb b/db/migrate/20150825201922_create_addresses.rb index f3bc11ec2..df23d954e 100644 --- a/db/migrate/20150825201922_create_addresses.rb +++ b/db/migrate/20150825201922_create_addresses.rb @@ -1,4 +1,4 @@ -class CreateAddresses < ActiveRecord::Migration +class CreateAddresses < ActiveRecord::Migration[4.2] def change create_table :addresses do |t| t.integer :user_id diff --git a/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb b/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb index 86bebd8e1..fdbffa843 100644 --- a/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb +++ b/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb @@ -1,4 +1,4 @@ -class RenameReviewedAtToArchivedAtInCommentsAndDebates < ActiveRecord::Migration +class RenameReviewedAtToArchivedAtInCommentsAndDebates < ActiveRecord::Migration[4.2] def change rename_column :comments, :reviewed_at, :archived_at rename_column :debates, :reviewed_at, :archived_at diff --git a/db/migrate/20150826112500_add_comments_count_to_debate.rb b/db/migrate/20150826112500_add_comments_count_to_debate.rb index bf416b669..224a80f5e 100644 --- a/db/migrate/20150826112500_add_comments_count_to_debate.rb +++ b/db/migrate/20150826112500_add_comments_count_to_debate.rb @@ -1,4 +1,4 @@ -class AddCommentsCountToDebate < ActiveRecord::Migration +class AddCommentsCountToDebate < ActiveRecord::Migration[4.2] def change add_column :debates, :comments_count, :integer, default: 0 end diff --git a/db/migrate/20150826182010_refactor_verification_columns.rb b/db/migrate/20150826182010_refactor_verification_columns.rb index 1133d323e..02d7de5e5 100644 --- a/db/migrate/20150826182010_refactor_verification_columns.rb +++ b/db/migrate/20150826182010_refactor_verification_columns.rb @@ -1,4 +1,4 @@ -class RefactorVerificationColumns < ActiveRecord::Migration +class RefactorVerificationColumns < ActiveRecord::Migration[4.2] def change rename_column :users, :sms_verification_code, :sms_confirmation_code diff --git a/db/migrate/20150827080624_rename_inappropiate_flags_as_flags.rb b/db/migrate/20150827080624_rename_inappropiate_flags_as_flags.rb index 26058bde0..3cdcf7f0f 100644 --- a/db/migrate/20150827080624_rename_inappropiate_flags_as_flags.rb +++ b/db/migrate/20150827080624_rename_inappropiate_flags_as_flags.rb @@ -1,4 +1,4 @@ -class RenameInappropiateFlagsAsFlags < ActiveRecord::Migration +class RenameInappropiateFlagsAsFlags < ActiveRecord::Migration[4.2] def change rename_table :inappropiate_flags, :flags end diff --git a/db/migrate/20150827080641_rename_archived_at_to_ignored_flag_at_in_comments_and_debates.rb b/db/migrate/20150827080641_rename_archived_at_to_ignored_flag_at_in_comments_and_debates.rb index 5a0c90085..930554d42 100644 --- a/db/migrate/20150827080641_rename_archived_at_to_ignored_flag_at_in_comments_and_debates.rb +++ b/db/migrate/20150827080641_rename_archived_at_to_ignored_flag_at_in_comments_and_debates.rb @@ -1,4 +1,4 @@ -class RenameArchivedAtToIgnoredFlagAtInCommentsAndDebates < ActiveRecord::Migration +class RenameArchivedAtToIgnoredFlagAtInCommentsAndDebates < ActiveRecord::Migration[4.2] def change rename_column :comments, :archived_at, :ignored_flag_at rename_column :debates, :archived_at, :ignored_flag_at diff --git a/db/migrate/20150827080701_add_confirmed_hide_at_to_comments_and_debates.rb b/db/migrate/20150827080701_add_confirmed_hide_at_to_comments_and_debates.rb index 20d2872ac..91306a9ca 100644 --- a/db/migrate/20150827080701_add_confirmed_hide_at_to_comments_and_debates.rb +++ b/db/migrate/20150827080701_add_confirmed_hide_at_to_comments_and_debates.rb @@ -1,4 +1,4 @@ -class AddConfirmedHideAtToCommentsAndDebates < ActiveRecord::Migration +class AddConfirmedHideAtToCommentsAndDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :confirmed_hide_at, :datetime add_column :comments, :confirmed_hide_at, :datetime diff --git a/db/migrate/20150827081657_rename_inappropiate_flags_count_to_flags_count_in_debates_and_comments.rb b/db/migrate/20150827081657_rename_inappropiate_flags_count_to_flags_count_in_debates_and_comments.rb index 2f2a9285d..ead77388e 100644 --- a/db/migrate/20150827081657_rename_inappropiate_flags_count_to_flags_count_in_debates_and_comments.rb +++ b/db/migrate/20150827081657_rename_inappropiate_flags_count_to_flags_count_in_debates_and_comments.rb @@ -1,4 +1,4 @@ -class RenameInappropiateFlagsCountToFlagsCountInDebatesAndComments < ActiveRecord::Migration +class RenameInappropiateFlagsCountToFlagsCountInDebatesAndComments < ActiveRecord::Migration[4.2] def change rename_column :debates, :inappropiate_flags_count, :flags_count rename_column :comments, :inappropiate_flags_count, :flags_count diff --git a/db/migrate/20150827083232_remove_flagged_as_inappropiate_at_from_comments_and_debates.rb b/db/migrate/20150827083232_remove_flagged_as_inappropiate_at_from_comments_and_debates.rb index c226ecb3f..e68af1d6c 100644 --- a/db/migrate/20150827083232_remove_flagged_as_inappropiate_at_from_comments_and_debates.rb +++ b/db/migrate/20150827083232_remove_flagged_as_inappropiate_at_from_comments_and_debates.rb @@ -1,4 +1,4 @@ -class RemoveFlaggedAsInappropiateAtFromCommentsAndDebates < ActiveRecord::Migration +class RemoveFlaggedAsInappropiateAtFromCommentsAndDebates < ActiveRecord::Migration[4.2] def change remove_column :debates, :flagged_as_inappropiate_at remove_column :comments, :flagged_as_inappropiate_at diff --git a/db/migrate/20150828085718_add_confirmed_hide_at_to_users.rb b/db/migrate/20150828085718_add_confirmed_hide_at_to_users.rb index ca299aa5e..652e5c05b 100644 --- a/db/migrate/20150828085718_add_confirmed_hide_at_to_users.rb +++ b/db/migrate/20150828085718_add_confirmed_hide_at_to_users.rb @@ -1,4 +1,4 @@ -class AddConfirmedHideAtToUsers < ActiveRecord::Migration +class AddConfirmedHideAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :confirmed_hide_at, :datetime end diff --git a/db/migrate/20150830212600_add_cached_anonymous_votes_total_to_debate.rb b/db/migrate/20150830212600_add_cached_anonymous_votes_total_to_debate.rb index 196d5b517..0b8d260b9 100644 --- a/db/migrate/20150830212600_add_cached_anonymous_votes_total_to_debate.rb +++ b/db/migrate/20150830212600_add_cached_anonymous_votes_total_to_debate.rb @@ -1,4 +1,4 @@ -class AddCachedAnonymousVotesTotalToDebate < ActiveRecord::Migration +class AddCachedAnonymousVotesTotalToDebate < ActiveRecord::Migration[4.2] def change add_column :debates, :cached_anonymous_votes_total, :integer, default: 0 end diff --git a/db/migrate/20150902114558_add_ancestry_to_comments.rb b/db/migrate/20150902114558_add_ancestry_to_comments.rb index 7037c7e68..611be55d7 100644 --- a/db/migrate/20150902114558_add_ancestry_to_comments.rb +++ b/db/migrate/20150902114558_add_ancestry_to_comments.rb @@ -1,4 +1,4 @@ -class AddAncestryToComments < ActiveRecord::Migration +class AddAncestryToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :ancestry, :string diff --git a/db/migrate/20150902120006_remove_parent_id_from_comments.rb b/db/migrate/20150902120006_remove_parent_id_from_comments.rb index 219196533..e8fd4b38d 100644 --- a/db/migrate/20150902120006_remove_parent_id_from_comments.rb +++ b/db/migrate/20150902120006_remove_parent_id_from_comments.rb @@ -1,4 +1,4 @@ -class RemoveParentIdFromComments < ActiveRecord::Migration +class RemoveParentIdFromComments < ActiveRecord::Migration[4.2] def change Comment.build_ancestry_from_parent_ids! rescue nil diff --git a/db/migrate/20150902191315_add_letter_verification_code_to_users.rb b/db/migrate/20150902191315_add_letter_verification_code_to_users.rb index 83142122e..f9fe72261 100644 --- a/db/migrate/20150902191315_add_letter_verification_code_to_users.rb +++ b/db/migrate/20150902191315_add_letter_verification_code_to_users.rb @@ -1,4 +1,4 @@ -class AddLetterVerificationCodeToUsers < ActiveRecord::Migration +class AddLetterVerificationCodeToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :letter_verification_code, :string end diff --git a/db/migrate/20150903142924_remove_children_count_from_comments.rb b/db/migrate/20150903142924_remove_children_count_from_comments.rb index 6e4937335..3a74cd0d5 100644 --- a/db/migrate/20150903142924_remove_children_count_from_comments.rb +++ b/db/migrate/20150903142924_remove_children_count_from_comments.rb @@ -1,4 +1,4 @@ -class RemoveChildrenCountFromComments < ActiveRecord::Migration +class RemoveChildrenCountFromComments < ActiveRecord::Migration[4.2] def change remove_column :comments, :children_count, :integer, default: 0 end diff --git a/db/migrate/20150903155146_add_cached_votes_score_to_debate.rb b/db/migrate/20150903155146_add_cached_votes_score_to_debate.rb index 093b13671..30c78b94c 100644 --- a/db/migrate/20150903155146_add_cached_votes_score_to_debate.rb +++ b/db/migrate/20150903155146_add_cached_votes_score_to_debate.rb @@ -1,4 +1,4 @@ -class AddCachedVotesScoreToDebate < ActiveRecord::Migration +class AddCachedVotesScoreToDebate < ActiveRecord::Migration[4.2] def change add_column :debates, :cached_votes_score, :integer, default: 0 diff --git a/db/migrate/20150903171309_add_hot_score_to_debates.rb b/db/migrate/20150903171309_add_hot_score_to_debates.rb index 7e82d4c13..22330a0bf 100644 --- a/db/migrate/20150903171309_add_hot_score_to_debates.rb +++ b/db/migrate/20150903171309_add_hot_score_to_debates.rb @@ -1,4 +1,4 @@ -class AddHotScoreToDebates < ActiveRecord::Migration +class AddHotScoreToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :hot_score, :bigint, default: 0 end diff --git a/db/migrate/20150903200440_create_delayed_jobs.rb b/db/migrate/20150903200440_create_delayed_jobs.rb index 27fdcf6cc..f90bc1bc1 100644 --- a/db/migrate/20150903200440_create_delayed_jobs.rb +++ b/db/migrate/20150903200440_create_delayed_jobs.rb @@ -1,4 +1,4 @@ -class CreateDelayedJobs < ActiveRecord::Migration +class CreateDelayedJobs < ActiveRecord::Migration[4.2] def self.up create_table :delayed_jobs, force: true do |table| table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue diff --git a/db/migrate/20150907064631_add_hot_score_index_to_debates.rb b/db/migrate/20150907064631_add_hot_score_index_to_debates.rb index cbb33785b..ac5054889 100644 --- a/db/migrate/20150907064631_add_hot_score_index_to_debates.rb +++ b/db/migrate/20150907064631_add_hot_score_index_to_debates.rb @@ -1,4 +1,4 @@ -class AddHotScoreIndexToDebates < ActiveRecord::Migration +class AddHotScoreIndexToDebates < ActiveRecord::Migration[4.2] def change add_index(:debates, :hot_score) end diff --git a/db/migrate/20150908102936_add_confidence_score_to_debates.rb b/db/migrate/20150908102936_add_confidence_score_to_debates.rb index b0494a839..ac30fa72a 100644 --- a/db/migrate/20150908102936_add_confidence_score_to_debates.rb +++ b/db/migrate/20150908102936_add_confidence_score_to_debates.rb @@ -1,4 +1,4 @@ -class AddConfidenceScoreToDebates < ActiveRecord::Migration +class AddConfidenceScoreToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :confidence_score, :integer, default: 0 add_index :debates, :confidence_score diff --git a/db/migrate/20150909131133_set_username_limit.rb b/db/migrate/20150909131133_set_username_limit.rb index 4ef71693a..a9e60e1da 100644 --- a/db/migrate/20150909131133_set_username_limit.rb +++ b/db/migrate/20150909131133_set_username_limit.rb @@ -1,4 +1,4 @@ -class SetUsernameLimit < ActiveRecord::Migration +class SetUsernameLimit < ActiveRecord::Migration[4.2] def up execute "ALTER TABLE users ALTER COLUMN username TYPE VARCHAR(60) USING SUBSTR(username, 1, 60)" change_column :users, :username, :string, limit: 60 diff --git a/db/migrate/20150909135032_remove_comment_title.rb b/db/migrate/20150909135032_remove_comment_title.rb index daf224871..4e151bc70 100644 --- a/db/migrate/20150909135032_remove_comment_title.rb +++ b/db/migrate/20150909135032_remove_comment_title.rb @@ -1,4 +1,4 @@ -class RemoveCommentTitle < ActiveRecord::Migration +class RemoveCommentTitle < ActiveRecord::Migration[4.2] def change remove_column :comments, :title, :string end diff --git a/db/migrate/20150909142534_set_organization_name_limit.rb b/db/migrate/20150909142534_set_organization_name_limit.rb index 55ce2aa62..a90f82ac3 100644 --- a/db/migrate/20150909142534_set_organization_name_limit.rb +++ b/db/migrate/20150909142534_set_organization_name_limit.rb @@ -1,4 +1,4 @@ -class SetOrganizationNameLimit < ActiveRecord::Migration +class SetOrganizationNameLimit < ActiveRecord::Migration[4.2] def up execute "ALTER TABLE organizations ALTER COLUMN name TYPE VARCHAR(60) USING SUBSTR(name, 1, 60)" change_column :organizations, :name, :string, limit: 60 diff --git a/db/migrate/20150909153455_set_tag_name_limit.rb b/db/migrate/20150909153455_set_tag_name_limit.rb index f43dfe3e5..471392bee 100644 --- a/db/migrate/20150909153455_set_tag_name_limit.rb +++ b/db/migrate/20150909153455_set_tag_name_limit.rb @@ -1,4 +1,4 @@ -class SetTagNameLimit < ActiveRecord::Migration +class SetTagNameLimit < ActiveRecord::Migration[4.2] def up execute "ALTER TABLE tags ALTER COLUMN name TYPE VARCHAR(40) USING SUBSTR(name, 1, 40)" change_column :tags, :name, :string, limit: 40 diff --git a/db/migrate/20150909211203_create_failed_census_calls.rb b/db/migrate/20150909211203_create_failed_census_calls.rb index 0850f68ea..c00a38441 100644 --- a/db/migrate/20150909211203_create_failed_census_calls.rb +++ b/db/migrate/20150909211203_create_failed_census_calls.rb @@ -1,4 +1,4 @@ -class CreateFailedCensusCalls < ActiveRecord::Migration +class CreateFailedCensusCalls < ActiveRecord::Migration[4.2] def change create_table :failed_census_calls do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20150910092713_add_letter_verification_tries_to_users.rb b/db/migrate/20150910092713_add_letter_verification_tries_to_users.rb index 622ce6b2d..92efffb63 100644 --- a/db/migrate/20150910092713_add_letter_verification_tries_to_users.rb +++ b/db/migrate/20150910092713_add_letter_verification_tries_to_users.rb @@ -1,4 +1,4 @@ -class AddLetterVerificationTriesToUsers < ActiveRecord::Migration +class AddLetterVerificationTriesToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :letter_verification_tries, :integer, default: 0 end diff --git a/db/migrate/20150910133047_create_locks.rb b/db/migrate/20150910133047_create_locks.rb index 03611d97a..ae349b9ec 100644 --- a/db/migrate/20150910133047_create_locks.rb +++ b/db/migrate/20150910133047_create_locks.rb @@ -1,4 +1,4 @@ -class CreateLocks < ActiveRecord::Migration +class CreateLocks < ActiveRecord::Migration[4.2] def change create_table :locks do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20150910152734_remove_verification_tries_from_users.rb b/db/migrate/20150910152734_remove_verification_tries_from_users.rb index cffaa971c..53d6ed4b1 100644 --- a/db/migrate/20150910152734_remove_verification_tries_from_users.rb +++ b/db/migrate/20150910152734_remove_verification_tries_from_users.rb @@ -1,4 +1,4 @@ -class RemoveVerificationTriesFromUsers < ActiveRecord::Migration +class RemoveVerificationTriesFromUsers < ActiveRecord::Migration[4.2] def change remove_column :users, :sms_confirmation_tries, :integer, default: 0 remove_column :users, :residence_verification_tries, :integer, default: 0 diff --git a/db/migrate/20150911171301_create_proposal.rb b/db/migrate/20150911171301_create_proposal.rb index 37dd1bb85..79bb58eef 100644 --- a/db/migrate/20150911171301_create_proposal.rb +++ b/db/migrate/20150911171301_create_proposal.rb @@ -1,4 +1,4 @@ -class CreateProposal < ActiveRecord::Migration +class CreateProposal < ActiveRecord::Migration[4.2] def change create_table :proposals do |t| t.string "title", limit: 80 diff --git a/db/migrate/20150912145218_add_responsible_name_to_organizations.rb b/db/migrate/20150912145218_add_responsible_name_to_organizations.rb index 08598e7c4..3a747a703 100644 --- a/db/migrate/20150912145218_add_responsible_name_to_organizations.rb +++ b/db/migrate/20150912145218_add_responsible_name_to_organizations.rb @@ -1,4 +1,4 @@ -class AddResponsibleNameToOrganizations < ActiveRecord::Migration +class AddResponsibleNameToOrganizations < ActiveRecord::Migration[4.2] def up add_column :organizations, :responsible_name, :string, limit: 60 diff --git a/db/migrate/20150914113251_add_responsible_to_proposals.rb b/db/migrate/20150914113251_add_responsible_to_proposals.rb index c565c29df..c5c2b5fa0 100644 --- a/db/migrate/20150914113251_add_responsible_to_proposals.rb +++ b/db/migrate/20150914113251_add_responsible_to_proposals.rb @@ -1,4 +1,4 @@ -class AddResponsibleToProposals < ActiveRecord::Migration +class AddResponsibleToProposals < ActiveRecord::Migration[4.2] def change add_column :proposals, :responsible_name, :string, limit: 60 end diff --git a/db/migrate/20150914114019_change_email_config_field_in_user.rb b/db/migrate/20150914114019_change_email_config_field_in_user.rb index 90c875d60..a3de1a095 100644 --- a/db/migrate/20150914114019_change_email_config_field_in_user.rb +++ b/db/migrate/20150914114019_change_email_config_field_in_user.rb @@ -1,4 +1,4 @@ -class ChangeEmailConfigFieldInUser < ActiveRecord::Migration +class ChangeEmailConfigFieldInUser < ActiveRecord::Migration[4.2] def change rename_column :users, :email_on_debate_comment, :email_on_comment end diff --git a/db/migrate/20150914173834_add_summary_to_proposals.rb b/db/migrate/20150914173834_add_summary_to_proposals.rb index 7ebe2df9c..0d84c2196 100644 --- a/db/migrate/20150914173834_add_summary_to_proposals.rb +++ b/db/migrate/20150914173834_add_summary_to_proposals.rb @@ -1,4 +1,4 @@ -class AddSummaryToProposals < ActiveRecord::Migration +class AddSummaryToProposals < ActiveRecord::Migration[4.2] def change add_column :proposals, :summary, :text, limit: 280 end diff --git a/db/migrate/20150914181921_add_more_indexes_for_ahoy.rb b/db/migrate/20150914181921_add_more_indexes_for_ahoy.rb index 7fa8bedc4..86924a42d 100644 --- a/db/migrate/20150914181921_add_more_indexes_for_ahoy.rb +++ b/db/migrate/20150914181921_add_more_indexes_for_ahoy.rb @@ -1,4 +1,4 @@ -class AddMoreIndexesForAhoy < ActiveRecord::Migration +class AddMoreIndexesForAhoy < ActiveRecord::Migration[4.2] def change add_index :ahoy_events, [:name, :time] add_index :visits, [:started_at] diff --git a/db/migrate/20150914182652_adds_indexes.rb b/db/migrate/20150914182652_adds_indexes.rb index a22d0d16e..1f719a6ef 100644 --- a/db/migrate/20150914182652_adds_indexes.rb +++ b/db/migrate/20150914182652_adds_indexes.rb @@ -1,4 +1,4 @@ -class AddsIndexes < ActiveRecord::Migration +class AddsIndexes < ActiveRecord::Migration[4.2] def change add_index :debates, :author_id add_index :debates, [:author_id, :hidden_at] diff --git a/db/migrate/20150914184018_add_indexes_for_searches.rb b/db/migrate/20150914184018_add_indexes_for_searches.rb index 4a4467bea..252343464 100644 --- a/db/migrate/20150914184018_add_indexes_for_searches.rb +++ b/db/migrate/20150914184018_add_indexes_for_searches.rb @@ -1,4 +1,4 @@ -class AddIndexesForSearches < ActiveRecord::Migration +class AddIndexesForSearches < ActiveRecord::Migration[4.2] def change add_index :debates, :title # add_index :debates, :description diff --git a/db/migrate/20150914191003_add_video_url_to_proposal.rb b/db/migrate/20150914191003_add_video_url_to_proposal.rb index 298038e97..ba4decc36 100644 --- a/db/migrate/20150914191003_add_video_url_to_proposal.rb +++ b/db/migrate/20150914191003_add_video_url_to_proposal.rb @@ -1,4 +1,4 @@ -class AddVideoUrlToProposal < ActiveRecord::Migration +class AddVideoUrlToProposal < ActiveRecord::Migration[4.2] def change add_column :proposals, :video_url, :string end diff --git a/db/migrate/20150917102718_add_extra_counters_to_tags.rb b/db/migrate/20150917102718_add_extra_counters_to_tags.rb index 974784772..dfd1c444a 100644 --- a/db/migrate/20150917102718_add_extra_counters_to_tags.rb +++ b/db/migrate/20150917102718_add_extra_counters_to_tags.rb @@ -1,4 +1,4 @@ -class AddExtraCountersToTags < ActiveRecord::Migration +class AddExtraCountersToTags < ActiveRecord::Migration[4.2] def change add_column :tags, :debates_count, :integer, default: 0 add_column :tags, :proposals_count, :integer, default: 0 diff --git a/db/migrate/20150921095553_create_activities.rb b/db/migrate/20150921095553_create_activities.rb index 3fff14205..03582d459 100644 --- a/db/migrate/20150921095553_create_activities.rb +++ b/db/migrate/20150921095553_create_activities.rb @@ -1,4 +1,4 @@ -class CreateActivities < ActiveRecord::Migration +class CreateActivities < ActiveRecord::Migration[4.2] def change create_table :activities do |t| t.integer :user_id diff --git a/db/migrate/20150924112929_add_failed_census_calls_counter_cache_to_users.rb b/db/migrate/20150924112929_add_failed_census_calls_counter_cache_to_users.rb index e9f82c992..0e1c06e1c 100644 --- a/db/migrate/20150924112929_add_failed_census_calls_counter_cache_to_users.rb +++ b/db/migrate/20150924112929_add_failed_census_calls_counter_cache_to_users.rb @@ -1,4 +1,4 @@ -class AddFailedCensusCallsCounterCacheToUsers < ActiveRecord::Migration +class AddFailedCensusCallsCounterCacheToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :failed_census_calls_count, :integer, default: 0 end diff --git a/db/migrate/20150926113052_drop_addresses_table.rb b/db/migrate/20150926113052_drop_addresses_table.rb index 90d22c41a..58ea8e8b9 100644 --- a/db/migrate/20150926113052_drop_addresses_table.rb +++ b/db/migrate/20150926113052_drop_addresses_table.rb @@ -1,4 +1,4 @@ -class DropAddressesTable < ActiveRecord::Migration +class DropAddressesTable < ActiveRecord::Migration[4.2] def self.up drop_table :addresses end diff --git a/db/migrate/20150926115929_adds_resilient_locked_until_default.rb b/db/migrate/20150926115929_adds_resilient_locked_until_default.rb index 8043110cd..d3fb1f4e5 100644 --- a/db/migrate/20150926115929_adds_resilient_locked_until_default.rb +++ b/db/migrate/20150926115929_adds_resilient_locked_until_default.rb @@ -1,4 +1,4 @@ -class AddsResilientLockedUntilDefault < ActiveRecord::Migration +class AddsResilientLockedUntilDefault < ActiveRecord::Migration[4.2] def up change_column_default :locks, :locked_until, Time.new(2000, 1, 1, 1, 1, 1) diff --git a/db/migrate/20150928115005_create_notifications.rb b/db/migrate/20150928115005_create_notifications.rb index 42bbbf72e..fc2507464 100644 --- a/db/migrate/20150928115005_create_notifications.rb +++ b/db/migrate/20150928115005_create_notifications.rb @@ -1,4 +1,4 @@ -class CreateNotifications < ActiveRecord::Migration +class CreateNotifications < ActiveRecord::Migration[4.2] def change create_table :notifications do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20150930082311_create_managers.rb b/db/migrate/20150930082311_create_managers.rb index 3a921bf76..bfcdd2a74 100644 --- a/db/migrate/20150930082311_create_managers.rb +++ b/db/migrate/20150930082311_create_managers.rb @@ -1,4 +1,4 @@ -class CreateManagers < ActiveRecord::Migration +class CreateManagers < ActiveRecord::Migration[4.2] def change create_table :managers do |t| t.string :username, null: false diff --git a/db/migrate/20151002144206_add_unconfirmed_document_number_to_user.rb b/db/migrate/20151002144206_add_unconfirmed_document_number_to_user.rb index 7a00acb91..3c3579bbd 100644 --- a/db/migrate/20151002144206_add_unconfirmed_document_number_to_user.rb +++ b/db/migrate/20151002144206_add_unconfirmed_document_number_to_user.rb @@ -1,4 +1,4 @@ -class AddUnconfirmedDocumentNumberToUser < ActiveRecord::Migration +class AddUnconfirmedDocumentNumberToUser < ActiveRecord::Migration[4.2] def change add_column :users, :unconfirmed_document_number, :string end diff --git a/db/migrate/20151013145126_remove_unconfirmed_document_number_from_user.rb b/db/migrate/20151013145126_remove_unconfirmed_document_number_from_user.rb index cabbdbc27..fadcce2a9 100644 --- a/db/migrate/20151013145126_remove_unconfirmed_document_number_from_user.rb +++ b/db/migrate/20151013145126_remove_unconfirmed_document_number_from_user.rb @@ -1,4 +1,4 @@ -class RemoveUnconfirmedDocumentNumberFromUser < ActiveRecord::Migration +class RemoveUnconfirmedDocumentNumberFromUser < ActiveRecord::Migration[4.2] def change remove_column :users, :unconfirmed_document_number, :string end diff --git a/db/migrate/20151013145757_add_level_two_verified_at_to_users.rb b/db/migrate/20151013145757_add_level_two_verified_at_to_users.rb index aa38dd183..b96f1c2d1 100644 --- a/db/migrate/20151013145757_add_level_two_verified_at_to_users.rb +++ b/db/migrate/20151013145757_add_level_two_verified_at_to_users.rb @@ -1,4 +1,4 @@ -class AddLevelTwoVerifiedAtToUsers < ActiveRecord::Migration +class AddLevelTwoVerifiedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :level_two_verified_at, :datetime end diff --git a/db/migrate/20151015135154_destroy_manager.rb b/db/migrate/20151015135154_destroy_manager.rb index 41e16f0e3..aeaeabd1c 100644 --- a/db/migrate/20151015135154_destroy_manager.rb +++ b/db/migrate/20151015135154_destroy_manager.rb @@ -1,4 +1,4 @@ -class DestroyManager < ActiveRecord::Migration +class DestroyManager < ActiveRecord::Migration[4.2] def self.up drop_table :managers end diff --git a/db/migrate/20151016110703_add_erase_reason_to_users.rb b/db/migrate/20151016110703_add_erase_reason_to_users.rb index be88869b5..281987b87 100644 --- a/db/migrate/20151016110703_add_erase_reason_to_users.rb +++ b/db/migrate/20151016110703_add_erase_reason_to_users.rb @@ -1,4 +1,4 @@ -class AddEraseReasonToUsers < ActiveRecord::Migration +class AddEraseReasonToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :erase_reason, :string end diff --git a/db/migrate/20151019133719_remove_user_constraints.rb b/db/migrate/20151019133719_remove_user_constraints.rb index 0f59a3d34..c78bf6660 100644 --- a/db/migrate/20151019133719_remove_user_constraints.rb +++ b/db/migrate/20151019133719_remove_user_constraints.rb @@ -1,4 +1,4 @@ -class RemoveUserConstraints < ActiveRecord::Migration +class RemoveUserConstraints < ActiveRecord::Migration[4.2] def change change_column(:users, :email, :string, null: true, unique: true) end diff --git a/db/migrate/20151020112354_remove_letter_sent_at_from_users.rb b/db/migrate/20151020112354_remove_letter_sent_at_from_users.rb index 0b982dfbb..c3d52fa2b 100644 --- a/db/migrate/20151020112354_remove_letter_sent_at_from_users.rb +++ b/db/migrate/20151020112354_remove_letter_sent_at_from_users.rb @@ -1,4 +1,4 @@ -class RemoveLetterSentAtFromUsers < ActiveRecord::Migration +class RemoveLetterSentAtFromUsers < ActiveRecord::Migration[4.2] def change remove_column :users, :letter_sent_at, :datetime end diff --git a/db/migrate/20151020135111_create_campaigns.rb b/db/migrate/20151020135111_create_campaigns.rb index 192b7d615..943bae8af 100644 --- a/db/migrate/20151020135111_create_campaigns.rb +++ b/db/migrate/20151020135111_create_campaigns.rb @@ -1,4 +1,4 @@ -class CreateCampaigns < ActiveRecord::Migration +class CreateCampaigns < ActiveRecord::Migration[4.2] def change create_table :campaigns do |t| t.string :name diff --git a/db/migrate/20151021113348_add_erased_at_to_users.rb b/db/migrate/20151021113348_add_erased_at_to_users.rb index 9431c3861..52e075081 100644 --- a/db/migrate/20151021113348_add_erased_at_to_users.rb +++ b/db/migrate/20151021113348_add_erased_at_to_users.rb @@ -1,4 +1,4 @@ -class AddErasedAtToUsers < ActiveRecord::Migration +class AddErasedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :erased_at, :datetime end diff --git a/db/migrate/20151028145921_add_confidence_score_to_comments.rb b/db/migrate/20151028145921_add_confidence_score_to_comments.rb index 636b648bb..540eff133 100644 --- a/db/migrate/20151028145921_add_confidence_score_to_comments.rb +++ b/db/migrate/20151028145921_add_confidence_score_to_comments.rb @@ -1,4 +1,4 @@ -class AddConfidenceScoreToComments < ActiveRecord::Migration +class AddConfidenceScoreToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :confidence_score, :integer, index: true end diff --git a/db/migrate/20151028213830_add_unaccent_extension.rb b/db/migrate/20151028213830_add_unaccent_extension.rb index 60fbc1310..07a0ffb7b 100644 --- a/db/migrate/20151028213830_add_unaccent_extension.rb +++ b/db/migrate/20151028213830_add_unaccent_extension.rb @@ -1,4 +1,4 @@ -class AddUnaccentExtension < ActiveRecord::Migration +class AddUnaccentExtension < ActiveRecord::Migration[4.2] def change execute "create extension if not exists unaccent" end diff --git a/db/migrate/20151028221647_add_pg_trgm_extension.rb b/db/migrate/20151028221647_add_pg_trgm_extension.rb index 97443c2c2..4cd532b1f 100644 --- a/db/migrate/20151028221647_add_pg_trgm_extension.rb +++ b/db/migrate/20151028221647_add_pg_trgm_extension.rb @@ -1,4 +1,4 @@ -class AddPgTrgmExtension < ActiveRecord::Migration +class AddPgTrgmExtension < ActiveRecord::Migration[4.2] def change execute "create extension if not exists pg_trgm" end diff --git a/db/migrate/20151030182217_add_physical_votes_to_proposals.rb b/db/migrate/20151030182217_add_physical_votes_to_proposals.rb index 367f09f48..e7b851734 100644 --- a/db/migrate/20151030182217_add_physical_votes_to_proposals.rb +++ b/db/migrate/20151030182217_add_physical_votes_to_proposals.rb @@ -1,4 +1,4 @@ -class AddPhysicalVotesToProposals < ActiveRecord::Migration +class AddPhysicalVotesToProposals < ActiveRecord::Migration[4.2] def change add_column :proposals, :physical_votes, :integer, default: 0 end diff --git a/db/migrate/20151103175139_make_comments_confidence_score_default_to_0.rb b/db/migrate/20151103175139_make_comments_confidence_score_default_to_0.rb index 788601c44..de12b54be 100644 --- a/db/migrate/20151103175139_make_comments_confidence_score_default_to_0.rb +++ b/db/migrate/20151103175139_make_comments_confidence_score_default_to_0.rb @@ -1,4 +1,4 @@ -class MakeCommentsConfidenceScoreDefaultTo0 < ActiveRecord::Migration +class MakeCommentsConfidenceScoreDefaultTo0 < ActiveRecord::Migration[4.2] def change change_column :comments, :confidence_score, :integer, default: 0, null: false, index: true end diff --git a/db/migrate/20151103194329_add_public_activity_to_users.rb b/db/migrate/20151103194329_add_public_activity_to_users.rb index 8feebdff7..b7217aac1 100644 --- a/db/migrate/20151103194329_add_public_activity_to_users.rb +++ b/db/migrate/20151103194329_add_public_activity_to_users.rb @@ -1,4 +1,4 @@ -class AddPublicActivityToUsers < ActiveRecord::Migration +class AddPublicActivityToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :public_activity, :boolean, default: true end diff --git a/db/migrate/20151111202657_adds_tsvector_update_trigger.rb b/db/migrate/20151111202657_adds_tsvector_update_trigger.rb index ed60a259d..17ae75c54 100644 --- a/db/migrate/20151111202657_adds_tsvector_update_trigger.rb +++ b/db/migrate/20151111202657_adds_tsvector_update_trigger.rb @@ -1,4 +1,4 @@ -class AddsTsvectorUpdateTrigger < ActiveRecord::Migration +class AddsTsvectorUpdateTrigger < ActiveRecord::Migration[4.2] def up add_column :proposals, :tsv, :tsvector diff --git a/db/migrate/20151117222604_create_annotations.rb b/db/migrate/20151117222604_create_annotations.rb index a462b4672..b299cc82b 100644 --- a/db/migrate/20151117222604_create_annotations.rb +++ b/db/migrate/20151117222604_create_annotations.rb @@ -1,4 +1,4 @@ -class CreateAnnotations < ActiveRecord::Migration +class CreateAnnotations < ActiveRecord::Migration[4.2] def change create_table :annotations do |t| t.string :quote diff --git a/db/migrate/20151117225104_add_proposals_to_annotations.rb b/db/migrate/20151117225104_add_proposals_to_annotations.rb index a4b54b2b5..1b692bee6 100644 --- a/db/migrate/20151117225104_add_proposals_to_annotations.rb +++ b/db/migrate/20151117225104_add_proposals_to_annotations.rb @@ -1,4 +1,4 @@ -class AddProposalsToAnnotations < ActiveRecord::Migration +class AddProposalsToAnnotations < ActiveRecord::Migration[4.2] def change add_reference :annotations, :proposal, index: true, foreign_key: true end diff --git a/db/migrate/20151118160928_add_user_to_annotations.rb b/db/migrate/20151118160928_add_user_to_annotations.rb index 0594a4bf3..3d2f04b24 100644 --- a/db/migrate/20151118160928_add_user_to_annotations.rb +++ b/db/migrate/20151118160928_add_user_to_annotations.rb @@ -1,4 +1,4 @@ -class AddUserToAnnotations < ActiveRecord::Migration +class AddUserToAnnotations < ActiveRecord::Migration[4.2] def change add_reference :annotations, :user, index: true, foreign_key: true end diff --git a/db/migrate/20151215113827_create_legislations.rb b/db/migrate/20151215113827_create_legislations.rb index 5ea4ff5be..334d63470 100644 --- a/db/migrate/20151215113827_create_legislations.rb +++ b/db/migrate/20151215113827_create_legislations.rb @@ -1,4 +1,4 @@ -class CreateLegislations < ActiveRecord::Migration +class CreateLegislations < ActiveRecord::Migration[4.2] def change create_table :legislations do |t| t.string :title diff --git a/db/migrate/20151215115319_add_legislation_id_to_annotations.rb b/db/migrate/20151215115319_add_legislation_id_to_annotations.rb index fc415f0a8..419ac67ab 100644 --- a/db/migrate/20151215115319_add_legislation_id_to_annotations.rb +++ b/db/migrate/20151215115319_add_legislation_id_to_annotations.rb @@ -1,4 +1,4 @@ -class AddLegislationIdToAnnotations < ActiveRecord::Migration +class AddLegislationIdToAnnotations < ActiveRecord::Migration[4.2] def change remove_reference :annotations, :proposal add_reference :annotations, :legislation, index: true, foreign_key: true diff --git a/db/migrate/20151215165824_add_newsletter_subscription_to_users.rb b/db/migrate/20151215165824_add_newsletter_subscription_to_users.rb index 61e741c27..d7a0bc5e5 100644 --- a/db/migrate/20151215165824_add_newsletter_subscription_to_users.rb +++ b/db/migrate/20151215165824_add_newsletter_subscription_to_users.rb @@ -1,4 +1,4 @@ -class AddNewsletterSubscriptionToUsers < ActiveRecord::Migration +class AddNewsletterSubscriptionToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :newsletter, :boolean, default: false end diff --git a/db/migrate/20151218114205_create_spending_proposals.rb b/db/migrate/20151218114205_create_spending_proposals.rb index 5bcd3aba1..bac09b9c3 100644 --- a/db/migrate/20151218114205_create_spending_proposals.rb +++ b/db/migrate/20151218114205_create_spending_proposals.rb @@ -1,4 +1,4 @@ -class CreateSpendingProposals < ActiveRecord::Migration +class CreateSpendingProposals < ActiveRecord::Migration[4.2] def change create_table :spending_proposals do |t| t.string :title diff --git a/db/migrate/20160104203329_add_spending_proposals_counter_to_tags.rb b/db/migrate/20160104203329_add_spending_proposals_counter_to_tags.rb index 2aade49cb..1384e06be 100644 --- a/db/migrate/20160104203329_add_spending_proposals_counter_to_tags.rb +++ b/db/migrate/20160104203329_add_spending_proposals_counter_to_tags.rb @@ -1,4 +1,4 @@ -class AddSpendingProposalsCounterToTags < ActiveRecord::Migration +class AddSpendingProposalsCounterToTags < ActiveRecord::Migration[4.2] def change add_column :tags, :spending_proposals_count, :integer, default: 0 add_index :tags, :spending_proposals_count diff --git a/db/migrate/20160104203438_add_spending_proposals_indexes.rb b/db/migrate/20160104203438_add_spending_proposals_indexes.rb index 777b0f678..6b348d96f 100644 --- a/db/migrate/20160104203438_add_spending_proposals_indexes.rb +++ b/db/migrate/20160104203438_add_spending_proposals_indexes.rb @@ -1,4 +1,4 @@ -class AddSpendingProposalsIndexes < ActiveRecord::Migration +class AddSpendingProposalsIndexes < ActiveRecord::Migration[4.2] def change add_index :spending_proposals, :author_id end diff --git a/db/migrate/20160105121132_create_geozones.rb b/db/migrate/20160105121132_create_geozones.rb index 3e43339e9..aa74813ec 100644 --- a/db/migrate/20160105121132_create_geozones.rb +++ b/db/migrate/20160105121132_create_geozones.rb @@ -1,4 +1,4 @@ -class CreateGeozones < ActiveRecord::Migration +class CreateGeozones < ActiveRecord::Migration[4.2] def change create_table :geozones do |t| t.string :name diff --git a/db/migrate/20160105170113_merge_activities_and_notifications.rb b/db/migrate/20160105170113_merge_activities_and_notifications.rb index fac5b213d..8bf113ea7 100644 --- a/db/migrate/20160105170113_merge_activities_and_notifications.rb +++ b/db/migrate/20160105170113_merge_activities_and_notifications.rb @@ -1,4 +1,4 @@ -class MergeActivitiesAndNotifications < ActiveRecord::Migration +class MergeActivitiesAndNotifications < ActiveRecord::Migration[4.2] def change change_table :notifications do |t| t.remove :read diff --git a/db/migrate/20160107114749_add_geozone_to_spending_proposal.rb b/db/migrate/20160107114749_add_geozone_to_spending_proposal.rb index 62130fd9b..6ce760fc1 100644 --- a/db/migrate/20160107114749_add_geozone_to_spending_proposal.rb +++ b/db/migrate/20160107114749_add_geozone_to_spending_proposal.rb @@ -1,4 +1,4 @@ -class AddGeozoneToSpendingProposal < ActiveRecord::Migration +class AddGeozoneToSpendingProposal < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :geozone_id, :integer, default: nil add_index :spending_proposals, :geozone_id diff --git a/db/migrate/20160107132059_add_resolution_to_spending_proposals.rb b/db/migrate/20160107132059_add_resolution_to_spending_proposals.rb index 18365a715..d93a0c50f 100644 --- a/db/migrate/20160107132059_add_resolution_to_spending_proposals.rb +++ b/db/migrate/20160107132059_add_resolution_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddResolutionToSpendingProposals < ActiveRecord::Migration +class AddResolutionToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :resolution, :string, default: nil add_index :spending_proposals, :resolution diff --git a/db/migrate/20160108114750_add_counter_to_notifications.rb b/db/migrate/20160108114750_add_counter_to_notifications.rb index 7cf3c434c..8024b2acf 100644 --- a/db/migrate/20160108114750_add_counter_to_notifications.rb +++ b/db/migrate/20160108114750_add_counter_to_notifications.rb @@ -1,4 +1,4 @@ -class AddCounterToNotifications < ActiveRecord::Migration +class AddCounterToNotifications < ActiveRecord::Migration[4.2] def change add_column :notifications, :counter, :integer, default: 1 end diff --git a/db/migrate/20160108133501_add_notifications_counter_cache_to_user.rb b/db/migrate/20160108133501_add_notifications_counter_cache_to_user.rb index e106df6ae..dbd6f6439 100644 --- a/db/migrate/20160108133501_add_notifications_counter_cache_to_user.rb +++ b/db/migrate/20160108133501_add_notifications_counter_cache_to_user.rb @@ -1,4 +1,4 @@ -class AddNotificationsCounterCacheToUser < ActiveRecord::Migration +class AddNotificationsCounterCacheToUser < ActiveRecord::Migration[4.2] def change add_column :users, :notifications_count, :integer, default: 0 end diff --git a/db/migrate/20160114110933_create_tolk_tables.rb b/db/migrate/20160114110933_create_tolk_tables.rb index d5e6db9d4..b8fc5ab4d 100644 --- a/db/migrate/20160114110933_create_tolk_tables.rb +++ b/db/migrate/20160114110933_create_tolk_tables.rb @@ -1,4 +1,4 @@ -class CreateTolkTables < ActiveRecord::Migration +class CreateTolkTables < ActiveRecord::Migration[4.2] def self.up create_table :tolk_locales do |t| t.string :name @@ -35,4 +35,4 @@ class CreateTolkTables < ActiveRecord::Migration drop_table :tolk_phrases drop_table :tolk_locales end -end \ No newline at end of file +end diff --git a/db/migrate/20160119132601_add_kind_to_tags.rb b/db/migrate/20160119132601_add_kind_to_tags.rb index a4d196517..3e20b9ecb 100644 --- a/db/migrate/20160119132601_add_kind_to_tags.rb +++ b/db/migrate/20160119132601_add_kind_to_tags.rb @@ -1,4 +1,4 @@ -class AddKindToTags < ActiveRecord::Migration +class AddKindToTags < ActiveRecord::Migration[4.2] def change add_column :tags, :kind, :string end diff --git a/db/migrate/20160119164320_add_registering_with_oauth_to_users.rb b/db/migrate/20160119164320_add_registering_with_oauth_to_users.rb index a29d310ba..809acfbac 100644 --- a/db/migrate/20160119164320_add_registering_with_oauth_to_users.rb +++ b/db/migrate/20160119164320_add_registering_with_oauth_to_users.rb @@ -1,4 +1,4 @@ -class AddRegisteringWithOauthToUsers < ActiveRecord::Migration +class AddRegisteringWithOauthToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :registering_with_oauth, :bool, default: false end diff --git a/db/migrate/20160122124847_add_geozone_to_proposals_and_debates.rb b/db/migrate/20160122124847_add_geozone_to_proposals_and_debates.rb index ad2b0cdff..f7ce68bf8 100644 --- a/db/migrate/20160122124847_add_geozone_to_proposals_and_debates.rb +++ b/db/migrate/20160122124847_add_geozone_to_proposals_and_debates.rb @@ -1,4 +1,4 @@ -class AddGeozoneToProposalsAndDebates < ActiveRecord::Migration +class AddGeozoneToProposalsAndDebates < ActiveRecord::Migration[4.2] def change add_column :proposals, :geozone_id, :integer, default: nil add_index :proposals, :geozone_id diff --git a/db/migrate/20160122153329_add_locale_to_users.rb b/db/migrate/20160122153329_add_locale_to_users.rb index 838ef1122..e393cf06a 100644 --- a/db/migrate/20160122153329_add_locale_to_users.rb +++ b/db/migrate/20160122153329_add_locale_to_users.rb @@ -1,4 +1,4 @@ -class AddLocaleToUsers < ActiveRecord::Migration +class AddLocaleToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :locale, :string end diff --git a/db/migrate/20160125100637_add_confirmed_oauth_email_to_user.rb b/db/migrate/20160125100637_add_confirmed_oauth_email_to_user.rb index 660735ab2..6b65de95e 100644 --- a/db/migrate/20160125100637_add_confirmed_oauth_email_to_user.rb +++ b/db/migrate/20160125100637_add_confirmed_oauth_email_to_user.rb @@ -1,4 +1,4 @@ -class AddConfirmedOauthEmailToUser < ActiveRecord::Migration +class AddConfirmedOauthEmailToUser < ActiveRecord::Migration[4.2] def change add_column :users, :confirmed_oauth_email, :string end diff --git a/db/migrate/20160126090634_rename_confirmed_oauth_email_to_oauth_email.rb b/db/migrate/20160126090634_rename_confirmed_oauth_email_to_oauth_email.rb index 3b3f027fe..32a6c11d0 100644 --- a/db/migrate/20160126090634_rename_confirmed_oauth_email_to_oauth_email.rb +++ b/db/migrate/20160126090634_rename_confirmed_oauth_email_to_oauth_email.rb @@ -1,4 +1,4 @@ -class RenameConfirmedOauthEmailToOauthEmail < ActiveRecord::Migration +class RenameConfirmedOauthEmailToOauthEmail < ActiveRecord::Migration[4.2] def change rename_column :users, :confirmed_oauth_email, :oauth_email end diff --git a/db/migrate/20160204134022_add_tsvector_to_debates.rb b/db/migrate/20160204134022_add_tsvector_to_debates.rb index 7b697347c..96dfd5e9c 100644 --- a/db/migrate/20160204134022_add_tsvector_to_debates.rb +++ b/db/migrate/20160204134022_add_tsvector_to_debates.rb @@ -1,4 +1,4 @@ -class AddTsvectorToDebates < ActiveRecord::Migration +class AddTsvectorToDebates < ActiveRecord::Migration[4.2] def up add_column :debates, :tsv, :tsvector @@ -10,4 +10,4 @@ class AddTsvectorToDebates < ActiveRecord::Migration remove_column :debates, :tsv end -end \ No newline at end of file +end diff --git a/db/migrate/20160207205252_add_external_link_to_debates.rb b/db/migrate/20160207205252_add_external_link_to_debates.rb index eaa0608d2..7cac58808 100644 --- a/db/migrate/20160207205252_add_external_link_to_debates.rb +++ b/db/migrate/20160207205252_add_external_link_to_debates.rb @@ -1,5 +1,5 @@ -class AddExternalLinkToDebates < ActiveRecord::Migration +class AddExternalLinkToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :external_link, :string, limit: 100 end -end \ No newline at end of file +end diff --git a/db/migrate/20160216121051_add_reporting_fields_to_spending_proposal.rb b/db/migrate/20160216121051_add_reporting_fields_to_spending_proposal.rb index c7eb51496..eebe31294 100644 --- a/db/migrate/20160216121051_add_reporting_fields_to_spending_proposal.rb +++ b/db/migrate/20160216121051_add_reporting_fields_to_spending_proposal.rb @@ -1,8 +1,8 @@ -class AddReportingFieldsToSpendingProposal < ActiveRecord::Migration +class AddReportingFieldsToSpendingProposal < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :price, :float add_column :spending_proposals, :legal, :boolean, default: nil add_column :spending_proposals, :feasible, :boolean, default: nil add_column :spending_proposals, :explanation, :text end -end \ No newline at end of file +end diff --git a/db/migrate/20160217101004_create_valuators.rb b/db/migrate/20160217101004_create_valuators.rb index d7c6d659f..9e3d7361a 100644 --- a/db/migrate/20160217101004_create_valuators.rb +++ b/db/migrate/20160217101004_create_valuators.rb @@ -1,4 +1,4 @@ -class CreateValuators < ActiveRecord::Migration +class CreateValuators < ActiveRecord::Migration[4.2] def change create_table :valuators do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20160218164923_add_geozone_id_to_users.rb b/db/migrate/20160218164923_add_geozone_id_to_users.rb index 162a28653..8d18efb41 100644 --- a/db/migrate/20160218164923_add_geozone_id_to_users.rb +++ b/db/migrate/20160218164923_add_geozone_id_to_users.rb @@ -1,4 +1,4 @@ -class AddGeozoneIdToUsers < ActiveRecord::Migration +class AddGeozoneIdToUsers < ActiveRecord::Migration[4.2] def change add_reference :users, :geozone, index: true, foreign_key: true end diff --git a/db/migrate/20160218172620_add_census_code_to_geozones.rb b/db/migrate/20160218172620_add_census_code_to_geozones.rb index 616518253..41de5cb14 100644 --- a/db/migrate/20160218172620_add_census_code_to_geozones.rb +++ b/db/migrate/20160218172620_add_census_code_to_geozones.rb @@ -1,4 +1,4 @@ -class AddCensusCodeToGeozones < ActiveRecord::Migration +class AddCensusCodeToGeozones < ActiveRecord::Migration[4.2] def change add_column :geozones, :census_code, :string end diff --git a/db/migrate/20160219111057_add_district_code_to_failed_census_call.rb b/db/migrate/20160219111057_add_district_code_to_failed_census_call.rb index 6e10dcd26..b68aea44e 100644 --- a/db/migrate/20160219111057_add_district_code_to_failed_census_call.rb +++ b/db/migrate/20160219111057_add_district_code_to_failed_census_call.rb @@ -1,4 +1,4 @@ -class AddDistrictCodeToFailedCensusCall < ActiveRecord::Migration +class AddDistrictCodeToFailedCensusCall < ActiveRecord::Migration[4.2] def change add_column :failed_census_calls, :district_code, :string end diff --git a/db/migrate/20160219172824_removes_external_link_from_debates.rb b/db/migrate/20160219172824_removes_external_link_from_debates.rb index 50d5ba1e8..b4b87b03a 100644 --- a/db/migrate/20160219172824_removes_external_link_from_debates.rb +++ b/db/migrate/20160219172824_removes_external_link_from_debates.rb @@ -1,4 +1,4 @@ -class RemovesExternalLinkFromDebates < ActiveRecord::Migration +class RemovesExternalLinkFromDebates < ActiveRecord::Migration[4.2] def change remove_column :debates, :external_link end diff --git a/db/migrate/20160220181602_add_association_to_spending_proposals.rb b/db/migrate/20160220181602_add_association_to_spending_proposals.rb index 17ded2bc3..d2822cd26 100644 --- a/db/migrate/20160220181602_add_association_to_spending_proposals.rb +++ b/db/migrate/20160220181602_add_association_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddAssociationToSpendingProposals < ActiveRecord::Migration +class AddAssociationToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :association_name, :string end diff --git a/db/migrate/20160222145100_add_redeemable_code_to_user.rb b/db/migrate/20160222145100_add_redeemable_code_to_user.rb index 38cba9357..1f7639463 100644 --- a/db/migrate/20160222145100_add_redeemable_code_to_user.rb +++ b/db/migrate/20160222145100_add_redeemable_code_to_user.rb @@ -1,4 +1,4 @@ -class AddRedeemableCodeToUser < ActiveRecord::Migration +class AddRedeemableCodeToUser < ActiveRecord::Migration[4.2] def change add_column :users, :redeemable_code, :string end diff --git a/db/migrate/20160224101038_change_spending_proposals_fields.rb b/db/migrate/20160224101038_change_spending_proposals_fields.rb index 22a7270cb..34e466b9a 100644 --- a/db/migrate/20160224101038_change_spending_proposals_fields.rb +++ b/db/migrate/20160224101038_change_spending_proposals_fields.rb @@ -1,4 +1,4 @@ -class ChangeSpendingProposalsFields < ActiveRecord::Migration +class ChangeSpendingProposalsFields < ActiveRecord::Migration[4.2] def change remove_index :spending_proposals, column: :resolution diff --git a/db/migrate/20160224123110_create_valuation_assignments.rb b/db/migrate/20160224123110_create_valuation_assignments.rb index 7ec9a9df4..d39e16d6b 100644 --- a/db/migrate/20160224123110_create_valuation_assignments.rb +++ b/db/migrate/20160224123110_create_valuation_assignments.rb @@ -1,4 +1,4 @@ -class CreateValuationAssignments < ActiveRecord::Migration +class CreateValuationAssignments < ActiveRecord::Migration[4.2] def change create_table :valuation_assignments do |t| t.belongs_to :valuator diff --git a/db/migrate/20160225171916_add_assignments_counter_cache_to_spending_proposal.rb b/db/migrate/20160225171916_add_assignments_counter_cache_to_spending_proposal.rb index 89a3ac37b..7b1fc7dcf 100644 --- a/db/migrate/20160225171916_add_assignments_counter_cache_to_spending_proposal.rb +++ b/db/migrate/20160225171916_add_assignments_counter_cache_to_spending_proposal.rb @@ -1,4 +1,4 @@ -class AddAssignmentsCounterCacheToSpendingProposal < ActiveRecord::Migration +class AddAssignmentsCounterCacheToSpendingProposal < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :valuation_assignments_count, :integer, default: 0 end diff --git a/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb b/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb index dad22583d..62b000bb3 100644 --- a/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb +++ b/db/migrate/20160305113707_add_price_fields_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddPriceFieldsToSpendingProposals < ActiveRecord::Migration +class AddPriceFieldsToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :price_first_year, :float end diff --git a/db/migrate/20160307150804_add_time_scope_to_spending_proposals.rb b/db/migrate/20160307150804_add_time_scope_to_spending_proposals.rb index 550c57061..dfd1eac92 100644 --- a/db/migrate/20160307150804_add_time_scope_to_spending_proposals.rb +++ b/db/migrate/20160307150804_add_time_scope_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddTimeScopeToSpendingProposals < ActiveRecord::Migration +class AddTimeScopeToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :time_scope, :string end diff --git a/db/migrate/20160308103548_change_price_fields_in_spending_proposals.rb b/db/migrate/20160308103548_change_price_fields_in_spending_proposals.rb index 532d2662b..18f17a764 100644 --- a/db/migrate/20160308103548_change_price_fields_in_spending_proposals.rb +++ b/db/migrate/20160308103548_change_price_fields_in_spending_proposals.rb @@ -1,4 +1,4 @@ -class ChangePriceFieldsInSpendingProposals < ActiveRecord::Migration +class ChangePriceFieldsInSpendingProposals < ActiveRecord::Migration[4.2] def up change_column :spending_proposals, :price, :integer change_column :spending_proposals, :price_first_year, :integer diff --git a/db/migrate/20160308184050_change_price_fields_to_bigint.rb b/db/migrate/20160308184050_change_price_fields_to_bigint.rb index fd9000278..2cbb211d3 100644 --- a/db/migrate/20160308184050_change_price_fields_to_bigint.rb +++ b/db/migrate/20160308184050_change_price_fields_to_bigint.rb @@ -1,4 +1,4 @@ -class ChangePriceFieldsToBigint < ActiveRecord::Migration +class ChangePriceFieldsToBigint < ActiveRecord::Migration[4.2] def up change_column :spending_proposals, :price, :bigint change_column :spending_proposals, :price_first_year, :bigint diff --git a/db/migrate/20160315084335_add_featured_at_to_debates.rb b/db/migrate/20160315084335_add_featured_at_to_debates.rb index 81093aed3..5923f080e 100644 --- a/db/migrate/20160315084335_add_featured_at_to_debates.rb +++ b/db/migrate/20160315084335_add_featured_at_to_debates.rb @@ -1,4 +1,4 @@ -class AddFeaturedAtToDebates < ActiveRecord::Migration +class AddFeaturedAtToDebates < ActiveRecord::Migration[4.2] def change add_column :debates, :featured_at, :datetime end diff --git a/db/migrate/20160315092854_add_description_to_valuators.rb b/db/migrate/20160315092854_add_description_to_valuators.rb index d5527dc36..8adead628 100644 --- a/db/migrate/20160315092854_add_description_to_valuators.rb +++ b/db/migrate/20160315092854_add_description_to_valuators.rb @@ -1,4 +1,4 @@ -class AddDescriptionToValuators < ActiveRecord::Migration +class AddDescriptionToValuators < ActiveRecord::Migration[4.2] def change add_column :valuators, :description, :string end diff --git a/db/migrate/20160328152843_add_unfeasible_email_sent_at_to_spending_proposals.rb b/db/migrate/20160328152843_add_unfeasible_email_sent_at_to_spending_proposals.rb index bbe1dc6ec..4600b0e5f 100644 --- a/db/migrate/20160328152843_add_unfeasible_email_sent_at_to_spending_proposals.rb +++ b/db/migrate/20160328152843_add_unfeasible_email_sent_at_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddUnfeasibleEmailSentAtToSpendingProposals < ActiveRecord::Migration +class AddUnfeasibleEmailSentAtToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :unfeasible_email_sent_at, :datetime, default: nil end diff --git a/db/migrate/20160329115418_add_votes_up_to_spending_proposals.rb b/db/migrate/20160329115418_add_votes_up_to_spending_proposals.rb index 3b0f2a7ad..9b00ffc50 100644 --- a/db/migrate/20160329115418_add_votes_up_to_spending_proposals.rb +++ b/db/migrate/20160329115418_add_votes_up_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddVotesUpToSpendingProposals < ActiveRecord::Migration +class AddVotesUpToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :cached_votes_up, :integer, default: 0 end diff --git a/db/migrate/20160329160106_add_tsvector_to_spending_proposals.rb b/db/migrate/20160329160106_add_tsvector_to_spending_proposals.rb index c8c3d7f3e..ccdb08cc2 100644 --- a/db/migrate/20160329160106_add_tsvector_to_spending_proposals.rb +++ b/db/migrate/20160329160106_add_tsvector_to_spending_proposals.rb @@ -1,8 +1,8 @@ -class AddTsvectorToSpendingProposals < ActiveRecord::Migration +class AddTsvectorToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :tsv, :tsvector add_index :spending_proposals, :tsv, using: "gin" end -end \ No newline at end of file +end diff --git a/db/migrate/20160406163649_add_responsible_name_to_spending_proposals.rb b/db/migrate/20160406163649_add_responsible_name_to_spending_proposals.rb index 5749400bb..e28039588 100644 --- a/db/migrate/20160406163649_add_responsible_name_to_spending_proposals.rb +++ b/db/migrate/20160406163649_add_responsible_name_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddResponsibleNameToSpendingProposals < ActiveRecord::Migration +class AddResponsibleNameToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :responsible_name, :string, limit: 60 end diff --git a/db/migrate/20160411161531_add_genre_and_dob_to_users.rb b/db/migrate/20160411161531_add_genre_and_dob_to_users.rb index aa8100fa3..59411ca7e 100644 --- a/db/migrate/20160411161531_add_genre_and_dob_to_users.rb +++ b/db/migrate/20160411161531_add_genre_and_dob_to_users.rb @@ -1,4 +1,4 @@ -class AddGenreAndDobToUsers < ActiveRecord::Migration +class AddGenreAndDobToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :genre, :string, index: true, limit: 10 add_column :users, :date_of_birth, :datetime, index: true diff --git a/db/migrate/20160413122359_rename_genre_to_gender.rb b/db/migrate/20160413122359_rename_genre_to_gender.rb index f0bccfc28..d24f511c0 100644 --- a/db/migrate/20160413122359_rename_genre_to_gender.rb +++ b/db/migrate/20160413122359_rename_genre_to_gender.rb @@ -1,4 +1,4 @@ -class RenameGenreToGender < ActiveRecord::Migration +class RenameGenreToGender < ActiveRecord::Migration[4.2] def change rename_column :users, :genre, :gender end diff --git a/db/migrate/20160415150524_add_physical_votes_to_spending_proposals.rb b/db/migrate/20160415150524_add_physical_votes_to_spending_proposals.rb index a90b1d1a7..6b345132c 100644 --- a/db/migrate/20160415150524_add_physical_votes_to_spending_proposals.rb +++ b/db/migrate/20160415150524_add_physical_votes_to_spending_proposals.rb @@ -1,4 +1,4 @@ -class AddPhysicalVotesToSpendingProposals < ActiveRecord::Migration +class AddPhysicalVotesToSpendingProposals < ActiveRecord::Migration[4.2] def change add_column :spending_proposals, :physical_votes, :integer, default: 0 end diff --git a/db/migrate/20160418144013_add_index_to_username.rb b/db/migrate/20160418144013_add_index_to_username.rb index 191f24ac6..d0481e826 100644 --- a/db/migrate/20160418144013_add_index_to_username.rb +++ b/db/migrate/20160418144013_add_index_to_username.rb @@ -1,4 +1,4 @@ -class AddIndexToUsername < ActiveRecord::Migration +class AddIndexToUsername < ActiveRecord::Migration[4.2] def change add_index :users, :username end diff --git a/db/migrate/20160418172919_activate_newsletter_by_default.rb b/db/migrate/20160418172919_activate_newsletter_by_default.rb index cdee85f1b..c75284656 100644 --- a/db/migrate/20160418172919_activate_newsletter_by_default.rb +++ b/db/migrate/20160418172919_activate_newsletter_by_default.rb @@ -1,4 +1,4 @@ -class ActivateNewsletterByDefault < ActiveRecord::Migration +class ActivateNewsletterByDefault < ActiveRecord::Migration[4.2] def change change_column :users, :newsletter, :boolean, default: true end diff --git a/db/migrate/20160420105023_add_retired_to_proposals.rb b/db/migrate/20160420105023_add_retired_to_proposals.rb index f818a9169..a8f7f4b92 100644 --- a/db/migrate/20160420105023_add_retired_to_proposals.rb +++ b/db/migrate/20160420105023_add_retired_to_proposals.rb @@ -1,4 +1,4 @@ -class AddRetiredToProposals < ActiveRecord::Migration +class AddRetiredToProposals < ActiveRecord::Migration[4.2] def change add_column :proposals, :retired_at, :datetime, default: nil end diff --git a/db/migrate/20160421090733_destroy_captcha_table.rb b/db/migrate/20160421090733_destroy_captcha_table.rb index 68d045d2f..4a214f428 100644 --- a/db/migrate/20160421090733_destroy_captcha_table.rb +++ b/db/migrate/20160421090733_destroy_captcha_table.rb @@ -1,4 +1,4 @@ -class DestroyCaptchaTable < ActiveRecord::Migration +class DestroyCaptchaTable < ActiveRecord::Migration[4.2] def change drop_table :simple_captcha_data end diff --git a/db/migrate/20160422094733_add_retired_texts_to_proposals.rb b/db/migrate/20160422094733_add_retired_texts_to_proposals.rb index 3c044477d..6ccc6d516 100644 --- a/db/migrate/20160422094733_add_retired_texts_to_proposals.rb +++ b/db/migrate/20160422094733_add_retired_texts_to_proposals.rb @@ -1,4 +1,4 @@ -class AddRetiredTextsToProposals < ActiveRecord::Migration +class AddRetiredTextsToProposals < ActiveRecord::Migration[4.2] def change add_column :proposals, :retired_reason, :string, default: nil add_column :proposals, :retired_explanation, :text, default: nil diff --git a/db/migrate/20160426211658_add_assignments_counter_cache_to_valuators.rb b/db/migrate/20160426211658_add_assignments_counter_cache_to_valuators.rb index 9b6b6f99d..6653900fd 100644 --- a/db/migrate/20160426211658_add_assignments_counter_cache_to_valuators.rb +++ b/db/migrate/20160426211658_add_assignments_counter_cache_to_valuators.rb @@ -1,4 +1,4 @@ -class AddAssignmentsCounterCacheToValuators < ActiveRecord::Migration +class AddAssignmentsCounterCacheToValuators < ActiveRecord::Migration[4.2] def change add_column :valuators, :spending_proposals_count, :integer, default: 0 end diff --git a/db/migrate/20160510161858_create_manager_role.rb b/db/migrate/20160510161858_create_manager_role.rb index 48ceb7e20..335564178 100644 --- a/db/migrate/20160510161858_create_manager_role.rb +++ b/db/migrate/20160510161858_create_manager_role.rb @@ -1,4 +1,4 @@ -class CreateManagerRole < ActiveRecord::Migration +class CreateManagerRole < ActiveRecord::Migration[4.2] def change create_table :managers do |t| t.belongs_to :user, index: true, foreign_key: true diff --git a/db/migrate/20160518141543_create_banners.rb b/db/migrate/20160518141543_create_banners.rb index efa8870a1..4199cf5d2 100644 --- a/db/migrate/20160518141543_create_banners.rb +++ b/db/migrate/20160518141543_create_banners.rb @@ -1,4 +1,4 @@ -class CreateBanners < ActiveRecord::Migration +class CreateBanners < ActiveRecord::Migration[4.2] def change create_table :banners do |t| t.string :title, limit: 80 @@ -16,4 +16,4 @@ class CreateBanners < ActiveRecord::Migration add_index :banners, :hidden_at end -end \ No newline at end of file +end diff --git a/db/migrate/20160518142529_create_budgets.rb b/db/migrate/20160518142529_create_budgets.rb index 943038472..9f3cbea82 100644 --- a/db/migrate/20160518142529_create_budgets.rb +++ b/db/migrate/20160518142529_create_budgets.rb @@ -1,4 +1,4 @@ -class CreateBudgets < ActiveRecord::Migration +class CreateBudgets < ActiveRecord::Migration[4.2] def change create_table :budgets do |t| t.string "name", limit: 30 diff --git a/db/migrate/20160518151245_create_budget_investments.rb b/db/migrate/20160518151245_create_budget_investments.rb index bdc77c967..a33b762ef 100644 --- a/db/migrate/20160518151245_create_budget_investments.rb +++ b/db/migrate/20160518151245_create_budget_investments.rb @@ -1,4 +1,4 @@ -class CreateBudgetInvestments < ActiveRecord::Migration +class CreateBudgetInvestments < ActiveRecord::Migration[4.2] def change create_table :budget_investments do |t| diff --git a/db/migrate/20160519144152_create_budget_ballots.rb b/db/migrate/20160519144152_create_budget_ballots.rb index 3131098b5..2f1a24a08 100644 --- a/db/migrate/20160519144152_create_budget_ballots.rb +++ b/db/migrate/20160519144152_create_budget_ballots.rb @@ -1,4 +1,4 @@ -class CreateBudgetBallots < ActiveRecord::Migration +class CreateBudgetBallots < ActiveRecord::Migration[4.2] def change create_table :budget_ballots do |t| t.references :geozone diff --git a/db/migrate/20160520100347_create_budget_ballot_lines.rb b/db/migrate/20160520100347_create_budget_ballot_lines.rb index 07377234d..28fc2d8e2 100644 --- a/db/migrate/20160520100347_create_budget_ballot_lines.rb +++ b/db/migrate/20160520100347_create_budget_ballot_lines.rb @@ -1,4 +1,4 @@ -class CreateBudgetBallotLines < ActiveRecord::Migration +class CreateBudgetBallotLines < ActiveRecord::Migration[4.2] def change create_table :budget_ballot_lines do |t| t.integer :ballot_id, index: true diff --git a/db/migrate/20160520111735_create_budget_heading.rb b/db/migrate/20160520111735_create_budget_heading.rb index bd9291d2f..ca83afb4e 100644 --- a/db/migrate/20160520111735_create_budget_heading.rb +++ b/db/migrate/20160520111735_create_budget_heading.rb @@ -1,4 +1,4 @@ -class CreateBudgetHeading < ActiveRecord::Migration +class CreateBudgetHeading < ActiveRecord::Migration[4.2] def change create_table :budget_headings do |t| t.references :group, index: true diff --git a/db/migrate/20160520114820_replace_geozones_by_headings_in_budgets.rb b/db/migrate/20160520114820_replace_geozones_by_headings_in_budgets.rb index 60e1e4f6c..dbc660450 100644 --- a/db/migrate/20160520114820_replace_geozones_by_headings_in_budgets.rb +++ b/db/migrate/20160520114820_replace_geozones_by_headings_in_budgets.rb @@ -1,4 +1,4 @@ -class ReplaceGeozonesByHeadingsInBudgets < ActiveRecord::Migration +class ReplaceGeozonesByHeadingsInBudgets < ActiveRecord::Migration[4.2] def change remove_column :budget_investments, :geozone_id remove_column :budget_ballots, :geozone_id diff --git a/db/migrate/20160520151954_add_budget_id_to_investments.rb b/db/migrate/20160520151954_add_budget_id_to_investments.rb index 8860be67c..430fb0db6 100644 --- a/db/migrate/20160520151954_add_budget_id_to_investments.rb +++ b/db/migrate/20160520151954_add_budget_id_to_investments.rb @@ -1,4 +1,4 @@ -class AddBudgetIdToInvestments < ActiveRecord::Migration +class AddBudgetIdToInvestments < ActiveRecord::Migration[4.2] def change add_reference :budget_investments, :budget, index: true end diff --git a/db/migrate/20160523095730_create_budget_valuator_assignments.rb b/db/migrate/20160523095730_create_budget_valuator_assignments.rb index 18686da0e..72702a246 100644 --- a/db/migrate/20160523095730_create_budget_valuator_assignments.rb +++ b/db/migrate/20160523095730_create_budget_valuator_assignments.rb @@ -1,4 +1,4 @@ -class CreateBudgetValuatorAssignments < ActiveRecord::Migration +class CreateBudgetValuatorAssignments < ActiveRecord::Migration[4.2] def change create_table :budget_valuator_assignments, index: false do |t| t.belongs_to :valuator diff --git a/db/migrate/20160523143320_deletes_heading_id_from_ballot.rb b/db/migrate/20160523143320_deletes_heading_id_from_ballot.rb index 3a7d17e67..83cb9963d 100644 --- a/db/migrate/20160523143320_deletes_heading_id_from_ballot.rb +++ b/db/migrate/20160523143320_deletes_heading_id_from_ballot.rb @@ -1,4 +1,4 @@ -class DeletesHeadingIdFromBallot < ActiveRecord::Migration +class DeletesHeadingIdFromBallot < ActiveRecord::Migration[4.2] def change remove_column :budget_ballots, :heading_id end diff --git a/db/migrate/20160523144313_add_budget_investments_count_to_valuators.rb b/db/migrate/20160523144313_add_budget_investments_count_to_valuators.rb index 9ec741951..986d547c4 100644 --- a/db/migrate/20160523144313_add_budget_investments_count_to_valuators.rb +++ b/db/migrate/20160523144313_add_budget_investments_count_to_valuators.rb @@ -1,4 +1,4 @@ -class AddBudgetInvestmentsCountToValuators < ActiveRecord::Migration +class AddBudgetInvestmentsCountToValuators < ActiveRecord::Migration[4.2] def change add_column :valuators, :budget_investments_count, :integer, default: 0 end diff --git a/db/migrate/20160523150146_rename_bi_valuation_count.rb b/db/migrate/20160523150146_rename_bi_valuation_count.rb index b7b41e6e1..6b130c63a 100644 --- a/db/migrate/20160523150146_rename_bi_valuation_count.rb +++ b/db/migrate/20160523150146_rename_bi_valuation_count.rb @@ -1,4 +1,4 @@ -class RenameBiValuationCount < ActiveRecord::Migration +class RenameBiValuationCount < ActiveRecord::Migration[4.2] def change rename_column :budget_investments, :valuation_assignments_count, :valuator_assignments_count end diff --git a/db/migrate/20160523164449_add_responsible_name_to_budget_investments.rb b/db/migrate/20160523164449_add_responsible_name_to_budget_investments.rb index 46576d059..6e2e8bc46 100644 --- a/db/migrate/20160523164449_add_responsible_name_to_budget_investments.rb +++ b/db/migrate/20160523164449_add_responsible_name_to_budget_investments.rb @@ -1,4 +1,4 @@ -class AddResponsibleNameToBudgetInvestments < ActiveRecord::Migration +class AddResponsibleNameToBudgetInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :responsible_name, :string end diff --git a/db/migrate/20160524143107_add_heading_id_to_budget_ballot.rb b/db/migrate/20160524143107_add_heading_id_to_budget_ballot.rb index 2bc254fbe..a2bb01f2d 100644 --- a/db/migrate/20160524143107_add_heading_id_to_budget_ballot.rb +++ b/db/migrate/20160524143107_add_heading_id_to_budget_ballot.rb @@ -1,4 +1,4 @@ -class AddHeadingIdToBudgetBallot < ActiveRecord::Migration +class AddHeadingIdToBudgetBallot < ActiveRecord::Migration[4.2] def change add_column :budget_ballots, :heading_id, :integer add_index :budget_ballots, :heading_id diff --git a/db/migrate/20160524144005_add_price_to_budget.rb b/db/migrate/20160524144005_add_price_to_budget.rb index 14c96dd7a..b7a1ec063 100644 --- a/db/migrate/20160524144005_add_price_to_budget.rb +++ b/db/migrate/20160524144005_add_price_to_budget.rb @@ -1,4 +1,4 @@ -class AddPriceToBudget < ActiveRecord::Migration +class AddPriceToBudget < ActiveRecord::Migration[4.2] def change add_column :budgets, :price, :integer end diff --git a/db/migrate/20160531102008_add_budget_investments_count_to_tags.rb b/db/migrate/20160531102008_add_budget_investments_count_to_tags.rb index 256adcc0c..32f75ca03 100644 --- a/db/migrate/20160531102008_add_budget_investments_count_to_tags.rb +++ b/db/migrate/20160531102008_add_budget_investments_count_to_tags.rb @@ -1,4 +1,4 @@ -class AddBudgetInvestmentsCountToTags < ActiveRecord::Migration +class AddBudgetInvestmentsCountToTags < ActiveRecord::Migration[4.2] def change add_column :tags, "budget/investments_count", :integer, default: 0 end diff --git a/db/migrate/20160601103338_create_proposal_notifications.rb b/db/migrate/20160601103338_create_proposal_notifications.rb index 97760da6b..d1a72d179 100644 --- a/db/migrate/20160601103338_create_proposal_notifications.rb +++ b/db/migrate/20160601103338_create_proposal_notifications.rb @@ -1,4 +1,4 @@ -class CreateProposalNotifications < ActiveRecord::Migration +class CreateProposalNotifications < ActiveRecord::Migration[4.2] def change create_table :proposal_notifications do |t| t.string :title diff --git a/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb b/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb index 84753eb50..a260edd87 100644 --- a/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb +++ b/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb @@ -1,4 +1,4 @@ -class AddEmailOnProposalNotificationToUsers < ActiveRecord::Migration +class AddEmailOnProposalNotificationToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :email_on_proposal_notification, :boolean, default: true end diff --git a/db/migrate/20160608174104_create_direct_messages.rb b/db/migrate/20160608174104_create_direct_messages.rb index 0cdcd6659..61f155af9 100644 --- a/db/migrate/20160608174104_create_direct_messages.rb +++ b/db/migrate/20160608174104_create_direct_messages.rb @@ -1,4 +1,4 @@ -class CreateDirectMessages < ActiveRecord::Migration +class CreateDirectMessages < ActiveRecord::Migration[4.2] def change create_table :direct_messages do |t| t.integer :sender_id diff --git a/db/migrate/20160609110023_create_budget_group.rb b/db/migrate/20160609110023_create_budget_group.rb index fb6cbcd1c..9ff35391d 100644 --- a/db/migrate/20160609110023_create_budget_group.rb +++ b/db/migrate/20160609110023_create_budget_group.rb @@ -1,4 +1,4 @@ -class CreateBudgetGroup < ActiveRecord::Migration +class CreateBudgetGroup < ActiveRecord::Migration[4.2] def change create_table :budget_groups do |t| t.references :budget diff --git a/db/migrate/20160609142017_remove_price_from_budget.rb b/db/migrate/20160609142017_remove_price_from_budget.rb index 366fdef5f..6a7f2f9c3 100644 --- a/db/migrate/20160609142017_remove_price_from_budget.rb +++ b/db/migrate/20160609142017_remove_price_from_budget.rb @@ -1,4 +1,4 @@ -class RemovePriceFromBudget < ActiveRecord::Migration +class RemovePriceFromBudget < ActiveRecord::Migration[4.2] def change remove_column :budgets, :price, :integer end diff --git a/db/migrate/20160609152026_remove_budget_id_from_investments.rb b/db/migrate/20160609152026_remove_budget_id_from_investments.rb index 69890c2e9..9fc6b2367 100644 --- a/db/migrate/20160609152026_remove_budget_id_from_investments.rb +++ b/db/migrate/20160609152026_remove_budget_id_from_investments.rb @@ -1,4 +1,4 @@ -class RemoveBudgetIdFromInvestments < ActiveRecord::Migration +class RemoveBudgetIdFromInvestments < ActiveRecord::Migration[4.2] def change remove_column :budget_investments, :budget_id, :integer end diff --git a/db/migrate/20160610094658_desnormalize_ballot_line.rb b/db/migrate/20160610094658_desnormalize_ballot_line.rb index b4eee7dc2..afbf85484 100644 --- a/db/migrate/20160610094658_desnormalize_ballot_line.rb +++ b/db/migrate/20160610094658_desnormalize_ballot_line.rb @@ -1,4 +1,4 @@ -class DesnormalizeBallotLine < ActiveRecord::Migration +class DesnormalizeBallotLine < ActiveRecord::Migration[4.2] def change add_column :budget_ballot_lines, :budget_id, :integer, index: true add_column :budget_ballot_lines, :group_id, :integer, index: true diff --git a/db/migrate/20160613150659_add_email_digest_to_users.rb b/db/migrate/20160613150659_add_email_digest_to_users.rb index d127af78e..f10d3765b 100644 --- a/db/migrate/20160613150659_add_email_digest_to_users.rb +++ b/db/migrate/20160613150659_add_email_digest_to_users.rb @@ -1,4 +1,4 @@ -class AddEmailDigestToUsers < ActiveRecord::Migration +class AddEmailDigestToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :email_digest, :boolean, default: true end diff --git a/db/migrate/20160614091639_remove_heading_id_from_ballot.rb b/db/migrate/20160614091639_remove_heading_id_from_ballot.rb index f46b93424..9e11882a8 100644 --- a/db/migrate/20160614091639_remove_heading_id_from_ballot.rb +++ b/db/migrate/20160614091639_remove_heading_id_from_ballot.rb @@ -1,4 +1,4 @@ -class RemoveHeadingIdFromBallot < ActiveRecord::Migration +class RemoveHeadingIdFromBallot < ActiveRecord::Migration[4.2] def change remove_column :budget_ballots, :heading_id, :integer end diff --git a/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb b/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb index db18e3f27..f9755dca3 100644 --- a/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb +++ b/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb @@ -1,4 +1,4 @@ -class AddEmailOnDirectMessagesToUsers < ActiveRecord::Migration +class AddEmailOnDirectMessagesToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :email_on_direct_message, :boolean, default: true end diff --git a/db/migrate/20160617172616_add_badge_to_users.rb b/db/migrate/20160617172616_add_badge_to_users.rb index 2f634aa49..c49441332 100644 --- a/db/migrate/20160617172616_add_badge_to_users.rb +++ b/db/migrate/20160617172616_add_badge_to_users.rb @@ -1,4 +1,4 @@ -class AddBadgeToUsers < ActiveRecord::Migration +class AddBadgeToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :official_position_badge, :boolean, default: false end diff --git a/db/migrate/20160803154011_add_emailed_at_to_notifications.rb b/db/migrate/20160803154011_add_emailed_at_to_notifications.rb index 83e38b00f..69aec73c6 100644 --- a/db/migrate/20160803154011_add_emailed_at_to_notifications.rb +++ b/db/migrate/20160803154011_add_emailed_at_to_notifications.rb @@ -1,4 +1,4 @@ -class AddEmailedAtToNotifications < ActiveRecord::Migration +class AddEmailedAtToNotifications < ActiveRecord::Migration[4.2] def change add_column :notifications, :emailed_at, :datetime end diff --git a/db/migrate/20160901104320_add_password_expired.rb b/db/migrate/20160901104320_add_password_expired.rb index aa759dd61..c6bcc6070 100644 --- a/db/migrate/20160901104320_add_password_expired.rb +++ b/db/migrate/20160901104320_add_password_expired.rb @@ -1,4 +1,4 @@ -class AddPasswordExpired < ActiveRecord::Migration +class AddPasswordExpired < ActiveRecord::Migration[4.2] def change add_column :users, :password_changed_at, :datetime add_index :users, :password_changed_at diff --git a/db/migrate/20160905092539_denormalize_investments.rb b/db/migrate/20160905092539_denormalize_investments.rb index d28291c4e..bed96e1d1 100644 --- a/db/migrate/20160905092539_denormalize_investments.rb +++ b/db/migrate/20160905092539_denormalize_investments.rb @@ -1,4 +1,4 @@ -class DenormalizeInvestments < ActiveRecord::Migration +class DenormalizeInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :budget_id, :integer, index: true add_column :budget_investments, :group_id, :integer, index: true diff --git a/db/migrate/20160914110004_create_polls.rb b/db/migrate/20160914110004_create_polls.rb index 9dd67d9ba..2359bce08 100644 --- a/db/migrate/20160914110004_create_polls.rb +++ b/db/migrate/20160914110004_create_polls.rb @@ -1,4 +1,4 @@ -class CreatePolls < ActiveRecord::Migration +class CreatePolls < ActiveRecord::Migration[4.2] def change create_table :polls do |t| t.string :name diff --git a/db/migrate/20160914110039_create_poll_officers.rb b/db/migrate/20160914110039_create_poll_officers.rb index 329220d40..cf6665af1 100644 --- a/db/migrate/20160914110039_create_poll_officers.rb +++ b/db/migrate/20160914110039_create_poll_officers.rb @@ -1,4 +1,4 @@ -class CreatePollOfficers < ActiveRecord::Migration +class CreatePollOfficers < ActiveRecord::Migration[4.2] def change create_table :poll_officers do |t| t.integer :user_id diff --git a/db/migrate/20160914172016_create_poll_voters.rb b/db/migrate/20160914172016_create_poll_voters.rb index df5bb4585..a3a75a771 100644 --- a/db/migrate/20160914172016_create_poll_voters.rb +++ b/db/migrate/20160914172016_create_poll_voters.rb @@ -1,4 +1,4 @@ -class CreatePollVoters < ActiveRecord::Migration +class CreatePollVoters < ActiveRecord::Migration[4.2] def change create_table :poll_voters do |t| t.integer :booth_id diff --git a/db/migrate/20160914172535_create_poll_booths.rb b/db/migrate/20160914172535_create_poll_booths.rb index a474aba49..f3dfb3781 100644 --- a/db/migrate/20160914172535_create_poll_booths.rb +++ b/db/migrate/20160914172535_create_poll_booths.rb @@ -1,4 +1,4 @@ -class CreatePollBooths < ActiveRecord::Migration +class CreatePollBooths < ActiveRecord::Migration[4.2] def change create_table :poll_booths do |t| t.string :name diff --git a/db/migrate/20160926090107_add_location_to_booths.rb b/db/migrate/20160926090107_add_location_to_booths.rb index 146f55d41..3dfc2fda9 100644 --- a/db/migrate/20160926090107_add_location_to_booths.rb +++ b/db/migrate/20160926090107_add_location_to_booths.rb @@ -1,4 +1,4 @@ -class AddLocationToBooths < ActiveRecord::Migration +class AddLocationToBooths < ActiveRecord::Migration[4.2] def change add_column :poll_booths, :location, :string end diff --git a/db/migrate/20160928113143_create_officing_booths.rb b/db/migrate/20160928113143_create_officing_booths.rb index 00483fe00..785931b71 100644 --- a/db/migrate/20160928113143_create_officing_booths.rb +++ b/db/migrate/20160928113143_create_officing_booths.rb @@ -1,4 +1,4 @@ -class CreateOfficingBooths < ActiveRecord::Migration +class CreateOfficingBooths < ActiveRecord::Migration[4.2] def change create_table :poll_officing_booths do |t| t.belongs_to :officer diff --git a/db/migrate/20161020112156_add_dates_to_polls.rb b/db/migrate/20161020112156_add_dates_to_polls.rb index d504930ae..aaf0f33b8 100644 --- a/db/migrate/20161020112156_add_dates_to_polls.rb +++ b/db/migrate/20161020112156_add_dates_to_polls.rb @@ -1,4 +1,4 @@ -class AddDatesToPolls < ActiveRecord::Migration +class AddDatesToPolls < ActiveRecord::Migration[4.2] def change add_column :polls, :starts_at, :datetime add_column :polls, :ends_at, :datetime diff --git a/db/migrate/20161028104156_create_poll_questions.rb b/db/migrate/20161028104156_create_poll_questions.rb index 13c8ac1e8..ae72389d2 100644 --- a/db/migrate/20161028104156_create_poll_questions.rb +++ b/db/migrate/20161028104156_create_poll_questions.rb @@ -1,4 +1,4 @@ -class CreatePollQuestions < ActiveRecord::Migration +class CreatePollQuestions < ActiveRecord::Migration[4.2] def change create_table :poll_questions do |t| t.references :proposal, index: true, foreign_key: true diff --git a/db/migrate/20161028143204_create_geozones_poll_questions.rb b/db/migrate/20161028143204_create_geozones_poll_questions.rb index 68077c510..140f7fc2b 100644 --- a/db/migrate/20161028143204_create_geozones_poll_questions.rb +++ b/db/migrate/20161028143204_create_geozones_poll_questions.rb @@ -1,4 +1,4 @@ -class CreateGeozonesPollQuestions < ActiveRecord::Migration +class CreateGeozonesPollQuestions < ActiveRecord::Migration[4.2] def change create_table :geozones_poll_questions do |t| t.references :geozone, index: true, foreign_key: true diff --git a/db/migrate/20161102133838_default_password_changed_at.rb b/db/migrate/20161102133838_default_password_changed_at.rb index 9df2a26a6..ec58525da 100644 --- a/db/migrate/20161102133838_default_password_changed_at.rb +++ b/db/migrate/20161102133838_default_password_changed_at.rb @@ -1,4 +1,4 @@ -class DefaultPasswordChangedAt < ActiveRecord::Migration +class DefaultPasswordChangedAt < ActiveRecord::Migration[4.2] def change change_column :users, :password_changed_at, :datetime, null: false, default: Time.now end diff --git a/db/migrate/20161107124207_add_all_geozones_to_poll_questions.rb b/db/migrate/20161107124207_add_all_geozones_to_poll_questions.rb index 15ed41ba5..1f8d20051 100644 --- a/db/migrate/20161107124207_add_all_geozones_to_poll_questions.rb +++ b/db/migrate/20161107124207_add_all_geozones_to_poll_questions.rb @@ -1,4 +1,4 @@ -class AddAllGeozonesToPollQuestions < ActiveRecord::Migration +class AddAllGeozonesToPollQuestions < ActiveRecord::Migration[4.2] def change add_column :poll_questions, :all_geozones, :boolean, default: false end diff --git a/db/migrate/20161107174423_create_poll_partial_result.rb b/db/migrate/20161107174423_create_poll_partial_result.rb index a4f91a4f9..da75fe853 100644 --- a/db/migrate/20161107174423_create_poll_partial_result.rb +++ b/db/migrate/20161107174423_create_poll_partial_result.rb @@ -1,4 +1,4 @@ -class CreatePollPartialResult < ActiveRecord::Migration +class CreatePollPartialResult < ActiveRecord::Migration[4.2] def change create_table :poll_partial_results do |t| t.integer :question_id, index: true diff --git a/db/migrate/20161117115841_rename_legislations_to_legacy_legislations.rb b/db/migrate/20161117115841_rename_legislations_to_legacy_legislations.rb index d8eaa76c0..ef9b79ed5 100644 --- a/db/migrate/20161117115841_rename_legislations_to_legacy_legislations.rb +++ b/db/migrate/20161117115841_rename_legislations_to_legacy_legislations.rb @@ -1,4 +1,4 @@ -class RenameLegislationsToLegacyLegislations < ActiveRecord::Migration +class RenameLegislationsToLegacyLegislations < ActiveRecord::Migration[4.2] def change rename_table :legislations, :legacy_legislations rename_column :annotations, :legislation_id, :legacy_legislation_id diff --git a/db/migrate/20161117135624_create_legislation_processes.rb b/db/migrate/20161117135624_create_legislation_processes.rb index 099a84e65..71e2079b6 100644 --- a/db/migrate/20161117135624_create_legislation_processes.rb +++ b/db/migrate/20161117135624_create_legislation_processes.rb @@ -1,4 +1,4 @@ -class CreateLegislationProcesses < ActiveRecord::Migration +class CreateLegislationProcesses < ActiveRecord::Migration[4.2] def change create_table :legislation_processes do |t| t.string :title diff --git a/db/migrate/20161122101702_remove_question_from_poll_questions.rb b/db/migrate/20161122101702_remove_question_from_poll_questions.rb index 2532b2948..00411ac26 100644 --- a/db/migrate/20161122101702_remove_question_from_poll_questions.rb +++ b/db/migrate/20161122101702_remove_question_from_poll_questions.rb @@ -1,4 +1,4 @@ -class RemoveQuestionFromPollQuestions < ActiveRecord::Migration +class RemoveQuestionFromPollQuestions < ActiveRecord::Migration[4.2] def change remove_column :poll_questions, :question end diff --git a/db/migrate/20161129011737_add_tsv_to_poll_questions.rb b/db/migrate/20161129011737_add_tsv_to_poll_questions.rb index a6a44f13d..3e889f548 100644 --- a/db/migrate/20161129011737_add_tsv_to_poll_questions.rb +++ b/db/migrate/20161129011737_add_tsv_to_poll_questions.rb @@ -1,4 +1,4 @@ -class AddTsvToPollQuestions < ActiveRecord::Migration +class AddTsvToPollQuestions < ActiveRecord::Migration[4.2] def up add_column :poll_questions, :tsv, :tsvector add_index :poll_questions, :tsv, using: "gin" diff --git a/db/migrate/20161130122604_remove_poll_id_from_booth.rb b/db/migrate/20161130122604_remove_poll_id_from_booth.rb index a84b1a70a..624893080 100644 --- a/db/migrate/20161130122604_remove_poll_id_from_booth.rb +++ b/db/migrate/20161130122604_remove_poll_id_from_booth.rb @@ -1,4 +1,4 @@ -class RemovePollIdFromBooth < ActiveRecord::Migration +class RemovePollIdFromBooth < ActiveRecord::Migration[4.2] def change remove_column :poll_booths, :poll_id, :integer end diff --git a/db/migrate/20161130123347_create_poll_booth_assignments.rb b/db/migrate/20161130123347_create_poll_booth_assignments.rb index 36a2b9d64..dfcc0f71d 100644 --- a/db/migrate/20161130123347_create_poll_booth_assignments.rb +++ b/db/migrate/20161130123347_create_poll_booth_assignments.rb @@ -1,4 +1,4 @@ -class CreatePollBoothAssignments < ActiveRecord::Migration +class CreatePollBoothAssignments < ActiveRecord::Migration[4.2] def change create_table :poll_booth_assignments do |t| t.integer :booth_id diff --git a/db/migrate/20161205110441_create_legislation_draft_versions.rb b/db/migrate/20161205110441_create_legislation_draft_versions.rb index 1eb15eebe..1d4afb377 100644 --- a/db/migrate/20161205110441_create_legislation_draft_versions.rb +++ b/db/migrate/20161205110441_create_legislation_draft_versions.rb @@ -1,4 +1,4 @@ -class CreateLegislationDraftVersions < ActiveRecord::Migration +class CreateLegislationDraftVersions < ActiveRecord::Migration[4.2] def change create_table :legislation_draft_versions do |t| t.references :legislation_process, index: true, foreign_key: true diff --git a/db/migrate/20161206130836_delete_officing_booths.rb b/db/migrate/20161206130836_delete_officing_booths.rb index 2ef1180ab..86bc9c166 100644 --- a/db/migrate/20161206130836_delete_officing_booths.rb +++ b/db/migrate/20161206130836_delete_officing_booths.rb @@ -1,4 +1,4 @@ -class DeleteOfficingBooths < ActiveRecord::Migration +class DeleteOfficingBooths < ActiveRecord::Migration[4.2] def self.up drop_table :poll_officing_booths end diff --git a/db/migrate/20161206131125_create_poll_officer_assignments.rb b/db/migrate/20161206131125_create_poll_officer_assignments.rb index f3a40017c..bc324f086 100644 --- a/db/migrate/20161206131125_create_poll_officer_assignments.rb +++ b/db/migrate/20161206131125_create_poll_officer_assignments.rb @@ -1,4 +1,4 @@ -class CreatePollOfficerAssignments < ActiveRecord::Migration +class CreatePollOfficerAssignments < ActiveRecord::Migration[4.2] def change create_table :poll_officer_assignments do |t| t.integer :booth_assignment_id diff --git a/db/migrate/20161206132126_rename_booth_id_to_booth_assignment_id.rb b/db/migrate/20161206132126_rename_booth_id_to_booth_assignment_id.rb index a1b59c749..95ed6dbcf 100644 --- a/db/migrate/20161206132126_rename_booth_id_to_booth_assignment_id.rb +++ b/db/migrate/20161206132126_rename_booth_id_to_booth_assignment_id.rb @@ -1,4 +1,4 @@ -class RenameBoothIdToBoothAssignmentId < ActiveRecord::Migration +class RenameBoothIdToBoothAssignmentId < ActiveRecord::Migration[4.2] def change remove_column :poll_voters, :booth_id, :integer diff --git a/db/migrate/20161207181001_remove_poll_id_from_voter.rb b/db/migrate/20161207181001_remove_poll_id_from_voter.rb index 5a7012460..dc7d18b61 100644 --- a/db/migrate/20161207181001_remove_poll_id_from_voter.rb +++ b/db/migrate/20161207181001_remove_poll_id_from_voter.rb @@ -1,4 +1,4 @@ -class RemovePollIdFromVoter < ActiveRecord::Migration +class RemovePollIdFromVoter < ActiveRecord::Migration[4.2] def change remove_column :poll_voters, :poll_id, :integer end diff --git a/db/migrate/20161213144031_add_body_html_to_draft_versions.rb b/db/migrate/20161213144031_add_body_html_to_draft_versions.rb index c0a05c809..328f69894 100644 --- a/db/migrate/20161213144031_add_body_html_to_draft_versions.rb +++ b/db/migrate/20161213144031_add_body_html_to_draft_versions.rb @@ -1,4 +1,4 @@ -class AddBodyHtmlToDraftVersions < ActiveRecord::Migration +class AddBodyHtmlToDraftVersions < ActiveRecord::Migration[4.2] def change add_column :legislation_draft_versions, :body_html, :text end diff --git a/db/migrate/20161214212918_create_signature_sheets.rb b/db/migrate/20161214212918_create_signature_sheets.rb index d34728a34..c15fd1b22 100644 --- a/db/migrate/20161214212918_create_signature_sheets.rb +++ b/db/migrate/20161214212918_create_signature_sheets.rb @@ -1,4 +1,4 @@ -class CreateSignatureSheets < ActiveRecord::Migration +class CreateSignatureSheets < ActiveRecord::Migration[4.2] def change create_table :signature_sheets do |t| t.references :signable, polymorphic: true @@ -8,4 +8,4 @@ class CreateSignatureSheets < ActiveRecord::Migration t.timestamps end end -end \ No newline at end of file +end diff --git a/db/migrate/20161214233817_create_signatures.rb b/db/migrate/20161214233817_create_signatures.rb index fd6b53d3a..c9cc65056 100644 --- a/db/migrate/20161214233817_create_signatures.rb +++ b/db/migrate/20161214233817_create_signatures.rb @@ -1,4 +1,4 @@ -class CreateSignatures < ActiveRecord::Migration +class CreateSignatures < ActiveRecord::Migration[4.2] def change create_table :signatures do |t| t.references :signature_sheet diff --git a/db/migrate/20161220120037_create_legislation_questions.rb b/db/migrate/20161220120037_create_legislation_questions.rb index 41bc3497f..a62a9d1c0 100644 --- a/db/migrate/20161220120037_create_legislation_questions.rb +++ b/db/migrate/20161220120037_create_legislation_questions.rb @@ -1,4 +1,4 @@ -class CreateLegislationQuestions < ActiveRecord::Migration +class CreateLegislationQuestions < ActiveRecord::Migration[4.2] def change create_table :legislation_questions do |t| t.references :legislation_process, index: true diff --git a/db/migrate/20161221131403_add_signture_id_to_votes.rb b/db/migrate/20161221131403_add_signture_id_to_votes.rb index 28851fdac..37850640f 100644 --- a/db/migrate/20161221131403_add_signture_id_to_votes.rb +++ b/db/migrate/20161221131403_add_signture_id_to_votes.rb @@ -1,4 +1,4 @@ -class AddSigntureIdToVotes < ActiveRecord::Migration +class AddSigntureIdToVotes < ActiveRecord::Migration[4.2] def change add_reference :votes, :signature, index: true end diff --git a/db/migrate/20161221151239_add_created_from_signature_to_users.rb b/db/migrate/20161221151239_add_created_from_signature_to_users.rb index 214bd43cb..7ec3d9a02 100644 --- a/db/migrate/20161221151239_add_created_from_signature_to_users.rb +++ b/db/migrate/20161221151239_add_created_from_signature_to_users.rb @@ -1,4 +1,4 @@ -class AddCreatedFromSignatureToUsers < ActiveRecord::Migration +class AddCreatedFromSignatureToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :created_from_signature, :boolean, default: false end diff --git a/db/migrate/20161221172447_add_selected_to_budget_investment.rb b/db/migrate/20161221172447_add_selected_to_budget_investment.rb index de983aee4..7f4f9bd91 100644 --- a/db/migrate/20161221172447_add_selected_to_budget_investment.rb +++ b/db/migrate/20161221172447_add_selected_to_budget_investment.rb @@ -1,4 +1,4 @@ -class AddSelectedToBudgetInvestment < ActiveRecord::Migration +class AddSelectedToBudgetInvestment < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :selected, :bool, default: false, index: true end diff --git a/db/migrate/20161222115744_create_legislation_answers.rb b/db/migrate/20161222115744_create_legislation_answers.rb index 0c8170d68..3d1223d4a 100644 --- a/db/migrate/20161222115744_create_legislation_answers.rb +++ b/db/migrate/20161222115744_create_legislation_answers.rb @@ -1,4 +1,4 @@ -class CreateLegislationAnswers < ActiveRecord::Migration +class CreateLegislationAnswers < ActiveRecord::Migration[4.2] def change create_table :legislation_answers do |t| t.references :legislation_question, index: true diff --git a/db/migrate/20161222171716_add_comments_count_to_legislation_questions.rb b/db/migrate/20161222171716_add_comments_count_to_legislation_questions.rb index e71a8879b..e2a5b6f29 100644 --- a/db/migrate/20161222171716_add_comments_count_to_legislation_questions.rb +++ b/db/migrate/20161222171716_add_comments_count_to_legislation_questions.rb @@ -1,4 +1,4 @@ -class AddCommentsCountToLegislationQuestions < ActiveRecord::Migration +class AddCommentsCountToLegislationQuestions < ActiveRecord::Migration[4.2] def change add_column :legislation_questions, :comments_count, :integer, default: 0 end diff --git a/db/migrate/20161222180927_add_author_to_legislation_questions.rb b/db/migrate/20161222180927_add_author_to_legislation_questions.rb index a06190045..4631f9030 100644 --- a/db/migrate/20161222180927_add_author_to_legislation_questions.rb +++ b/db/migrate/20161222180927_add_author_to_legislation_questions.rb @@ -1,4 +1,4 @@ -class AddAuthorToLegislationQuestions < ActiveRecord::Migration +class AddAuthorToLegislationQuestions < ActiveRecord::Migration[4.2] def change add_column :legislation_questions, :author_id, :integer end diff --git a/db/migrate/20161227140109_add_date_to_officer_assignment.rb b/db/migrate/20161227140109_add_date_to_officer_assignment.rb index b7c88a37b..4a8c4f27d 100644 --- a/db/migrate/20161227140109_add_date_to_officer_assignment.rb +++ b/db/migrate/20161227140109_add_date_to_officer_assignment.rb @@ -1,4 +1,4 @@ -class AddDateToOfficerAssignment < ActiveRecord::Migration +class AddDateToOfficerAssignment < ActiveRecord::Migration[4.2] def change add_column :poll_officer_assignments, :date, :datetime end diff --git a/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb b/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb index 34e0e5e44..603f1d095 100644 --- a/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb +++ b/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb @@ -1,4 +1,4 @@ -class RemovePhysicalVotesFromProposals < ActiveRecord::Migration +class RemovePhysicalVotesFromProposals < ActiveRecord::Migration[4.2] def change remove_column :proposals, :physical_votes end diff --git a/db/migrate/20161229153505_add_location_to_budget_investments.rb b/db/migrate/20161229153505_add_location_to_budget_investments.rb index a58ee4fdd..15a5991c1 100644 --- a/db/migrate/20161229153505_add_location_to_budget_investments.rb +++ b/db/migrate/20161229153505_add_location_to_budget_investments.rb @@ -1,4 +1,4 @@ -class AddLocationToBudgetInvestments < ActiveRecord::Migration +class AddLocationToBudgetInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :location, :string end diff --git a/db/migrate/20161229213217_add_toc_html_to_draft_versions.rb b/db/migrate/20161229213217_add_toc_html_to_draft_versions.rb index f71070e52..5ceafa8bb 100644 --- a/db/migrate/20161229213217_add_toc_html_to_draft_versions.rb +++ b/db/migrate/20161229213217_add_toc_html_to_draft_versions.rb @@ -1,4 +1,4 @@ -class AddTocHtmlToDraftVersions < ActiveRecord::Migration +class AddTocHtmlToDraftVersions < ActiveRecord::Migration[4.2] def change add_column :legislation_draft_versions, :toc_html, :text end diff --git a/db/migrate/20161230172816_remove_valuating_from_budgets.rb b/db/migrate/20161230172816_remove_valuating_from_budgets.rb index 4b6e97e7f..96ec15303 100644 --- a/db/migrate/20161230172816_remove_valuating_from_budgets.rb +++ b/db/migrate/20161230172816_remove_valuating_from_budgets.rb @@ -1,4 +1,4 @@ -class RemoveValuatingFromBudgets < ActiveRecord::Migration +class RemoveValuatingFromBudgets < ActiveRecord::Migration[4.2] def change remove_column :budgets, :valuating, :bool end diff --git a/db/migrate/20161230174744_change_budget_description.rb b/db/migrate/20161230174744_change_budget_description.rb index 80de9dcf4..474a127db 100644 --- a/db/migrate/20161230174744_change_budget_description.rb +++ b/db/migrate/20161230174744_change_budget_description.rb @@ -1,4 +1,4 @@ -class ChangeBudgetDescription < ActiveRecord::Migration +class ChangeBudgetDescription < ActiveRecord::Migration[4.2] def change remove_column :budgets, :description, :text add_column :budgets, :description_accepting, :text diff --git a/db/migrate/20170102080432_adjust_budget_fields.rb b/db/migrate/20170102080432_adjust_budget_fields.rb index 7517d6429..c39afe8b1 100644 --- a/db/migrate/20170102080432_adjust_budget_fields.rb +++ b/db/migrate/20170102080432_adjust_budget_fields.rb @@ -1,4 +1,4 @@ -class AdjustBudgetFields < ActiveRecord::Migration +class AdjustBudgetFields < ActiveRecord::Migration[4.2] def change change_column :budgets, :phase, :string, limit: 40, default: 'accepting' end diff --git a/db/migrate/20170102114446_create_poll_recounts.rb b/db/migrate/20170102114446_create_poll_recounts.rb index 9643f5b0a..dd548361e 100644 --- a/db/migrate/20170102114446_create_poll_recounts.rb +++ b/db/migrate/20170102114446_create_poll_recounts.rb @@ -1,4 +1,4 @@ -class CreatePollRecounts < ActiveRecord::Migration +class CreatePollRecounts < ActiveRecord::Migration[4.2] def change create_table :poll_recounts do |t| t.integer :booth_assignment_id diff --git a/db/migrate/20170102170125_add_published_to_polls.rb b/db/migrate/20170102170125_add_published_to_polls.rb index 51da03f34..f62d54b7b 100644 --- a/db/migrate/20170102170125_add_published_to_polls.rb +++ b/db/migrate/20170102170125_add_published_to_polls.rb @@ -1,4 +1,4 @@ -class AddPublishedToPolls < ActiveRecord::Migration +class AddPublishedToPolls < ActiveRecord::Migration[4.2] def change add_column :polls, :published, :boolean, default: false end diff --git a/db/migrate/20170103125835_create_legislation_annotations.rb b/db/migrate/20170103125835_create_legislation_annotations.rb index 723bf3813..37ae3e42a 100644 --- a/db/migrate/20170103125835_create_legislation_annotations.rb +++ b/db/migrate/20170103125835_create_legislation_annotations.rb @@ -1,4 +1,4 @@ -class CreateLegislationAnnotations < ActiveRecord::Migration +class CreateLegislationAnnotations < ActiveRecord::Migration[4.2] def change create_table :legislation_annotations do |t| t.string :quote diff --git a/db/migrate/20170103170147_remove_geozone_id_from_budget_headings.rb b/db/migrate/20170103170147_remove_geozone_id_from_budget_headings.rb index bc8a9729c..7965c1e83 100644 --- a/db/migrate/20170103170147_remove_geozone_id_from_budget_headings.rb +++ b/db/migrate/20170103170147_remove_geozone_id_from_budget_headings.rb @@ -1,4 +1,4 @@ -class RemoveGeozoneIdFromBudgetHeadings < ActiveRecord::Migration +class RemoveGeozoneIdFromBudgetHeadings < ActiveRecord::Migration[4.2] def change remove_column :budget_headings, :geozone_id end diff --git a/db/migrate/20170103191711_add_date_and_officer_assignment_log_to_poll_recounts.rb b/db/migrate/20170103191711_add_date_and_officer_assignment_log_to_poll_recounts.rb index e0f813500..9fd98aa46 100644 --- a/db/migrate/20170103191711_add_date_and_officer_assignment_log_to_poll_recounts.rb +++ b/db/migrate/20170103191711_add_date_and_officer_assignment_log_to_poll_recounts.rb @@ -1,4 +1,4 @@ -class AddDateAndOfficerAssignmentLogToPollRecounts < ActiveRecord::Migration +class AddDateAndOfficerAssignmentLogToPollRecounts < ActiveRecord::Migration[4.2] def change add_column :poll_recounts, :date, :datetime add_column :poll_recounts, :officer_assignment_id_log, :text, default: "" diff --git a/db/migrate/20170105120836_add_comments_count_to_legislation_annotation.rb b/db/migrate/20170105120836_add_comments_count_to_legislation_annotation.rb index 39b2e6387..990369884 100644 --- a/db/migrate/20170105120836_add_comments_count_to_legislation_annotation.rb +++ b/db/migrate/20170105120836_add_comments_count_to_legislation_annotation.rb @@ -1,4 +1,4 @@ -class AddCommentsCountToLegislationAnnotation < ActiveRecord::Migration +class AddCommentsCountToLegislationAnnotation < ActiveRecord::Migration[4.2] def change add_column :legislation_annotations, :comments_count, :integer, default: 0 end diff --git a/db/migrate/20170105212047_rename_user_to_author_in_legislation_annotations.rb b/db/migrate/20170105212047_rename_user_to_author_in_legislation_annotations.rb index 55b70395b..e554ca5e9 100644 --- a/db/migrate/20170105212047_rename_user_to_author_in_legislation_annotations.rb +++ b/db/migrate/20170105212047_rename_user_to_author_in_legislation_annotations.rb @@ -1,4 +1,4 @@ -class RenameUserToAuthorInLegislationAnnotations < ActiveRecord::Migration +class RenameUserToAuthorInLegislationAnnotations < ActiveRecord::Migration[4.2] def change rename_column :legislation_annotations, :user_id, :author_id end diff --git a/db/migrate/20170105215410_add_failed_email_digests_count_to_users.rb b/db/migrate/20170105215410_add_failed_email_digests_count_to_users.rb index 44744ed98..1a1b0e704 100644 --- a/db/migrate/20170105215410_add_failed_email_digests_count_to_users.rb +++ b/db/migrate/20170105215410_add_failed_email_digests_count_to_users.rb @@ -1,4 +1,4 @@ -class AddFailedEmailDigestsCountToUsers < ActiveRecord::Migration +class AddFailedEmailDigestsCountToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :failed_email_digests_count, :integer, default: 0 end diff --git a/db/migrate/20170106130838_add_organization_name_field_to_budget_investment.rb b/db/migrate/20170106130838_add_organization_name_field_to_budget_investment.rb index dfe9eca06..df0f1eec6 100644 --- a/db/migrate/20170106130838_add_organization_name_field_to_budget_investment.rb +++ b/db/migrate/20170106130838_add_organization_name_field_to_budget_investment.rb @@ -1,4 +1,4 @@ -class AddOrganizationNameFieldToBudgetInvestment < ActiveRecord::Migration +class AddOrganizationNameFieldToBudgetInvestment < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :organization_name, :string end diff --git a/db/migrate/20170114154421_add_unfeasible_email_sent_at_to_budget_investments.rb b/db/migrate/20170114154421_add_unfeasible_email_sent_at_to_budget_investments.rb index dbd1a203b..f606e5792 100644 --- a/db/migrate/20170114154421_add_unfeasible_email_sent_at_to_budget_investments.rb +++ b/db/migrate/20170114154421_add_unfeasible_email_sent_at_to_budget_investments.rb @@ -1,4 +1,4 @@ -class AddUnfeasibleEmailSentAtToBudgetInvestments < ActiveRecord::Migration +class AddUnfeasibleEmailSentAtToBudgetInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :unfeasible_email_sent_at, :datetime end diff --git a/db/migrate/20170120153244_move_geozones_from_poll_questions_to_polls.rb b/db/migrate/20170120153244_move_geozones_from_poll_questions_to_polls.rb index a2606c370..a94cde61c 100644 --- a/db/migrate/20170120153244_move_geozones_from_poll_questions_to_polls.rb +++ b/db/migrate/20170120153244_move_geozones_from_poll_questions_to_polls.rb @@ -1,4 +1,4 @@ -class MoveGeozonesFromPollQuestionsToPolls < ActiveRecord::Migration +class MoveGeozonesFromPollQuestionsToPolls < ActiveRecord::Migration[4.2] def change drop_table :geozones_poll_questions diff --git a/db/migrate/20170120161058_add_geozone_restricted_to_polls.rb b/db/migrate/20170120161058_add_geozone_restricted_to_polls.rb index d6ed3a2c7..89afbafad 100644 --- a/db/migrate/20170120161058_add_geozone_restricted_to_polls.rb +++ b/db/migrate/20170120161058_add_geozone_restricted_to_polls.rb @@ -1,4 +1,4 @@ -class AddGeozoneRestrictedToPolls < ActiveRecord::Migration +class AddGeozoneRestrictedToPolls < ActiveRecord::Migration[4.2] def change add_column :polls, :geozone_restricted, :boolean, default: false, index: true end diff --git a/db/migrate/20170120164547_remove_all_geozones_from_poll_questions.rb b/db/migrate/20170120164547_remove_all_geozones_from_poll_questions.rb index b4fcecd20..23b67133c 100644 --- a/db/migrate/20170120164547_remove_all_geozones_from_poll_questions.rb +++ b/db/migrate/20170120164547_remove_all_geozones_from_poll_questions.rb @@ -1,4 +1,4 @@ -class RemoveAllGeozonesFromPollQuestions < ActiveRecord::Migration +class RemoveAllGeozonesFromPollQuestions < ActiveRecord::Migration[4.2] def change remove_column :poll_questions, :all_geozones, :boolean end diff --git a/db/migrate/20170125093101_add_ranges_fields_to_legislation_annotations.rb b/db/migrate/20170125093101_add_ranges_fields_to_legislation_annotations.rb index 69ae9df65..1347a681b 100644 --- a/db/migrate/20170125093101_add_ranges_fields_to_legislation_annotations.rb +++ b/db/migrate/20170125093101_add_ranges_fields_to_legislation_annotations.rb @@ -1,4 +1,4 @@ -class AddRangesFieldsToLegislationAnnotations < ActiveRecord::Migration +class AddRangesFieldsToLegislationAnnotations < ActiveRecord::Migration[4.2] def change add_column :legislation_annotations, :range_start, :string add_column :legislation_annotations, :range_start_offset, :integer diff --git a/db/migrate/20170125104542_add_poll_id_and_stats_fields_to_poll_voter.rb b/db/migrate/20170125104542_add_poll_id_and_stats_fields_to_poll_voter.rb index 84e7de5d9..6488f099e 100644 --- a/db/migrate/20170125104542_add_poll_id_and_stats_fields_to_poll_voter.rb +++ b/db/migrate/20170125104542_add_poll_id_and_stats_fields_to_poll_voter.rb @@ -1,4 +1,4 @@ -class AddPollIdAndStatsFieldsToPollVoter < ActiveRecord::Migration +class AddPollIdAndStatsFieldsToPollVoter < ActiveRecord::Migration[4.2] def change add_column :poll_voters, :poll_id, :integer, null: false diff --git a/db/migrate/20170125112017_create_poll_answers.rb b/db/migrate/20170125112017_create_poll_answers.rb index 7ea930d0c..7bd585de3 100644 --- a/db/migrate/20170125112017_create_poll_answers.rb +++ b/db/migrate/20170125112017_create_poll_answers.rb @@ -1,4 +1,4 @@ -class CreatePollAnswers < ActiveRecord::Migration +class CreatePollAnswers < ActiveRecord::Migration[4.2] def change create_table :poll_answers do |t| t.integer :question_id diff --git a/db/migrate/20170125114952_add_answer_id_to_poll_voters.rb b/db/migrate/20170125114952_add_answer_id_to_poll_voters.rb index 34d5bbc54..58d8fabc9 100644 --- a/db/migrate/20170125114952_add_answer_id_to_poll_voters.rb +++ b/db/migrate/20170125114952_add_answer_id_to_poll_voters.rb @@ -1,4 +1,4 @@ -class AddAnswerIdToPollVoters < ActiveRecord::Migration +class AddAnswerIdToPollVoters < ActiveRecord::Migration[4.2] def change add_column :poll_voters, :answer_id, :integer, default: nil diff --git a/db/migrate/20170127173553_add_officer_assignment_to_votes.rb b/db/migrate/20170127173553_add_officer_assignment_to_votes.rb index 1942ef08f..18af88d83 100644 --- a/db/migrate/20170127173553_add_officer_assignment_to_votes.rb +++ b/db/migrate/20170127173553_add_officer_assignment_to_votes.rb @@ -1,4 +1,4 @@ -class AddOfficerAssignmentToVotes < ActiveRecord::Migration +class AddOfficerAssignmentToVotes < ActiveRecord::Migration[4.2] def change add_column :poll_voters, :officer_assignment_id, :integer, default: nil end diff --git a/db/migrate/20170128214244_adds_user_id_to_poll_voters.rb b/db/migrate/20170128214244_adds_user_id_to_poll_voters.rb index edf635cfc..67f81261f 100644 --- a/db/migrate/20170128214244_adds_user_id_to_poll_voters.rb +++ b/db/migrate/20170128214244_adds_user_id_to_poll_voters.rb @@ -1,4 +1,4 @@ -class AddsUserIdToPollVoters < ActiveRecord::Migration +class AddsUserIdToPollVoters < ActiveRecord::Migration[4.2] def change add_reference :poll_voters, :user, index: true end diff --git a/db/migrate/20170130101121_create_poll_final_recount.rb b/db/migrate/20170130101121_create_poll_final_recount.rb index 07723b708..50393cf55 100644 --- a/db/migrate/20170130101121_create_poll_final_recount.rb +++ b/db/migrate/20170130101121_create_poll_final_recount.rb @@ -1,4 +1,4 @@ -class CreatePollFinalRecount < ActiveRecord::Migration +class CreatePollFinalRecount < ActiveRecord::Migration[4.2] def change create_table :poll_final_recounts do |t| t.integer :booth_assignment_id diff --git a/db/migrate/20170130103550_add_final_to_poll_officer_assignments.rb b/db/migrate/20170130103550_add_final_to_poll_officer_assignments.rb index 4cafb5ffb..3b9c2aa91 100644 --- a/db/migrate/20170130103550_add_final_to_poll_officer_assignments.rb +++ b/db/migrate/20170130103550_add_final_to_poll_officer_assignments.rb @@ -1,4 +1,4 @@ -class AddFinalToPollOfficerAssignments < ActiveRecord::Migration +class AddFinalToPollOfficerAssignments < ActiveRecord::Migration[4.2] def change add_column :poll_officer_assignments, :final, :boolean, default: false end diff --git a/db/migrate/20170130133736_add_date_to_final_recount.rb b/db/migrate/20170130133736_add_date_to_final_recount.rb index 14d0f564c..f4f9756f6 100644 --- a/db/migrate/20170130133736_add_date_to_final_recount.rb +++ b/db/migrate/20170130133736_add_date_to_final_recount.rb @@ -1,4 +1,4 @@ -class AddDateToFinalRecount < ActiveRecord::Migration +class AddDateToFinalRecount < ActiveRecord::Migration[4.2] def change add_column :poll_final_recounts, :date, :datetime, null: false end diff --git a/db/migrate/20170130163030_change_datetimes_to_date_in_recounts_and_assignments.rb b/db/migrate/20170130163030_change_datetimes_to_date_in_recounts_and_assignments.rb index 2ef6d0d5a..08ddfc765 100644 --- a/db/migrate/20170130163030_change_datetimes_to_date_in_recounts_and_assignments.rb +++ b/db/migrate/20170130163030_change_datetimes_to_date_in_recounts_and_assignments.rb @@ -1,4 +1,4 @@ -class ChangeDatetimesToDateInRecountsAndAssignments < ActiveRecord::Migration +class ChangeDatetimesToDateInRecountsAndAssignments < ActiveRecord::Migration[4.2] def up change_column :poll_recounts, :date, :date, null: false change_column :poll_final_recounts, :date, :date, null: false diff --git a/db/migrate/20170130171322_remove_summary_from_poll_question.rb b/db/migrate/20170130171322_remove_summary_from_poll_question.rb index 02c5fb68e..8c72b356d 100644 --- a/db/migrate/20170130171322_remove_summary_from_poll_question.rb +++ b/db/migrate/20170130171322_remove_summary_from_poll_question.rb @@ -1,4 +1,4 @@ -class RemoveSummaryFromPollQuestion < ActiveRecord::Migration +class RemoveSummaryFromPollQuestion < ActiveRecord::Migration[4.2] def change remove_column :poll_questions, :summary end diff --git a/db/migrate/20170201113206_adds_fields_to_poll_partial_results.rb b/db/migrate/20170201113206_adds_fields_to_poll_partial_results.rb index 3755dc700..76ff198cd 100644 --- a/db/migrate/20170201113206_adds_fields_to_poll_partial_results.rb +++ b/db/migrate/20170201113206_adds_fields_to_poll_partial_results.rb @@ -1,4 +1,4 @@ -class AddsFieldsToPollPartialResults < ActiveRecord::Migration +class AddsFieldsToPollPartialResults < ActiveRecord::Migration[4.2] def change add_column :poll_partial_results, :date, :date add_column :poll_partial_results, :booth_assignment_id, :integer diff --git a/db/migrate/20170202151151_add_log_fields_to_poll_partial_results.rb b/db/migrate/20170202151151_add_log_fields_to_poll_partial_results.rb index 86966aed4..3038274c5 100644 --- a/db/migrate/20170202151151_add_log_fields_to_poll_partial_results.rb +++ b/db/migrate/20170202151151_add_log_fields_to_poll_partial_results.rb @@ -1,4 +1,4 @@ -class AddLogFieldsToPollPartialResults < ActiveRecord::Migration +class AddLogFieldsToPollPartialResults < ActiveRecord::Migration[4.2] def change add_column :poll_partial_results, :amount_log, :text, default: "" add_column :poll_partial_results, :officer_assignment_id_log, :text, default: "" diff --git a/db/migrate/20170203163304_create_poll_white_results.rb b/db/migrate/20170203163304_create_poll_white_results.rb index 2ebfc93b1..7fc178a22 100644 --- a/db/migrate/20170203163304_create_poll_white_results.rb +++ b/db/migrate/20170203163304_create_poll_white_results.rb @@ -1,4 +1,4 @@ -class CreatePollWhiteResults < ActiveRecord::Migration +class CreatePollWhiteResults < ActiveRecord::Migration[4.2] def change create_table :poll_white_results do |t| t.integer :author_id diff --git a/db/migrate/20170203163317_create_poll_null_results.rb b/db/migrate/20170203163317_create_poll_null_results.rb index 9c138cf65..e11627bef 100644 --- a/db/migrate/20170203163317_create_poll_null_results.rb +++ b/db/migrate/20170203163317_create_poll_null_results.rb @@ -1,4 +1,4 @@ -class CreatePollNullResults < ActiveRecord::Migration +class CreatePollNullResults < ActiveRecord::Migration[4.2] def change create_table :poll_null_results do |t| t.integer :author_id diff --git a/db/migrate/20170208110146_add_officer_id_to_failed_census_calls.rb b/db/migrate/20170208110146_add_officer_id_to_failed_census_calls.rb index 6ce289bec..a7c73528b 100644 --- a/db/migrate/20170208110146_add_officer_id_to_failed_census_calls.rb +++ b/db/migrate/20170208110146_add_officer_id_to_failed_census_calls.rb @@ -1,4 +1,4 @@ -class AddOfficerIdToFailedCensusCalls < ActiveRecord::Migration +class AddOfficerIdToFailedCensusCalls < ActiveRecord::Migration[4.2] def change add_column :failed_census_calls, :poll_officer_id, :integer, index: true add_foreign_key :failed_census_calls, :poll_officers diff --git a/db/migrate/20170208111639_add_failed_census_calls_count_to_poll_officers.rb b/db/migrate/20170208111639_add_failed_census_calls_count_to_poll_officers.rb index 664c51749..c88b0d959 100644 --- a/db/migrate/20170208111639_add_failed_census_calls_count_to_poll_officers.rb +++ b/db/migrate/20170208111639_add_failed_census_calls_count_to_poll_officers.rb @@ -1,4 +1,4 @@ -class AddFailedCensusCallsCountToPollOfficers < ActiveRecord::Migration +class AddFailedCensusCallsCountToPollOfficers < ActiveRecord::Migration[4.2] def change add_column :poll_officers, :failed_census_calls_count, :integer, default: 0 end diff --git a/db/migrate/20170208112814_add_year_of_birth_to_failed_census_calls.rb b/db/migrate/20170208112814_add_year_of_birth_to_failed_census_calls.rb index a3fb5c96a..79f8deed4 100644 --- a/db/migrate/20170208112814_add_year_of_birth_to_failed_census_calls.rb +++ b/db/migrate/20170208112814_add_year_of_birth_to_failed_census_calls.rb @@ -1,4 +1,4 @@ -class AddYearOfBirthToFailedCensusCalls < ActiveRecord::Migration +class AddYearOfBirthToFailedCensusCalls < ActiveRecord::Migration[4.2] def change add_column :failed_census_calls, :year_of_birth, :integer end diff --git a/db/migrate/20170208114548_add_user_data_log_to_poll_officer_assignments.rb b/db/migrate/20170208114548_add_user_data_log_to_poll_officer_assignments.rb index 93c2efd8b..b09e75a81 100644 --- a/db/migrate/20170208114548_add_user_data_log_to_poll_officer_assignments.rb +++ b/db/migrate/20170208114548_add_user_data_log_to_poll_officer_assignments.rb @@ -1,4 +1,4 @@ -class AddUserDataLogToPollOfficerAssignments < ActiveRecord::Migration +class AddUserDataLogToPollOfficerAssignments < ActiveRecord::Migration[4.2] def change add_column :poll_officer_assignments, :user_data_log, :string, default: "" end diff --git a/db/migrate/20170208160130_add_former_users_data_log_to_users.rb b/db/migrate/20170208160130_add_former_users_data_log_to_users.rb index 2cd3ca956..05b4ac66e 100644 --- a/db/migrate/20170208160130_add_former_users_data_log_to_users.rb +++ b/db/migrate/20170208160130_add_former_users_data_log_to_users.rb @@ -1,4 +1,4 @@ -class AddFormerUsersDataLogToUsers < ActiveRecord::Migration +class AddFormerUsersDataLogToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :former_users_data_log, :text, default: "" end diff --git a/db/migrate/20170210083026_add_context_for_legislation_annotations.rb b/db/migrate/20170210083026_add_context_for_legislation_annotations.rb index 8bf19a64c..91166b571 100644 --- a/db/migrate/20170210083026_add_context_for_legislation_annotations.rb +++ b/db/migrate/20170210083026_add_context_for_legislation_annotations.rb @@ -1,4 +1,4 @@ -class AddContextForLegislationAnnotations < ActiveRecord::Migration +class AddContextForLegislationAnnotations < ActiveRecord::Migration[4.2] def change add_column :legislation_annotations, :context, :text end diff --git a/db/migrate/20170212123435_add_polls_related_indexes.rb b/db/migrate/20170212123435_add_polls_related_indexes.rb index f1a667432..31f567e89 100644 --- a/db/migrate/20170212123435_add_polls_related_indexes.rb +++ b/db/migrate/20170212123435_add_polls_related_indexes.rb @@ -1,4 +1,4 @@ -class AddPollsRelatedIndexes < ActiveRecord::Migration +class AddPollsRelatedIndexes < ActiveRecord::Migration[4.2] def change add_index :poll_booth_assignments, :booth_id diff --git a/db/migrate/20170316174351_create_site_customization_pages.rb b/db/migrate/20170316174351_create_site_customization_pages.rb index 3c4fbe846..8489c8263 100644 --- a/db/migrate/20170316174351_create_site_customization_pages.rb +++ b/db/migrate/20170316174351_create_site_customization_pages.rb @@ -1,4 +1,4 @@ -class CreateSiteCustomizationPages < ActiveRecord::Migration +class CreateSiteCustomizationPages < ActiveRecord::Migration[4.2] def change create_table :site_customization_pages do |t| t.string :slug, null: false diff --git a/db/migrate/20170322145702_create_site_customization_images.rb b/db/migrate/20170322145702_create_site_customization_images.rb index 4f980b566..749601f46 100644 --- a/db/migrate/20170322145702_create_site_customization_images.rb +++ b/db/migrate/20170322145702_create_site_customization_images.rb @@ -1,4 +1,4 @@ -class CreateSiteCustomizationImages < ActiveRecord::Migration +class CreateSiteCustomizationImages < ActiveRecord::Migration[4.2] def change create_table :site_customization_images do |t| t.string :name, null: false diff --git a/db/migrate/20170324101716_create_site_customization_content_blocks.rb b/db/migrate/20170324101716_create_site_customization_content_blocks.rb index d0e4c3822..a8ba36284 100644 --- a/db/migrate/20170324101716_create_site_customization_content_blocks.rb +++ b/db/migrate/20170324101716_create_site_customization_content_blocks.rb @@ -1,4 +1,4 @@ -class CreateSiteCustomizationContentBlocks < ActiveRecord::Migration +class CreateSiteCustomizationContentBlocks < ActiveRecord::Migration[4.2] def change create_table :site_customization_content_blocks do |t| t.string :name diff --git a/db/migrate/20170427145845_change_budget_name.rb b/db/migrate/20170427145845_change_budget_name.rb index cbf5e12db..9f371a797 100644 --- a/db/migrate/20170427145845_change_budget_name.rb +++ b/db/migrate/20170427145845_change_budget_name.rb @@ -1,4 +1,4 @@ -class ChangeBudgetName < ActiveRecord::Migration +class ChangeBudgetName < ActiveRecord::Migration[4.2] def up change_column :budgets, :name, :string, limit: 80 end diff --git a/db/migrate/20170428111355_add_ballot_line_count_to_investments.rb b/db/migrate/20170428111355_add_ballot_line_count_to_investments.rb index a864075a8..6df6d2ecf 100644 --- a/db/migrate/20170428111355_add_ballot_line_count_to_investments.rb +++ b/db/migrate/20170428111355_add_ballot_line_count_to_investments.rb @@ -1,4 +1,4 @@ -class AddBallotLineCountToInvestments < ActiveRecord::Migration +class AddBallotLineCountToInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :ballot_lines_count, :integer, default: 0 end diff --git a/db/migrate/20170503163330_add_uniq_index_for_ballot_lines.rb b/db/migrate/20170503163330_add_uniq_index_for_ballot_lines.rb index dec90f329..de49e4f2d 100644 --- a/db/migrate/20170503163330_add_uniq_index_for_ballot_lines.rb +++ b/db/migrate/20170503163330_add_uniq_index_for_ballot_lines.rb @@ -1,4 +1,4 @@ -class AddUniqIndexForBallotLines < ActiveRecord::Migration +class AddUniqIndexForBallotLines < ActiveRecord::Migration[4.2] def change add_index :budget_ballot_lines, [:ballot_id, :investment_id], unique: true end diff --git a/db/migrate/20170513110025_add_previous_heading_id_to_investments.rb b/db/migrate/20170513110025_add_previous_heading_id_to_investments.rb index 878799712..be1eea5ab 100644 --- a/db/migrate/20170513110025_add_previous_heading_id_to_investments.rb +++ b/db/migrate/20170513110025_add_previous_heading_id_to_investments.rb @@ -1,4 +1,4 @@ -class AddPreviousHeadingIdToInvestments < ActiveRecord::Migration +class AddPreviousHeadingIdToInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :previous_heading_id, :integer end diff --git a/db/migrate/20170517123042_create_budget_reclassified_votes.rb b/db/migrate/20170517123042_create_budget_reclassified_votes.rb index 27cf531d3..10d5d8127 100644 --- a/db/migrate/20170517123042_create_budget_reclassified_votes.rb +++ b/db/migrate/20170517123042_create_budget_reclassified_votes.rb @@ -1,4 +1,4 @@ -class CreateBudgetReclassifiedVotes < ActiveRecord::Migration +class CreateBudgetReclassifiedVotes < ActiveRecord::Migration[4.2] def change create_table :budget_reclassified_votes do |t| t.integer :user_id diff --git a/db/migrate/20170519084239_add_winner_to_budget_investments.rb b/db/migrate/20170519084239_add_winner_to_budget_investments.rb index af6085468..32f33d22a 100644 --- a/db/migrate/20170519084239_add_winner_to_budget_investments.rb +++ b/db/migrate/20170519084239_add_winner_to_budget_investments.rb @@ -1,4 +1,4 @@ -class AddWinnerToBudgetInvestments < ActiveRecord::Migration +class AddWinnerToBudgetInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :winner, :boolean, default: false end diff --git a/db/migrate/20170602162155_add_summary_to_legislative_process.rb b/db/migrate/20170602162155_add_summary_to_legislative_process.rb index 7ac9d2255..d118528ad 100644 --- a/db/migrate/20170602162155_add_summary_to_legislative_process.rb +++ b/db/migrate/20170602162155_add_summary_to_legislative_process.rb @@ -1,4 +1,4 @@ -class AddSummaryToLegislativeProcess < ActiveRecord::Migration +class AddSummaryToLegislativeProcess < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :summary, :text, limit: 280 end diff --git a/db/migrate/20170610211027_remove_ht_participate_and_target_from_leg_process.rb b/db/migrate/20170610211027_remove_ht_participate_and_target_from_leg_process.rb index f7fbda32c..065b608b0 100644 --- a/db/migrate/20170610211027_remove_ht_participate_and_target_from_leg_process.rb +++ b/db/migrate/20170610211027_remove_ht_participate_and_target_from_leg_process.rb @@ -1,4 +1,4 @@ -class RemoveHtParticipateAndTargetFromLegProcess < ActiveRecord::Migration +class RemoveHtParticipateAndTargetFromLegProcess < ActiveRecord::Migration[4.2] def change remove_column :legislation_processes, :how_to_participate, :text remove_column :legislation_processes, :target, :text diff --git a/db/migrate/20170613174317_rename_legislation_process_final_pub_to_result_pub.rb b/db/migrate/20170613174317_rename_legislation_process_final_pub_to_result_pub.rb index e71314531..81690e517 100644 --- a/db/migrate/20170613174317_rename_legislation_process_final_pub_to_result_pub.rb +++ b/db/migrate/20170613174317_rename_legislation_process_final_pub_to_result_pub.rb @@ -1,4 +1,4 @@ -class RenameLegislationProcessFinalPubToResultPub < ActiveRecord::Migration +class RenameLegislationProcessFinalPubToResultPub < ActiveRecord::Migration[4.2] def change rename_column :legislation_processes, :final_publication_date, :result_publication_date end diff --git a/db/migrate/20170613203256_add_phase_pub_enabled_status_to_legislative_process.rb b/db/migrate/20170613203256_add_phase_pub_enabled_status_to_legislative_process.rb index 7e6ecda96..b331f65f9 100644 --- a/db/migrate/20170613203256_add_phase_pub_enabled_status_to_legislative_process.rb +++ b/db/migrate/20170613203256_add_phase_pub_enabled_status_to_legislative_process.rb @@ -1,4 +1,4 @@ -class AddPhasePubEnabledStatusToLegislativeProcess < ActiveRecord::Migration +class AddPhasePubEnabledStatusToLegislativeProcess < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :debate_phase_enabled, :boolean, default: false add_column :legislation_processes, :allegations_phase_enabled, :boolean, default: false diff --git a/db/migrate/20170620132731_create_budget_investment_milestones.rb b/db/migrate/20170620132731_create_budget_investment_milestones.rb index 199d8e70e..669417334 100644 --- a/db/migrate/20170620132731_create_budget_investment_milestones.rb +++ b/db/migrate/20170620132731_create_budget_investment_milestones.rb @@ -1,4 +1,4 @@ -class CreateBudgetInvestmentMilestones < ActiveRecord::Migration +class CreateBudgetInvestmentMilestones < ActiveRecord::Migration[4.2] def change create_table :budget_investment_milestones do |t| t.integer :investment_id diff --git a/db/migrate/20170621180611_add_population_to_budget_headings.rb b/db/migrate/20170621180611_add_population_to_budget_headings.rb index fe723bc98..6125a2c5f 100644 --- a/db/migrate/20170621180611_add_population_to_budget_headings.rb +++ b/db/migrate/20170621180611_add_population_to_budget_headings.rb @@ -1,4 +1,4 @@ -class AddPopulationToBudgetHeadings < ActiveRecord::Migration +class AddPopulationToBudgetHeadings < ActiveRecord::Migration[4.2] def change add_column :budget_headings, :population, :integer, default: nil end diff --git a/db/migrate/20170623141655_remove_featured_from_tags.rb b/db/migrate/20170623141655_remove_featured_from_tags.rb index a819cf553..ac8472e4e 100644 --- a/db/migrate/20170623141655_remove_featured_from_tags.rb +++ b/db/migrate/20170623141655_remove_featured_from_tags.rb @@ -1,4 +1,4 @@ -class RemoveFeaturedFromTags < ActiveRecord::Migration +class RemoveFeaturedFromTags < ActiveRecord::Migration[4.2] def change remove_column :tags, :featured, :boolean, default: false end diff --git a/db/migrate/20170626081337_add_published_to_legislation_processes.rb b/db/migrate/20170626081337_add_published_to_legislation_processes.rb index abb03f2f8..5b36994ba 100644 --- a/db/migrate/20170626081337_add_published_to_legislation_processes.rb +++ b/db/migrate/20170626081337_add_published_to_legislation_processes.rb @@ -1,4 +1,4 @@ -class AddPublishedToLegislationProcesses < ActiveRecord::Migration +class AddPublishedToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :published, :boolean, default: true end diff --git a/db/migrate/20170626180127_create_follows.rb b/db/migrate/20170626180127_create_follows.rb index d4225cab8..af9da19bf 100644 --- a/db/migrate/20170626180127_create_follows.rb +++ b/db/migrate/20170626180127_create_follows.rb @@ -1,4 +1,4 @@ -class CreateFollows < ActiveRecord::Migration +class CreateFollows < ActiveRecord::Migration[4.2] def change create_table :follows do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170627113331_create_images.rb b/db/migrate/20170627113331_create_images.rb index 66567845a..e82e3cd14 100644 --- a/db/migrate/20170627113331_create_images.rb +++ b/db/migrate/20170627113331_create_images.rb @@ -1,4 +1,4 @@ -class CreateImages < ActiveRecord::Migration +class CreateImages < ActiveRecord::Migration[4.2] def up create_table :images do |t| t.references :imageable, polymorphic: true, index: true diff --git a/db/migrate/20170630105250_add_public_interests_to_user.rb b/db/migrate/20170630105250_add_public_interests_to_user.rb index 8fec4a748..3c13ea320 100644 --- a/db/migrate/20170630105250_add_public_interests_to_user.rb +++ b/db/migrate/20170630105250_add_public_interests_to_user.rb @@ -1,4 +1,4 @@ -class AddPublicInterestsToUser < ActiveRecord::Migration +class AddPublicInterestsToUser < ActiveRecord::Migration[4.2] def change add_column :users, :public_interests, :boolean, default: false end diff --git a/db/migrate/20170702105956_add_locale_to_site_customization_pages.rb b/db/migrate/20170702105956_add_locale_to_site_customization_pages.rb index 2675d9fa7..dea4a9549 100644 --- a/db/migrate/20170702105956_add_locale_to_site_customization_pages.rb +++ b/db/migrate/20170702105956_add_locale_to_site_customization_pages.rb @@ -1,4 +1,4 @@ -class AddLocaleToSiteCustomizationPages < ActiveRecord::Migration +class AddLocaleToSiteCustomizationPages < ActiveRecord::Migration[4.2] def change add_column :site_customization_pages, :locale, :string end diff --git a/db/migrate/20170703120055_add_incompatible_to_budget_investments.rb b/db/migrate/20170703120055_add_incompatible_to_budget_investments.rb index 2fffc0802..64fc1dc56 100644 --- a/db/migrate/20170703120055_add_incompatible_to_budget_investments.rb +++ b/db/migrate/20170703120055_add_incompatible_to_budget_investments.rb @@ -1,4 +1,4 @@ -class AddIncompatibleToBudgetInvestments < ActiveRecord::Migration +class AddIncompatibleToBudgetInvestments < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :incompatible, :bool, default: false, index: true end diff --git a/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb b/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb index 85c94e66f..1df0ee7c8 100644 --- a/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb +++ b/db/migrate/20170704105112_add_slugs_to_budget_heading_group.rb @@ -1,4 +1,4 @@ -class AddSlugsToBudgetHeadingGroup < ActiveRecord::Migration +class AddSlugsToBudgetHeadingGroup < ActiveRecord::Migration[4.2] def change add_column :budgets, :slug, :string add_column :budget_groups, :slug, :string diff --git a/db/migrate/20170708174932_create_local_census_records.rb b/db/migrate/20170708174932_create_local_census_records.rb index 640594ded..9603194e4 100644 --- a/db/migrate/20170708174932_create_local_census_records.rb +++ b/db/migrate/20170708174932_create_local_census_records.rb @@ -1,4 +1,4 @@ -class CreateLocalCensusRecords < ActiveRecord::Migration +class CreateLocalCensusRecords < ActiveRecord::Migration[4.2] def change create_table :local_census_records do |t| t.string :document_number, null: false diff --git a/db/migrate/20170708225159_remove_tolk.rb b/db/migrate/20170708225159_remove_tolk.rb index d07c88ebb..8f9e08820 100644 --- a/db/migrate/20170708225159_remove_tolk.rb +++ b/db/migrate/20170708225159_remove_tolk.rb @@ -1,4 +1,4 @@ -class RemoveTolk < ActiveRecord::Migration +class RemoveTolk < ActiveRecord::Migration[4.2] def change remove_index :tolk_translations, column: [:phrase_id, :locale_id] remove_index :tolk_locales, column: :name diff --git a/db/migrate/20170713110317_remove_local_census_record_user_id.rb b/db/migrate/20170713110317_remove_local_census_record_user_id.rb index 9285d849e..7833a806f 100644 --- a/db/migrate/20170713110317_remove_local_census_record_user_id.rb +++ b/db/migrate/20170713110317_remove_local_census_record_user_id.rb @@ -1,4 +1,4 @@ -class RemoveLocalCensusRecordUserId < ActiveRecord::Migration +class RemoveLocalCensusRecordUserId < ActiveRecord::Migration[4.2] def change remove_column :local_census_records, :user_id end diff --git a/db/migrate/20170719174326_remove_poll_recount.rb b/db/migrate/20170719174326_remove_poll_recount.rb index 67720ff91..2378f16c3 100644 --- a/db/migrate/20170719174326_remove_poll_recount.rb +++ b/db/migrate/20170719174326_remove_poll_recount.rb @@ -1,4 +1,4 @@ -class RemovePollRecount < ActiveRecord::Migration +class RemovePollRecount < ActiveRecord::Migration[4.2] def change remove_index :poll_recounts, column: [:booth_assignment_id] remove_index :poll_recounts, column: [:officer_assignment_id] diff --git a/db/migrate/20170720092638_create_documents.rb b/db/migrate/20170720092638_create_documents.rb index b7d1e287c..429487def 100644 --- a/db/migrate/20170720092638_create_documents.rb +++ b/db/migrate/20170720092638_create_documents.rb @@ -1,4 +1,4 @@ -class CreateDocuments < ActiveRecord::Migration +class CreateDocuments < ActiveRecord::Migration[4.2] def change create_table :documents do |t| t.string :title diff --git a/db/migrate/20170724190805_create_poll_shifts.rb b/db/migrate/20170724190805_create_poll_shifts.rb index 8bb6eafd7..3b5f36cf1 100644 --- a/db/migrate/20170724190805_create_poll_shifts.rb +++ b/db/migrate/20170724190805_create_poll_shifts.rb @@ -1,4 +1,4 @@ -class CreatePollShifts < ActiveRecord::Migration +class CreatePollShifts < ActiveRecord::Migration[4.2] def change create_table :poll_shifts do |t| t.integer :booth_id diff --git a/db/migrate/20170804170049_create_community.rb b/db/migrate/20170804170049_create_community.rb index 938b75efb..ba1268db4 100644 --- a/db/migrate/20170804170049_create_community.rb +++ b/db/migrate/20170804170049_create_community.rb @@ -1,4 +1,4 @@ -class CreateCommunity < ActiveRecord::Migration +class CreateCommunity < ActiveRecord::Migration[4.2] def change create_table :communities do |t| t.timestamps null: false diff --git a/db/migrate/20170804171325_add_community_to_proposal.rb b/db/migrate/20170804171325_add_community_to_proposal.rb index e18cd53c9..9b36c331b 100644 --- a/db/migrate/20170804171325_add_community_to_proposal.rb +++ b/db/migrate/20170804171325_add_community_to_proposal.rb @@ -1,4 +1,4 @@ -class AddCommunityToProposal < ActiveRecord::Migration +class AddCommunityToProposal < ActiveRecord::Migration[4.2] def change add_reference :proposals, :community, index: true, foreign_key: true end diff --git a/db/migrate/20170805132736_create_map_locations.rb b/db/migrate/20170805132736_create_map_locations.rb index a75820d54..ed6c8d1bf 100644 --- a/db/migrate/20170805132736_create_map_locations.rb +++ b/db/migrate/20170805132736_create_map_locations.rb @@ -1,4 +1,4 @@ -class CreateMapLocations < ActiveRecord::Migration +class CreateMapLocations < ActiveRecord::Migration[4.2] def change create_table :map_locations do |t| t.float :latitude diff --git a/db/migrate/20170807082243_create_topics.rb b/db/migrate/20170807082243_create_topics.rb index 073a65efc..89aeb2789 100644 --- a/db/migrate/20170807082243_create_topics.rb +++ b/db/migrate/20170807082243_create_topics.rb @@ -1,4 +1,4 @@ -class CreateTopics < ActiveRecord::Migration +class CreateTopics < ActiveRecord::Migration[4.2] def change create_table :topics do |t| t.string :title, null: false diff --git a/db/migrate/20170822144743_add_community_to_budget_investments.rb b/db/migrate/20170822144743_add_community_to_budget_investments.rb index 08fefbb63..e345b7c81 100644 --- a/db/migrate/20170822144743_add_community_to_budget_investments.rb +++ b/db/migrate/20170822144743_add_community_to_budget_investments.rb @@ -1,4 +1,4 @@ -class AddCommunityToBudgetInvestments < ActiveRecord::Migration +class AddCommunityToBudgetInvestments < ActiveRecord::Migration[4.2] def change add_reference :budget_investments, :community, index: true, foreign_key: true end diff --git a/db/migrate/20170905111444_add_video_url_to_poll_questions.rb b/db/migrate/20170905111444_add_video_url_to_poll_questions.rb index 800ca915e..1ac94efa2 100644 --- a/db/migrate/20170905111444_add_video_url_to_poll_questions.rb +++ b/db/migrate/20170905111444_add_video_url_to_poll_questions.rb @@ -1,4 +1,4 @@ -class AddVideoUrlToPollQuestions < ActiveRecord::Migration +class AddVideoUrlToPollQuestions < ActiveRecord::Migration[4.2] def change add_column :poll_questions, :video_url, :string end diff --git a/db/migrate/20170908175149_add_officer_data_to_poll_shifts.rb b/db/migrate/20170908175149_add_officer_data_to_poll_shifts.rb index 0982345b4..c28e8dd87 100644 --- a/db/migrate/20170908175149_add_officer_data_to_poll_shifts.rb +++ b/db/migrate/20170908175149_add_officer_data_to_poll_shifts.rb @@ -1,4 +1,4 @@ -class AddOfficerDataToPollShifts < ActiveRecord::Migration +class AddOfficerDataToPollShifts < ActiveRecord::Migration[4.2] def change add_column :poll_shifts, :officer_name, :string add_column :poll_shifts, :officer_email, :string diff --git a/db/migrate/20170911110109_add_user_id_to_images.rb b/db/migrate/20170911110109_add_user_id_to_images.rb index 31467acee..9944da6c5 100644 --- a/db/migrate/20170911110109_add_user_id_to_images.rb +++ b/db/migrate/20170911110109_add_user_id_to_images.rb @@ -1,4 +1,4 @@ -class AddUserIdToImages < ActiveRecord::Migration +class AddUserIdToImages < ActiveRecord::Migration[4.2] def change add_reference :images, :user, index: true, foreign_key: true end diff --git a/db/migrate/20170913101029_add_proposals_phase_to_legislation_processes.rb b/db/migrate/20170913101029_add_proposals_phase_to_legislation_processes.rb index b3ecfe3f1..5c3d385c7 100644 --- a/db/migrate/20170913101029_add_proposals_phase_to_legislation_processes.rb +++ b/db/migrate/20170913101029_add_proposals_phase_to_legislation_processes.rb @@ -1,4 +1,4 @@ -class AddProposalsPhaseToLegislationProcesses < ActiveRecord::Migration +class AddProposalsPhaseToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :proposals_phase_start_date, :date add_column :legislation_processes, :proposals_phase_end_date, :date diff --git a/db/migrate/20170913130803_add_proposals_description_to_legislation_processes.rb b/db/migrate/20170913130803_add_proposals_description_to_legislation_processes.rb index d5e4f9c5d..1c5549883 100644 --- a/db/migrate/20170913130803_add_proposals_description_to_legislation_processes.rb +++ b/db/migrate/20170913130803_add_proposals_description_to_legislation_processes.rb @@ -1,4 +1,4 @@ -class AddProposalsDescriptionToLegislationProcesses < ActiveRecord::Migration +class AddProposalsDescriptionToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :proposals_description, :text end diff --git a/db/migrate/20170914102634_create_legislation_proposals.rb b/db/migrate/20170914102634_create_legislation_proposals.rb index defe9f1dd..9a02c6971 100644 --- a/db/migrate/20170914102634_create_legislation_proposals.rb +++ b/db/migrate/20170914102634_create_legislation_proposals.rb @@ -1,4 +1,4 @@ -class CreateLegislationProposals < ActiveRecord::Migration +class CreateLegislationProposals < ActiveRecord::Migration[4.2] def change create_table :legislation_proposals do |t| t.references :legislation_process, index: true, foreign_key: true diff --git a/db/migrate/20170914114427_create_poll_total_results.rb b/db/migrate/20170914114427_create_poll_total_results.rb index 1a733dce4..2b412fd7f 100644 --- a/db/migrate/20170914114427_create_poll_total_results.rb +++ b/db/migrate/20170914114427_create_poll_total_results.rb @@ -1,4 +1,4 @@ -class CreatePollTotalResults < ActiveRecord::Migration +class CreatePollTotalResults < ActiveRecord::Migration[4.2] def change create_table :poll_total_results do |t| t.integer :author_id diff --git a/db/migrate/20170914154743_fix_password_changed_at_default.rb b/db/migrate/20170914154743_fix_password_changed_at_default.rb index dd3eb9aea..4c1fc0107 100644 --- a/db/migrate/20170914154743_fix_password_changed_at_default.rb +++ b/db/migrate/20170914154743_fix_password_changed_at_default.rb @@ -1,4 +1,4 @@ -class FixPasswordChangedAtDefault < ActiveRecord::Migration +class FixPasswordChangedAtDefault < ActiveRecord::Migration[4.2] def up change_column_default :users, :password_changed_at, Time.new(2015, 1, 1, 1, 1, 1) end diff --git a/db/migrate/20170915101519_add_legislation_proposals_count_to_tags.rb b/db/migrate/20170915101519_add_legislation_proposals_count_to_tags.rb index 9ce6ace89..750a96841 100644 --- a/db/migrate/20170915101519_add_legislation_proposals_count_to_tags.rb +++ b/db/migrate/20170915101519_add_legislation_proposals_count_to_tags.rb @@ -1,6 +1,6 @@ -class AddLegislationProposalsCountToTags < ActiveRecord::Migration +class AddLegislationProposalsCountToTags < ActiveRecord::Migration[4.2] def change add_column :tags, "legislation/proposals_count", :integer, default: 0 - add_index :tags, "legislation/proposals_count" + add_index :tags, :"legislation/proposals_count" end end diff --git a/db/migrate/20170918231410_remove_poll_final_recounts.rb b/db/migrate/20170918231410_remove_poll_final_recounts.rb index 369a959bb..31fc72e90 100644 --- a/db/migrate/20170918231410_remove_poll_final_recounts.rb +++ b/db/migrate/20170918231410_remove_poll_final_recounts.rb @@ -1,4 +1,4 @@ -class RemovePollFinalRecounts < ActiveRecord::Migration +class RemovePollFinalRecounts < ActiveRecord::Migration[4.2] def change remove_index :poll_final_recounts, column: :booth_assignment_id remove_index :poll_final_recounts, column: :officer_assignment_id diff --git a/db/migrate/20170922101247_add_legislation_processes_count_to_tags.rb b/db/migrate/20170922101247_add_legislation_processes_count_to_tags.rb index 698a66af6..8ce1b2a96 100644 --- a/db/migrate/20170922101247_add_legislation_processes_count_to_tags.rb +++ b/db/migrate/20170922101247_add_legislation_processes_count_to_tags.rb @@ -1,6 +1,6 @@ -class AddLegislationProcessesCountToTags < ActiveRecord::Migration +class AddLegislationProcessesCountToTags < ActiveRecord::Migration[4.2] def change add_column :tags, "legislation/processes_count", :integer, default: 0 - add_index :tags, "legislation/processes_count" + add_index :tags, :"legislation/processes_count" end end diff --git a/db/migrate/20170927110953_add_shift_task.rb b/db/migrate/20170927110953_add_shift_task.rb index 8adf23dd1..e55a980cf 100644 --- a/db/migrate/20170927110953_add_shift_task.rb +++ b/db/migrate/20170927110953_add_shift_task.rb @@ -1,4 +1,4 @@ -class AddShiftTask < ActiveRecord::Migration +class AddShiftTask < ActiveRecord::Migration[4.2] def change add_column :poll_shifts, :task, :integer, null: false, default: 0 end diff --git a/db/migrate/20170928132402_add_summary_and_description_to_polls.rb b/db/migrate/20170928132402_add_summary_and_description_to_polls.rb index 6fb965346..0160e32f9 100644 --- a/db/migrate/20170928132402_add_summary_and_description_to_polls.rb +++ b/db/migrate/20170928132402_add_summary_and_description_to_polls.rb @@ -1,4 +1,4 @@ -class AddSummaryAndDescriptionToPolls < ActiveRecord::Migration +class AddSummaryAndDescriptionToPolls < ActiveRecord::Migration[4.2] def change add_column :polls, :summary, :text add_column :polls, :description, :text diff --git a/db/migrate/20171002103314_add_poll_shift_task_index.rb b/db/migrate/20171002103314_add_poll_shift_task_index.rb index d15275556..3e28def56 100644 --- a/db/migrate/20171002103314_add_poll_shift_task_index.rb +++ b/db/migrate/20171002103314_add_poll_shift_task_index.rb @@ -1,4 +1,4 @@ -class AddPollShiftTaskIndex < ActiveRecord::Migration +class AddPollShiftTaskIndex < ActiveRecord::Migration[4.2] def change remove_index "poll_shifts", name: "index_poll_shifts_on_booth_id_and_officer_id" add_index :poll_shifts, :task diff --git a/db/migrate/20171002121658_add_origin_to_poll_voters.rb b/db/migrate/20171002121658_add_origin_to_poll_voters.rb index 845c1b774..4bf0f38c2 100644 --- a/db/migrate/20171002121658_add_origin_to_poll_voters.rb +++ b/db/migrate/20171002121658_add_origin_to_poll_voters.rb @@ -1,4 +1,4 @@ -class AddOriginToPollVoters < ActiveRecord::Migration +class AddOriginToPollVoters < ActiveRecord::Migration[4.2] def change add_column :poll_voters, :origin, :string end diff --git a/db/migrate/20171002122312_create_poll_recount.rb b/db/migrate/20171002122312_create_poll_recount.rb index 807f1c84e..c104b483f 100644 --- a/db/migrate/20171002122312_create_poll_recount.rb +++ b/db/migrate/20171002122312_create_poll_recount.rb @@ -1,4 +1,4 @@ -class CreatePollRecount < ActiveRecord::Migration +class CreatePollRecount < ActiveRecord::Migration[4.2] def change create_table :poll_recounts do |t| t.integer :author_id diff --git a/db/migrate/20171002133547_remove_poll_white_null_total_results.rb b/db/migrate/20171002133547_remove_poll_white_null_total_results.rb index 5fff82ef3..9d3aa7b14 100644 --- a/db/migrate/20171002133547_remove_poll_white_null_total_results.rb +++ b/db/migrate/20171002133547_remove_poll_white_null_total_results.rb @@ -1,4 +1,4 @@ -class RemovePollWhiteNullTotalResults < ActiveRecord::Migration +class RemovePollWhiteNullTotalResults < ActiveRecord::Migration[4.2] def change remove_index :poll_null_results, column: [:booth_assignment_id] remove_index :poll_null_results, column: [:officer_assignment_id] diff --git a/db/migrate/20171002191347_add_default_to_recount_amounts.rb b/db/migrate/20171002191347_add_default_to_recount_amounts.rb index b90e86aae..32f0ef6b7 100644 --- a/db/migrate/20171002191347_add_default_to_recount_amounts.rb +++ b/db/migrate/20171002191347_add_default_to_recount_amounts.rb @@ -1,4 +1,4 @@ -class AddDefaultToRecountAmounts < ActiveRecord::Migration +class AddDefaultToRecountAmounts < ActiveRecord::Migration[4.2] def change change_column_default :poll_recounts, :white_amount, 0 change_column_default :poll_recounts, :null_amount, 0 diff --git a/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb b/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb index 874672f84..62e4d12cf 100644 --- a/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb +++ b/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb @@ -1,4 +1,4 @@ -class RemoveOfficerAssigmentComposedIndex < ActiveRecord::Migration +class RemoveOfficerAssigmentComposedIndex < ActiveRecord::Migration[4.2] def change remove_index "poll_officer_assignments", name: "index_poll_officer_assignments_on_officer_id_and_date" end diff --git a/db/migrate/20171003143034_add_comments_count_to_polls.rb b/db/migrate/20171003143034_add_comments_count_to_polls.rb index 675acae3f..cd372db2b 100644 --- a/db/migrate/20171003143034_add_comments_count_to_polls.rb +++ b/db/migrate/20171003143034_add_comments_count_to_polls.rb @@ -1,4 +1,4 @@ -class AddCommentsCountToPolls < ActiveRecord::Migration +class AddCommentsCountToPolls < ActiveRecord::Migration[4.2] def change add_column :polls, :comments_count, :integer, default: 0 add_column :polls, :author_id, :integer diff --git a/db/migrate/20171003170029_remove_description_from_poll_questions.rb b/db/migrate/20171003170029_remove_description_from_poll_questions.rb index 31e1b9578..36f3483aa 100644 --- a/db/migrate/20171003170029_remove_description_from_poll_questions.rb +++ b/db/migrate/20171003170029_remove_description_from_poll_questions.rb @@ -1,4 +1,4 @@ -class RemoveDescriptionFromPollQuestions < ActiveRecord::Migration +class RemoveDescriptionFromPollQuestions < ActiveRecord::Migration[4.2] def change remove_column :poll_questions, :description end diff --git a/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb b/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb index b59a859c1..28c7e51ac 100644 --- a/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb +++ b/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb @@ -1,4 +1,4 @@ -class AddDateToPollShiftComposedIndex < ActiveRecord::Migration +class AddDateToPollShiftComposedIndex < ActiveRecord::Migration[4.2] def change remove_index "poll_shifts", name: "index_poll_shifts_on_booth_id_and_officer_id_and_task" remove_index "poll_shifts", name: "index_poll_shifts_on_task" diff --git a/db/migrate/20171003223152_add_officer_to_poll_voter.rb b/db/migrate/20171003223152_add_officer_to_poll_voter.rb index 99f9cd3e3..b2adeb6c5 100644 --- a/db/migrate/20171003223152_add_officer_to_poll_voter.rb +++ b/db/migrate/20171003223152_add_officer_to_poll_voter.rb @@ -1,4 +1,4 @@ -class AddOfficerToPollVoter < ActiveRecord::Migration +class AddOfficerToPollVoter < ActiveRecord::Migration[4.2] def change add_column :poll_voters, :officer_id, :integer end diff --git a/db/migrate/20171004025903_create_poll_question_answers.rb b/db/migrate/20171004025903_create_poll_question_answers.rb index 834421f5f..488890599 100644 --- a/db/migrate/20171004025903_create_poll_question_answers.rb +++ b/db/migrate/20171004025903_create_poll_question_answers.rb @@ -1,4 +1,4 @@ -class CreatePollQuestionAnswers < ActiveRecord::Migration +class CreatePollQuestionAnswers < ActiveRecord::Migration[4.2] def change create_table :poll_question_answers do |t| t.string :title diff --git a/db/migrate/20171004151553_rename_poll_question_id_to_question_id.rb b/db/migrate/20171004151553_rename_poll_question_id_to_question_id.rb index c53298bfb..abbdb8a6b 100644 --- a/db/migrate/20171004151553_rename_poll_question_id_to_question_id.rb +++ b/db/migrate/20171004151553_rename_poll_question_id_to_question_id.rb @@ -1,4 +1,4 @@ -class RenamePollQuestionIdToQuestionId < ActiveRecord::Migration +class RenamePollQuestionIdToQuestionId < ActiveRecord::Migration[4.2] def change rename_column :poll_question_answers, :poll_question_id, :question_id end diff --git a/db/migrate/20171004210108_create_poll_question_answer_videos.rb b/db/migrate/20171004210108_create_poll_question_answer_videos.rb index 7cce33b29..d22b10adf 100644 --- a/db/migrate/20171004210108_create_poll_question_answer_videos.rb +++ b/db/migrate/20171004210108_create_poll_question_answer_videos.rb @@ -1,4 +1,4 @@ -class CreatePollQuestionAnswerVideos < ActiveRecord::Migration +class CreatePollQuestionAnswerVideos < ActiveRecord::Migration[4.2] def change create_table :poll_question_answer_videos do |t| t.string :title diff --git a/db/migrate/20171006145053_add_token_to_poll_voters.rb b/db/migrate/20171006145053_add_token_to_poll_voters.rb index 5d07f5065..c0fcc347e 100644 --- a/db/migrate/20171006145053_add_token_to_poll_voters.rb +++ b/db/migrate/20171006145053_add_token_to_poll_voters.rb @@ -1,4 +1,4 @@ -class AddTokenToPollVoters < ActiveRecord::Migration +class AddTokenToPollVoters < ActiveRecord::Migration[4.2] def change add_column :poll_voters, :token, :string end diff --git a/db/migrate/20171010143623_add_given_order_to_poll_question_answers.rb b/db/migrate/20171010143623_add_given_order_to_poll_question_answers.rb index 6161e55e4..0fc73939b 100644 --- a/db/migrate/20171010143623_add_given_order_to_poll_question_answers.rb +++ b/db/migrate/20171010143623_add_given_order_to_poll_question_answers.rb @@ -1,4 +1,4 @@ -class AddGivenOrderToPollQuestionAnswers < ActiveRecord::Migration +class AddGivenOrderToPollQuestionAnswers < ActiveRecord::Migration[4.2] def change add_column :poll_question_answers, :given_order, :integer, default: 1 end diff --git a/db/migrate/20171017221546_remove_poll_question_valid_answers.rb b/db/migrate/20171017221546_remove_poll_question_valid_answers.rb index e4c1ebb11..5a803fff6 100644 --- a/db/migrate/20171017221546_remove_poll_question_valid_answers.rb +++ b/db/migrate/20171017221546_remove_poll_question_valid_answers.rb @@ -1,4 +1,4 @@ -class RemovePollQuestionValidAnswers < ActiveRecord::Migration +class RemovePollQuestionValidAnswers < ActiveRecord::Migration[4.2] def change remove_column :poll_questions, :valid_answers end diff --git a/db/migrate/20171019095042_add_most_voted_to_poll_question_answer.rb b/db/migrate/20171019095042_add_most_voted_to_poll_question_answer.rb index e4650643b..d6f869f10 100644 --- a/db/migrate/20171019095042_add_most_voted_to_poll_question_answer.rb +++ b/db/migrate/20171019095042_add_most_voted_to_poll_question_answer.rb @@ -1,4 +1,4 @@ -class AddMostVotedToPollQuestionAnswer < ActiveRecord::Migration +class AddMostVotedToPollQuestionAnswer < ActiveRecord::Migration[4.2] def change add_column :poll_question_answers, :most_voted, :boolean, default: false end diff --git a/db/migrate/20171020163240_add_results_and_stats_to_polls.rb b/db/migrate/20171020163240_add_results_and_stats_to_polls.rb index af6f82aaa..2d5b0332b 100644 --- a/db/migrate/20171020163240_add_results_and_stats_to_polls.rb +++ b/db/migrate/20171020163240_add_results_and_stats_to_polls.rb @@ -1,4 +1,4 @@ -class AddResultsAndStatsToPolls < ActiveRecord::Migration +class AddResultsAndStatsToPolls < ActiveRecord::Migration[4.2] def change add_column :polls, :results_enabled, :boolean, default: false add_column :polls, :stats_enabled, :boolean, default: false diff --git a/db/migrate/20171025142440_add_cached_votes_to_legislation_proposals.rb b/db/migrate/20171025142440_add_cached_votes_to_legislation_proposals.rb index 92544ddb6..98500beb5 100644 --- a/db/migrate/20171025142440_add_cached_votes_to_legislation_proposals.rb +++ b/db/migrate/20171025142440_add_cached_votes_to_legislation_proposals.rb @@ -1,4 +1,4 @@ -class AddCachedVotesToLegislationProposals < ActiveRecord::Migration +class AddCachedVotesToLegislationProposals < ActiveRecord::Migration[4.2] def change add_column :legislation_proposals, :cached_votes_total, :integer, default: 0 add_column :legislation_proposals, :cached_votes_down, :integer, default: 0 diff --git a/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb b/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb index 13bc51264..895a93ecf 100644 --- a/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb +++ b/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb @@ -1,4 +1,4 @@ -class AddTimeZoneToDefaultDatetimes < ActiveRecord::Migration +class AddTimeZoneToDefaultDatetimes < ActiveRecord::Migration[4.2] def change change_column_default :users, :password_changed_at, DateTime.new(2015, 1, 1, 1, 1, 1, '+00:00') change_column_default :locks, :locked_until, DateTime.new(2000, 1, 1, 1, 1, 1, '+00:00') diff --git a/db/migrate/20171127171925_create_related_content.rb b/db/migrate/20171127171925_create_related_content.rb index 2944938e2..e65dd2e96 100644 --- a/db/migrate/20171127171925_create_related_content.rb +++ b/db/migrate/20171127171925_create_related_content.rb @@ -1,4 +1,4 @@ -class CreateRelatedContent < ActiveRecord::Migration +class CreateRelatedContent < ActiveRecord::Migration[4.2] def change create_table :related_contents do |t| t.references :parent_relationable, polymorphic: true, index: { name: 'index_related_contents_on_parent_relationable' } diff --git a/db/migrate/20171127230716_add_time_reported_to_related_content.rb b/db/migrate/20171127230716_add_time_reported_to_related_content.rb index 5cca12cf3..d9804942d 100644 --- a/db/migrate/20171127230716_add_time_reported_to_related_content.rb +++ b/db/migrate/20171127230716_add_time_reported_to_related_content.rb @@ -1,4 +1,4 @@ -class AddTimeReportedToRelatedContent < ActiveRecord::Migration +class AddTimeReportedToRelatedContent < ActiveRecord::Migration[4.2] def change add_column :related_contents, :times_reported, :integer, default: 0 end diff --git a/db/migrate/20171212154048_add_publication_date_to_milestones.rb b/db/migrate/20171212154048_add_publication_date_to_milestones.rb index e5e37bb24..2c646c1fd 100644 --- a/db/migrate/20171212154048_add_publication_date_to_milestones.rb +++ b/db/migrate/20171212154048_add_publication_date_to_milestones.rb @@ -1,4 +1,4 @@ -class AddPublicationDateToMilestones < ActiveRecord::Migration +class AddPublicationDateToMilestones < ActiveRecord::Migration[4.2] def up change_table :budget_investment_milestones do |t| t.datetime :publication_date diff --git a/db/migrate/20171212193323_add_timestamps_to_polls.rb b/db/migrate/20171212193323_add_timestamps_to_polls.rb index 9c955b278..b8cece246 100644 --- a/db/migrate/20171212193323_add_timestamps_to_polls.rb +++ b/db/migrate/20171212193323_add_timestamps_to_polls.rb @@ -1,4 +1,4 @@ -class AddTimestampsToPolls < ActiveRecord::Migration +class AddTimestampsToPolls < ActiveRecord::Migration[4.2] def change add_timestamps :polls, null: true end diff --git a/db/migrate/20171215152244_change_related_content_times_reported_column.rb b/db/migrate/20171215152244_change_related_content_times_reported_column.rb index 7da58bba5..8a202d6b9 100644 --- a/db/migrate/20171215152244_change_related_content_times_reported_column.rb +++ b/db/migrate/20171215152244_change_related_content_times_reported_column.rb @@ -1,4 +1,4 @@ -class ChangeRelatedContentTimesReportedColumn < ActiveRecord::Migration +class ChangeRelatedContentTimesReportedColumn < ActiveRecord::Migration[4.2] def change rename_column :related_contents, :times_reported, :flags_count end diff --git a/db/migrate/20171219111046_remove_related_contents_flags_count.rb b/db/migrate/20171219111046_remove_related_contents_flags_count.rb index b0f5aead5..a7eb00fc4 100644 --- a/db/migrate/20171219111046_remove_related_contents_flags_count.rb +++ b/db/migrate/20171219111046_remove_related_contents_flags_count.rb @@ -1,4 +1,4 @@ -class RemoveRelatedContentsFlagsCount < ActiveRecord::Migration +class RemoveRelatedContentsFlagsCount < ActiveRecord::Migration[4.2] def change remove_column :related_contents, :flags_count end diff --git a/db/migrate/20171219184209_create_related_content_scores.rb b/db/migrate/20171219184209_create_related_content_scores.rb index 7a54ba56d..c5136cbfc 100644 --- a/db/migrate/20171219184209_create_related_content_scores.rb +++ b/db/migrate/20171219184209_create_related_content_scores.rb @@ -1,4 +1,4 @@ -class CreateRelatedContentScores < ActiveRecord::Migration +class CreateRelatedContentScores < ActiveRecord::Migration[4.2] def change create_table :related_content_scores do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20171219235102_add_hidden_at_to_related_contents.rb b/db/migrate/20171219235102_add_hidden_at_to_related_contents.rb index 423eeb1f1..a157b6e7a 100644 --- a/db/migrate/20171219235102_add_hidden_at_to_related_contents.rb +++ b/db/migrate/20171219235102_add_hidden_at_to_related_contents.rb @@ -1,4 +1,4 @@ -class AddHiddenAtToRelatedContents < ActiveRecord::Migration +class AddHiddenAtToRelatedContents < ActiveRecord::Migration[4.2] def change add_column :related_contents, :hidden_at, :datetime add_index :related_contents, :hidden_at diff --git a/db/migrate/20171220002802_add_related_content_scores_counter_to_related_content.rb b/db/migrate/20171220002802_add_related_content_scores_counter_to_related_content.rb index 497d4f7a1..5193e962a 100644 --- a/db/migrate/20171220002802_add_related_content_scores_counter_to_related_content.rb +++ b/db/migrate/20171220002802_add_related_content_scores_counter_to_related_content.rb @@ -1,4 +1,4 @@ -class AddRelatedContentScoresCounterToRelatedContent < ActiveRecord::Migration +class AddRelatedContentScoresCounterToRelatedContent < ActiveRecord::Migration[4.2] def change add_column :related_contents, :related_content_scores_count, :integer, default: 0 end diff --git a/db/migrate/20171220010000_add_author_to_related_content.rb b/db/migrate/20171220010000_add_author_to_related_content.rb index 4ca621845..3f63a96da 100644 --- a/db/migrate/20171220010000_add_author_to_related_content.rb +++ b/db/migrate/20171220010000_add_author_to_related_content.rb @@ -1,4 +1,4 @@ -class AddAuthorToRelatedContent < ActiveRecord::Migration +class AddAuthorToRelatedContent < ActiveRecord::Migration[4.2] def change add_column :related_contents, :author_id, :integer end diff --git a/db/migrate/20180108182839_add_drafting_phase_to_budget.rb b/db/migrate/20180108182839_add_drafting_phase_to_budget.rb index 9a8febb97..c0a18d449 100644 --- a/db/migrate/20180108182839_add_drafting_phase_to_budget.rb +++ b/db/migrate/20180108182839_add_drafting_phase_to_budget.rb @@ -1,4 +1,4 @@ -class AddDraftingPhaseToBudget < ActiveRecord::Migration +class AddDraftingPhaseToBudget < ActiveRecord::Migration[4.2] def change add_column :budgets, :description_drafting, :text end diff --git a/db/migrate/20180109081115_add_settings_to_banners.rb b/db/migrate/20180109081115_add_settings_to_banners.rb index 5092501cc..9a6ac6e0f 100644 --- a/db/migrate/20180109081115_add_settings_to_banners.rb +++ b/db/migrate/20180109081115_add_settings_to_banners.rb @@ -1,4 +1,4 @@ -class AddSettingsToBanners < ActiveRecord::Migration +class AddSettingsToBanners < ActiveRecord::Migration[4.2] def change add_column :banners, :background_color, :text add_column :banners, :font_color, :text diff --git a/db/migrate/20180109101656_create_banner_sections.rb b/db/migrate/20180109101656_create_banner_sections.rb index 3182858d8..5b9571096 100644 --- a/db/migrate/20180109101656_create_banner_sections.rb +++ b/db/migrate/20180109101656_create_banner_sections.rb @@ -1,4 +1,4 @@ -class CreateBannerSections < ActiveRecord::Migration +class CreateBannerSections < ActiveRecord::Migration[4.2] def change create_table :banner_sections do |t| t.integer :banner_id diff --git a/db/migrate/20180109175851_add_publishing_prices_phase_to_budget.rb b/db/migrate/20180109175851_add_publishing_prices_phase_to_budget.rb index e6181f6e1..b8141eac6 100644 --- a/db/migrate/20180109175851_add_publishing_prices_phase_to_budget.rb +++ b/db/migrate/20180109175851_add_publishing_prices_phase_to_budget.rb @@ -1,4 +1,4 @@ -class AddPublishingPricesPhaseToBudget < ActiveRecord::Migration +class AddPublishingPricesPhaseToBudget < ActiveRecord::Migration[4.2] def change add_column :budgets, :description_publishing_prices, :text end diff --git a/db/migrate/20180112123641_create_budget_phases.rb b/db/migrate/20180112123641_create_budget_phases.rb index fbac158f0..259b01f2c 100644 --- a/db/migrate/20180112123641_create_budget_phases.rb +++ b/db/migrate/20180112123641_create_budget_phases.rb @@ -1,4 +1,4 @@ -class CreateBudgetPhases < ActiveRecord::Migration +class CreateBudgetPhases < ActiveRecord::Migration[4.2] def change create_table :budget_phases do |t| t.references :budget diff --git a/db/migrate/20180115075542_create_web_sections.rb b/db/migrate/20180115075542_create_web_sections.rb index 483bc7bb7..cafbb433e 100644 --- a/db/migrate/20180115075542_create_web_sections.rb +++ b/db/migrate/20180115075542_create_web_sections.rb @@ -1,4 +1,4 @@ -class CreateWebSections < ActiveRecord::Migration +class CreateWebSections < ActiveRecord::Migration[4.2] def change create_table :web_sections do |t| t.text :name diff --git a/db/migrate/20180116151008_add_visible_to_valuators_to_budget_investment.rb b/db/migrate/20180116151008_add_visible_to_valuators_to_budget_investment.rb index 8a04a14a5..db011179d 100644 --- a/db/migrate/20180116151008_add_visible_to_valuators_to_budget_investment.rb +++ b/db/migrate/20180116151008_add_visible_to_valuators_to_budget_investment.rb @@ -1,4 +1,4 @@ -class AddVisibleToValuatorsToBudgetInvestment < ActiveRecord::Migration +class AddVisibleToValuatorsToBudgetInvestment < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :visible_to_valuators, :boolean, default: false end diff --git a/db/migrate/20180119073228_add_description_informing_to_budgets.rb b/db/migrate/20180119073228_add_description_informing_to_budgets.rb index a6eb173e9..d06fbf500 100644 --- a/db/migrate/20180119073228_add_description_informing_to_budgets.rb +++ b/db/migrate/20180119073228_add_description_informing_to_budgets.rb @@ -1,4 +1,4 @@ -class AddDescriptionInformingToBudgets < ActiveRecord::Migration +class AddDescriptionInformingToBudgets < ActiveRecord::Migration[4.2] def change add_column :budgets, :description_informing, :text end diff --git a/db/migrate/20180124143013_remove_image_and_style_from_banners.rb b/db/migrate/20180124143013_remove_image_and_style_from_banners.rb index 6ce833437..dbf72c489 100644 --- a/db/migrate/20180124143013_remove_image_and_style_from_banners.rb +++ b/db/migrate/20180124143013_remove_image_and_style_from_banners.rb @@ -1,4 +1,4 @@ -class RemoveImageAndStyleFromBanners < ActiveRecord::Migration +class RemoveImageAndStyleFromBanners < ActiveRecord::Migration[4.2] def change remove_column :banners, :image remove_column :banners, :style diff --git a/db/migrate/20180129190931_add_valuation_flag_to_comments.rb b/db/migrate/20180129190931_add_valuation_flag_to_comments.rb index cf31a92e7..f2eea0f91 100644 --- a/db/migrate/20180129190931_add_valuation_flag_to_comments.rb +++ b/db/migrate/20180129190931_add_valuation_flag_to_comments.rb @@ -1,4 +1,4 @@ -class AddValuationFlagToComments < ActiveRecord::Migration +class AddValuationFlagToComments < ActiveRecord::Migration[4.2] def change add_column :comments, :valuation, :boolean, default: false end diff --git a/db/migrate/20180129190950_add_index_to_valuation_comments.rb b/db/migrate/20180129190950_add_index_to_valuation_comments.rb index 2816d15b0..9a3159e38 100644 --- a/db/migrate/20180129190950_add_index_to_valuation_comments.rb +++ b/db/migrate/20180129190950_add_index_to_valuation_comments.rb @@ -1,4 +1,4 @@ -class AddIndexToValuationComments < ActiveRecord::Migration +class AddIndexToValuationComments < ActiveRecord::Migration[4.2] disable_ddl_transaction! def change diff --git a/db/migrate/20180131011426_remove_internal_comments_from_investment.rb b/db/migrate/20180131011426_remove_internal_comments_from_investment.rb index b104e2bae..f37c1b1d1 100644 --- a/db/migrate/20180131011426_remove_internal_comments_from_investment.rb +++ b/db/migrate/20180131011426_remove_internal_comments_from_investment.rb @@ -1,4 +1,4 @@ -class RemoveInternalCommentsFromInvestment < ActiveRecord::Migration +class RemoveInternalCommentsFromInvestment < ActiveRecord::Migration[4.2] def change remove_column :budget_investments, :internal_comments end diff --git a/db/migrate/20180205170054_create_newsletters.rb b/db/migrate/20180205170054_create_newsletters.rb index bd434c7a8..0ba59b16a 100644 --- a/db/migrate/20180205170054_create_newsletters.rb +++ b/db/migrate/20180205170054_create_newsletters.rb @@ -1,4 +1,4 @@ -class CreateNewsletters < ActiveRecord::Migration +class CreateNewsletters < ActiveRecord::Migration[4.2] def change create_table :newsletters do |t| t.string :subject diff --git a/db/migrate/20180208151658_create_valuator_groups.rb b/db/migrate/20180208151658_create_valuator_groups.rb index 441478cc5..7f6823e01 100644 --- a/db/migrate/20180208151658_create_valuator_groups.rb +++ b/db/migrate/20180208151658_create_valuator_groups.rb @@ -1,4 +1,4 @@ -class CreateValuatorGroups < ActiveRecord::Migration +class CreateValuatorGroups < ActiveRecord::Migration[4.2] def change create_table :valuator_groups do |t| t.string :name diff --git a/db/migrate/20180208163135_add_valuator_group_to_valuators.rb b/db/migrate/20180208163135_add_valuator_group_to_valuators.rb index 93ec65e17..366fe5376 100644 --- a/db/migrate/20180208163135_add_valuator_group_to_valuators.rb +++ b/db/migrate/20180208163135_add_valuator_group_to_valuators.rb @@ -1,4 +1,4 @@ -class AddValuatorGroupToValuators < ActiveRecord::Migration +class AddValuatorGroupToValuators < ActiveRecord::Migration[4.2] def change add_column :valuators, :valuator_group_id, :integer end diff --git a/db/migrate/20180208200659_create_budget_valuator_group_assignment.rb b/db/migrate/20180208200659_create_budget_valuator_group_assignment.rb index 916ed298e..97f3e48f5 100644 --- a/db/migrate/20180208200659_create_budget_valuator_group_assignment.rb +++ b/db/migrate/20180208200659_create_budget_valuator_group_assignment.rb @@ -1,4 +1,4 @@ -class CreateBudgetValuatorGroupAssignment < ActiveRecord::Migration +class CreateBudgetValuatorGroupAssignment < ActiveRecord::Migration[4.2] def change create_table :budget_valuator_group_assignments do |t| t.integer :valuator_group_id diff --git a/db/migrate/20180211182635_add_budget_valuator_group_assignments_counters.rb b/db/migrate/20180211182635_add_budget_valuator_group_assignments_counters.rb index 93619a5a9..59868d2bf 100644 --- a/db/migrate/20180211182635_add_budget_valuator_group_assignments_counters.rb +++ b/db/migrate/20180211182635_add_budget_valuator_group_assignments_counters.rb @@ -1,4 +1,4 @@ -class AddBudgetValuatorGroupAssignmentsCounters < ActiveRecord::Migration +class AddBudgetValuatorGroupAssignmentsCounters < ActiveRecord::Migration[4.2] def change add_column :budget_investments, :valuator_group_assignments_count, :integer, default: 0 add_column :valuator_groups, :budget_investments_count, :integer, default: 0 diff --git a/db/migrate/20180220211105_change_newsletter_segment_recipient_to_string.rb b/db/migrate/20180220211105_change_newsletter_segment_recipient_to_string.rb index 1f87a56f5..4d34e4303 100644 --- a/db/migrate/20180220211105_change_newsletter_segment_recipient_to_string.rb +++ b/db/migrate/20180220211105_change_newsletter_segment_recipient_to_string.rb @@ -1,4 +1,4 @@ -class ChangeNewsletterSegmentRecipientToString < ActiveRecord::Migration +class ChangeNewsletterSegmentRecipientToString < ActiveRecord::Migration[4.2] def change change_column :newsletters, :segment_recipient, :string, null: false end diff --git a/db/migrate/20180221002503_create_admin_notifications.rb b/db/migrate/20180221002503_create_admin_notifications.rb index 041931495..c7343d242 100644 --- a/db/migrate/20180221002503_create_admin_notifications.rb +++ b/db/migrate/20180221002503_create_admin_notifications.rb @@ -1,4 +1,4 @@ -class CreateAdminNotifications < ActiveRecord::Migration +class CreateAdminNotifications < ActiveRecord::Migration[4.2] def change create_table :admin_notifications do |t| t.string :title diff --git a/db/migrate/20180222120017_add_read_at_to_notifications.rb b/db/migrate/20180222120017_add_read_at_to_notifications.rb index c65186340..0a9704668 100644 --- a/db/migrate/20180222120017_add_read_at_to_notifications.rb +++ b/db/migrate/20180222120017_add_read_at_to_notifications.rb @@ -1,4 +1,4 @@ -class AddReadAtToNotifications < ActiveRecord::Migration +class AddReadAtToNotifications < ActiveRecord::Migration[4.2] def change add_column :notifications, :read_at, :timestamp end diff --git a/db/migrate/20180320104823_add_max_votable_headings_to_budget_groups.rb b/db/migrate/20180320104823_add_max_votable_headings_to_budget_groups.rb index e030b7b13..5511065d2 100644 --- a/db/migrate/20180320104823_add_max_votable_headings_to_budget_groups.rb +++ b/db/migrate/20180320104823_add_max_votable_headings_to_budget_groups.rb @@ -1,4 +1,4 @@ -class AddMaxVotableHeadingsToBudgetGroups < ActiveRecord::Migration +class AddMaxVotableHeadingsToBudgetGroups < ActiveRecord::Migration[4.2] def change add_column :budget_groups, :max_votable_headings, :integer, default: 1 end diff --git a/db/migrate/20180321140337_create_budget_investment_statuses.rb b/db/migrate/20180321140337_create_budget_investment_statuses.rb index 292644ede..d3fff0a20 100644 --- a/db/migrate/20180321140337_create_budget_investment_statuses.rb +++ b/db/migrate/20180321140337_create_budget_investment_statuses.rb @@ -1,4 +1,4 @@ -class CreateBudgetInvestmentStatuses < ActiveRecord::Migration +class CreateBudgetInvestmentStatuses < ActiveRecord::Migration[4.2] def change create_table :budget_investment_statuses do |t| t.string :name diff --git a/db/migrate/20180321180149_add_status_to_milestones.rb b/db/migrate/20180321180149_add_status_to_milestones.rb index 527d87181..9d117c3d9 100644 --- a/db/migrate/20180321180149_add_status_to_milestones.rb +++ b/db/migrate/20180321180149_add_status_to_milestones.rb @@ -1,4 +1,4 @@ -class AddStatusToMilestones < ActiveRecord::Migration +class AddStatusToMilestones < ActiveRecord::Migration[4.2] disable_ddl_transaction! def change diff --git a/db/migrate/20180323190027_add_translate_milestones.rb b/db/migrate/20180323190027_add_translate_milestones.rb index 2a629a473..978d227e7 100644 --- a/db/migrate/20180323190027_add_translate_milestones.rb +++ b/db/migrate/20180323190027_add_translate_milestones.rb @@ -1,4 +1,4 @@ -class AddTranslateMilestones < ActiveRecord::Migration +class AddTranslateMilestones < ActiveRecord::Migration[4.2] def change create_table :budget_investment_milestone_translations do |t| t.integer :budget_investment_milestone_id, null: false diff --git a/db/migrate/20180516091302_create_widget_cards.rb b/db/migrate/20180516091302_create_widget_cards.rb index f957ae231..b1595838e 100644 --- a/db/migrate/20180516091302_create_widget_cards.rb +++ b/db/migrate/20180516091302_create_widget_cards.rb @@ -1,4 +1,4 @@ -class CreateWidgetCards < ActiveRecord::Migration +class CreateWidgetCards < ActiveRecord::Migration[4.2] def change create_table :widget_cards do |t| t.string :title diff --git a/db/migrate/20180516105911_add_moderation_flags_to_proposal_notifications.rb b/db/migrate/20180516105911_add_moderation_flags_to_proposal_notifications.rb index f62c1e1cf..588da19fe 100644 --- a/db/migrate/20180516105911_add_moderation_flags_to_proposal_notifications.rb +++ b/db/migrate/20180516105911_add_moderation_flags_to_proposal_notifications.rb @@ -1,4 +1,4 @@ -class AddModerationFlagsToProposalNotifications < ActiveRecord::Migration +class AddModerationFlagsToProposalNotifications < ActiveRecord::Migration[4.2] def change add_column :proposal_notifications, :moderated, :boolean, default: false add_column :proposal_notifications, :hidden_at, :datetime diff --git a/db/migrate/20180517141120_add_hidden_at_to_newsletters.rb b/db/migrate/20180517141120_add_hidden_at_to_newsletters.rb index 5e1b4b8cf..08fd47d66 100644 --- a/db/migrate/20180517141120_add_hidden_at_to_newsletters.rb +++ b/db/migrate/20180517141120_add_hidden_at_to_newsletters.rb @@ -1,4 +1,4 @@ -class AddHiddenAtToNewsletters < ActiveRecord::Migration +class AddHiddenAtToNewsletters < ActiveRecord::Migration[4.2] def change add_column :newsletters, :hidden_at, :datetime end diff --git a/db/migrate/20180519132610_create_widget_feeds.rb b/db/migrate/20180519132610_create_widget_feeds.rb index e01d1f3ad..721e3a4fc 100644 --- a/db/migrate/20180519132610_create_widget_feeds.rb +++ b/db/migrate/20180519132610_create_widget_feeds.rb @@ -1,4 +1,4 @@ -class CreateWidgetFeeds < ActiveRecord::Migration +class CreateWidgetFeeds < ActiveRecord::Migration[4.2] def change create_table :widget_feeds do |t| t.string :kind diff --git a/db/migrate/20180604124515_add_recommended_debates_setting_to_users.rb b/db/migrate/20180604124515_add_recommended_debates_setting_to_users.rb index 500f1f4fc..033de6c81 100644 --- a/db/migrate/20180604124515_add_recommended_debates_setting_to_users.rb +++ b/db/migrate/20180604124515_add_recommended_debates_setting_to_users.rb @@ -1,4 +1,4 @@ -class AddRecommendedDebatesSettingToUsers < ActiveRecord::Migration +class AddRecommendedDebatesSettingToUsers < ActiveRecord::Migration[4.2] def change change_table :users do |t| t.boolean :recommended_debates, default: false diff --git a/db/migrate/20180604151014_add_recommended_proposals_setting_to_users.rb b/db/migrate/20180604151014_add_recommended_proposals_setting_to_users.rb index 53a59e210..1a5cb9eb9 100644 --- a/db/migrate/20180604151014_add_recommended_proposals_setting_to_users.rb +++ b/db/migrate/20180604151014_add_recommended_proposals_setting_to_users.rb @@ -1,4 +1,4 @@ -class AddRecommendedProposalsSettingToUsers < ActiveRecord::Migration +class AddRecommendedProposalsSettingToUsers < ActiveRecord::Migration[4.2] def change change_table :users do |t| t.boolean :recommended_proposals, default: false diff --git a/db/migrate/20180613143922_add_moderation_attrs_to_investments.rb b/db/migrate/20180613143922_add_moderation_attrs_to_investments.rb index ebb4fdf1a..34edacef7 100644 --- a/db/migrate/20180613143922_add_moderation_attrs_to_investments.rb +++ b/db/migrate/20180613143922_add_moderation_attrs_to_investments.rb @@ -1,4 +1,4 @@ -class AddModerationAttrsToInvestments < ActiveRecord::Migration +class AddModerationAttrsToInvestments < ActiveRecord::Migration[4.2] def change change_table :budget_investments do |t| t.datetime :confirmed_hide_at diff --git a/db/migrate/20180711224810_enable_recommendations_by_default.rb b/db/migrate/20180711224810_enable_recommendations_by_default.rb index ece94e1b8..9acafcf98 100644 --- a/db/migrate/20180711224810_enable_recommendations_by_default.rb +++ b/db/migrate/20180711224810_enable_recommendations_by_default.rb @@ -1,4 +1,4 @@ -class EnableRecommendationsByDefault < ActiveRecord::Migration +class EnableRecommendationsByDefault < ActiveRecord::Migration[4.2] def change change_column_default :users, :recommended_debates, true change_column_default :users, :recommended_proposals, true diff --git a/db/migrate/20180713103402_change_budget_investment_statuses_to_milestone_statuses.rb b/db/migrate/20180713103402_change_budget_investment_statuses_to_milestone_statuses.rb index 05deae5a7..02dec73bc 100644 --- a/db/migrate/20180713103402_change_budget_investment_statuses_to_milestone_statuses.rb +++ b/db/migrate/20180713103402_change_budget_investment_statuses_to_milestone_statuses.rb @@ -1,4 +1,4 @@ -class ChangeBudgetInvestmentStatusesToMilestoneStatuses < ActiveRecord::Migration +class ChangeBudgetInvestmentStatusesToMilestoneStatuses < ActiveRecord::Migration[4.2] def change create_table :milestone_statuses do |t| t.string :name diff --git a/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb b/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb index 9d8ce901e..3b9b8d54d 100644 --- a/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb +++ b/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb @@ -1,4 +1,4 @@ -class MakeInvestmentMilestonesPolymorphic < ActiveRecord::Migration +class MakeInvestmentMilestonesPolymorphic < ActiveRecord::Migration[4.2] def change create_table :milestones do |t| t.references :milestoneable, polymorphic: true diff --git a/db/migrate/20180718115545_create_i18n_content_translations.rb b/db/migrate/20180718115545_create_i18n_content_translations.rb index 8e6fde21c..478ef6d8e 100644 --- a/db/migrate/20180718115545_create_i18n_content_translations.rb +++ b/db/migrate/20180718115545_create_i18n_content_translations.rb @@ -1,4 +1,4 @@ -class CreateI18nContentTranslations < ActiveRecord::Migration +class CreateI18nContentTranslations < ActiveRecord::Migration[4.2] def change create_table :i18n_contents do |t| t.string :key diff --git a/db/migrate/20180727140800_add_banner_translations.rb b/db/migrate/20180727140800_add_banner_translations.rb index 4c4c9391e..e6587deeb 100644 --- a/db/migrate/20180727140800_add_banner_translations.rb +++ b/db/migrate/20180727140800_add_banner_translations.rb @@ -1,4 +1,4 @@ -class AddBannerTranslations < ActiveRecord::Migration +class AddBannerTranslations < ActiveRecord::Migration[4.2] def self.up Banner.create_translation_table!( diff --git a/db/migrate/20180730120800_add_homepage_content_translations.rb b/db/migrate/20180730120800_add_homepage_content_translations.rb index b344f95c3..c55e1af3f 100644 --- a/db/migrate/20180730120800_add_homepage_content_translations.rb +++ b/db/migrate/20180730120800_add_homepage_content_translations.rb @@ -1,4 +1,4 @@ -class AddHomepageContentTranslations < ActiveRecord::Migration +class AddHomepageContentTranslations < ActiveRecord::Migration[4.2] def self.up Widget::Card.create_translation_table!( diff --git a/db/migrate/20180730213824_add_poll_translations.rb b/db/migrate/20180730213824_add_poll_translations.rb index 75495d327..48837c550 100644 --- a/db/migrate/20180730213824_add_poll_translations.rb +++ b/db/migrate/20180730213824_add_poll_translations.rb @@ -1,4 +1,4 @@ -class AddPollTranslations < ActiveRecord::Migration +class AddPollTranslations < ActiveRecord::Migration[4.2] def self.up Poll.create_translation_table!( diff --git a/db/migrate/20180731150800_add_admin_notification_translations.rb b/db/migrate/20180731150800_add_admin_notification_translations.rb index fb76a42d2..83dfb3cf9 100644 --- a/db/migrate/20180731150800_add_admin_notification_translations.rb +++ b/db/migrate/20180731150800_add_admin_notification_translations.rb @@ -1,4 +1,4 @@ -class AddAdminNotificationTranslations < ActiveRecord::Migration +class AddAdminNotificationTranslations < ActiveRecord::Migration[4.2] def self.up AdminNotification.create_translation_table!( diff --git a/db/migrate/20180731173147_add_poll_question_translations.rb b/db/migrate/20180731173147_add_poll_question_translations.rb index f62fbc161..f099e49b9 100644 --- a/db/migrate/20180731173147_add_poll_question_translations.rb +++ b/db/migrate/20180731173147_add_poll_question_translations.rb @@ -1,4 +1,4 @@ -class AddPollQuestionTranslations < ActiveRecord::Migration +class AddPollQuestionTranslations < ActiveRecord::Migration[4.2] def self.up Poll::Question.create_translation_table!( diff --git a/db/migrate/20180801114529_add_poll_question_answer_translations.rb b/db/migrate/20180801114529_add_poll_question_answer_translations.rb index 3203d7a1f..5f9a8cada 100644 --- a/db/migrate/20180801114529_add_poll_question_answer_translations.rb +++ b/db/migrate/20180801114529_add_poll_question_answer_translations.rb @@ -1,4 +1,4 @@ -class AddPollQuestionAnswerTranslations < ActiveRecord::Migration +class AddPollQuestionAnswerTranslations < ActiveRecord::Migration[4.2] def self.up Poll::Question::Answer.create_translation_table!( diff --git a/db/migrate/20180801140800_add_collaborative_legislation_translations.rb b/db/migrate/20180801140800_add_collaborative_legislation_translations.rb index 569689a73..80d9d1f5b 100644 --- a/db/migrate/20180801140800_add_collaborative_legislation_translations.rb +++ b/db/migrate/20180801140800_add_collaborative_legislation_translations.rb @@ -1,4 +1,4 @@ -class AddCollaborativeLegislationTranslations < ActiveRecord::Migration +class AddCollaborativeLegislationTranslations < ActiveRecord::Migration[4.2] def self.up Legislation::Process.create_translation_table!( diff --git a/db/migrate/20180807104331_add_selected_to_legislation_proposals.rb b/db/migrate/20180807104331_add_selected_to_legislation_proposals.rb index 6696c2796..2342b04a2 100644 --- a/db/migrate/20180807104331_add_selected_to_legislation_proposals.rb +++ b/db/migrate/20180807104331_add_selected_to_legislation_proposals.rb @@ -1,4 +1,4 @@ -class AddSelectedToLegislationProposals < ActiveRecord::Migration +class AddSelectedToLegislationProposals < ActiveRecord::Migration[4.2] def change add_column :legislation_proposals, :selected, :boolean end diff --git a/db/migrate/20180813141443_create_ckeditor_assets.rb b/db/migrate/20180813141443_create_ckeditor_assets.rb index f7b5b85f4..2610bc5f5 100644 --- a/db/migrate/20180813141443_create_ckeditor_assets.rb +++ b/db/migrate/20180813141443_create_ckeditor_assets.rb @@ -1,4 +1,4 @@ -class CreateCkeditorAssets < ActiveRecord::Migration +class CreateCkeditorAssets < ActiveRecord::Migration[4.2] def self.up create_table :ckeditor_assets do |t| t.string :data_file_name, null: false diff --git a/db/migrate/20180924071722_add_translate_pages.rb b/db/migrate/20180924071722_add_translate_pages.rb index 250f46dee..f29d34600 100644 --- a/db/migrate/20180924071722_add_translate_pages.rb +++ b/db/migrate/20180924071722_add_translate_pages.rb @@ -1,4 +1,4 @@ -class AddTranslatePages < ActiveRecord::Migration +class AddTranslatePages < ActiveRecord::Migration[4.2] def self.up SiteCustomization::Page.create_translation_table!( { diff --git a/db/migrate/20181016204729_add_draft_phase_to_legislation_processes.rb b/db/migrate/20181016204729_add_draft_phase_to_legislation_processes.rb index f2b6220cb..7c3e017eb 100644 --- a/db/migrate/20181016204729_add_draft_phase_to_legislation_processes.rb +++ b/db/migrate/20181016204729_add_draft_phase_to_legislation_processes.rb @@ -1,4 +1,4 @@ -class AddDraftPhaseToLegislationProcesses < ActiveRecord::Migration +class AddDraftPhaseToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :draft_start_date, :date add_index :legislation_processes, :draft_start_date diff --git a/db/migrate/20181108103111_add_allow_custom_content_to_headings.rb b/db/migrate/20181108103111_add_allow_custom_content_to_headings.rb index cf65b6fa3..609f5a03a 100644 --- a/db/migrate/20181108103111_add_allow_custom_content_to_headings.rb +++ b/db/migrate/20181108103111_add_allow_custom_content_to_headings.rb @@ -1,4 +1,4 @@ -class AddAllowCustomContentToHeadings < ActiveRecord::Migration +class AddAllowCustomContentToHeadings < ActiveRecord::Migration[4.2] def change add_column :budget_headings, :allow_custom_content, :boolean, default: false end diff --git a/db/migrate/20181108142513_create_heading_content_blocks.rb b/db/migrate/20181108142513_create_heading_content_blocks.rb index 17db70e8c..1111f7e3a 100644 --- a/db/migrate/20181108142513_create_heading_content_blocks.rb +++ b/db/migrate/20181108142513_create_heading_content_blocks.rb @@ -1,4 +1,4 @@ -class CreateHeadingContentBlocks < ActiveRecord::Migration +class CreateHeadingContentBlocks < ActiveRecord::Migration[4.2] def change create_table :budget_content_blocks do |t| t.integer :heading_id, index: true, foreign_key: true diff --git a/db/migrate/20181109111037_add_location_to_headings.rb b/db/migrate/20181109111037_add_location_to_headings.rb index 973cdf38e..8695fe455 100644 --- a/db/migrate/20181109111037_add_location_to_headings.rb +++ b/db/migrate/20181109111037_add_location_to_headings.rb @@ -1,4 +1,4 @@ -class AddLocationToHeadings < ActiveRecord::Migration +class AddLocationToHeadings < ActiveRecord::Migration[4.2] def change add_column :budget_headings, :latitude, :text add_column :budget_headings, :longitude, :text diff --git a/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb b/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb index c93b5d3fa..a93cfa6e3 100644 --- a/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb +++ b/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb @@ -1,4 +1,4 @@ -class AddMilestonesSummaryToLegislationProcessTranslation < ActiveRecord::Migration +class AddMilestonesSummaryToLegislationProcessTranslation < ActiveRecord::Migration[4.2] def change add_column :legislation_process_translations, :milestones_summary, :text end diff --git a/db/migrate/20181206153510_add_home_page_to_legislation_processes.rb b/db/migrate/20181206153510_add_home_page_to_legislation_processes.rb index f0b513f6d..101aedbfe 100644 --- a/db/migrate/20181206153510_add_home_page_to_legislation_processes.rb +++ b/db/migrate/20181206153510_add_home_page_to_legislation_processes.rb @@ -1,4 +1,4 @@ -class AddHomePageToLegislationProcesses < ActiveRecord::Migration +class AddHomePageToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :homepage_enabled, :boolean, default: false diff --git a/db/migrate/20181218164126_add_site_customization_page_to_widget_cards.rb b/db/migrate/20181218164126_add_site_customization_page_to_widget_cards.rb index f4dad35fc..b6e0ea3fa 100644 --- a/db/migrate/20181218164126_add_site_customization_page_to_widget_cards.rb +++ b/db/migrate/20181218164126_add_site_customization_page_to_widget_cards.rb @@ -1,5 +1,5 @@ -class AddSiteCustomizationPageToWidgetCards < ActiveRecord::Migration +class AddSiteCustomizationPageToWidgetCards < ActiveRecord::Migration[4.2] def change add_reference :widget_cards, :site_customization_page, index: true end -end \ No newline at end of file +end diff --git a/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb b/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb index b4c7b3ad8..c1df62a9f 100644 --- a/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb +++ b/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb @@ -1,6 +1,6 @@ -class AddHeaderColorSettingsToLegislationProcesses < ActiveRecord::Migration +class AddHeaderColorSettingsToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :background_color, :text add_column :legislation_processes, :font_color, :text end -end \ No newline at end of file +end diff --git a/db/migrate/20190103132925_create_progress_bars.rb b/db/migrate/20190103132925_create_progress_bars.rb index 899a4819f..3ada28004 100644 --- a/db/migrate/20190103132925_create_progress_bars.rb +++ b/db/migrate/20190103132925_create_progress_bars.rb @@ -1,4 +1,4 @@ -class CreateProgressBars < ActiveRecord::Migration +class CreateProgressBars < ActiveRecord::Migration[4.2] def change create_table :progress_bars do |t| t.integer :kind diff --git a/db/migrate/20190104160114_create_active_polls.rb b/db/migrate/20190104160114_create_active_polls.rb index 497c630da..a5340050a 100644 --- a/db/migrate/20190104160114_create_active_polls.rb +++ b/db/migrate/20190104160114_create_active_polls.rb @@ -1,4 +1,4 @@ -class CreateActivePolls < ActiveRecord::Migration +class CreateActivePolls < ActiveRecord::Migration[4.2] def change create_table :active_polls do |t| t.datetime :created_at, null: false diff --git a/db/migrate/20190104170114_add_active_polls_translations.rb b/db/migrate/20190104170114_add_active_polls_translations.rb index 9f43f8e9f..c6158a83e 100644 --- a/db/migrate/20190104170114_add_active_polls_translations.rb +++ b/db/migrate/20190104170114_add_active_polls_translations.rb @@ -1,4 +1,4 @@ -class AddActivePollsTranslations < ActiveRecord::Migration +class AddActivePollsTranslations < ActiveRecord::Migration[4.2] def self.up ActivePoll.create_translation_table!( diff --git a/db/migrate/20190118115237_add_cached_votes_score_to_legislation_proposals.rb b/db/migrate/20190118115237_add_cached_votes_score_to_legislation_proposals.rb index 29a02ed41..dc1d64703 100644 --- a/db/migrate/20190118115237_add_cached_votes_score_to_legislation_proposals.rb +++ b/db/migrate/20190118115237_add_cached_votes_score_to_legislation_proposals.rb @@ -1,4 +1,4 @@ -class AddCachedVotesScoreToLegislationProposals < ActiveRecord::Migration +class AddCachedVotesScoreToLegislationProposals < ActiveRecord::Migration[4.2] def change add_column :legislation_proposals, :cached_votes_score, :integer, default: 0 diff --git a/db/migrate/20190118135741_add_budget_translations.rb b/db/migrate/20190118135741_add_budget_translations.rb index 4ba7a94a9..19404d313 100644 --- a/db/migrate/20190118135741_add_budget_translations.rb +++ b/db/migrate/20190118135741_add_budget_translations.rb @@ -1,4 +1,4 @@ -class AddBudgetTranslations < ActiveRecord::Migration +class AddBudgetTranslations < ActiveRecord::Migration[4.2] def self.up Budget.create_translation_table!( diff --git a/db/migrate/20190119160418_add_budget_phase_translations.rb b/db/migrate/20190119160418_add_budget_phase_translations.rb index 45fff7db1..67e8afdc5 100644 --- a/db/migrate/20190119160418_add_budget_phase_translations.rb +++ b/db/migrate/20190119160418_add_budget_phase_translations.rb @@ -1,4 +1,4 @@ -class AddBudgetPhaseTranslations < ActiveRecord::Migration +class AddBudgetPhaseTranslations < ActiveRecord::Migration[4.2] def self.up Budget::Phase.create_translation_table!( diff --git a/db/migrate/20190120155819_add_budget_group_translations.rb b/db/migrate/20190120155819_add_budget_group_translations.rb index 7be1575d3..869906a35 100644 --- a/db/migrate/20190120155819_add_budget_group_translations.rb +++ b/db/migrate/20190120155819_add_budget_group_translations.rb @@ -1,4 +1,4 @@ -class AddBudgetGroupTranslations < ActiveRecord::Migration +class AddBudgetGroupTranslations < ActiveRecord::Migration[4.2] def self.up Budget::Group.create_translation_table!( diff --git a/db/migrate/20190121171237_add_budget_heading_translations.rb b/db/migrate/20190121171237_add_budget_heading_translations.rb index c56560e78..e0fa70268 100644 --- a/db/migrate/20190121171237_add_budget_heading_translations.rb +++ b/db/migrate/20190121171237_add_budget_heading_translations.rb @@ -1,4 +1,4 @@ -class AddBudgetHeadingTranslations < ActiveRecord::Migration +class AddBudgetHeadingTranslations < ActiveRecord::Migration[4.2] def self.up Budget::Heading.create_translation_table!( diff --git a/db/migrate/20190124084612_drop_annotations_table.rb b/db/migrate/20190124084612_drop_annotations_table.rb index eaf86595a..3e836df80 100644 --- a/db/migrate/20190124084612_drop_annotations_table.rb +++ b/db/migrate/20190124084612_drop_annotations_table.rb @@ -1,4 +1,4 @@ -class DropAnnotationsTable < ActiveRecord::Migration +class DropAnnotationsTable < ActiveRecord::Migration[4.2] def change drop_table :annotations end diff --git a/db/migrate/20190124085815_drop_legacy_legislations_table.rb b/db/migrate/20190124085815_drop_legacy_legislations_table.rb index 28381e1c2..a246a34ba 100644 --- a/db/migrate/20190124085815_drop_legacy_legislations_table.rb +++ b/db/migrate/20190124085815_drop_legacy_legislations_table.rb @@ -1,4 +1,4 @@ -class DropLegacyLegislationsTable < ActiveRecord::Migration +class DropLegacyLegislationsTable < ActiveRecord::Migration[4.2] def change drop_table :legacy_legislations end diff --git a/db/migrate/20190131122858_add_columns_to_widget_cards.rb b/db/migrate/20190131122858_add_columns_to_widget_cards.rb index f74343d1f..022b22e66 100644 --- a/db/migrate/20190131122858_add_columns_to_widget_cards.rb +++ b/db/migrate/20190131122858_add_columns_to_widget_cards.rb @@ -1,4 +1,4 @@ -class AddColumnsToWidgetCards < ActiveRecord::Migration +class AddColumnsToWidgetCards < ActiveRecord::Migration[4.2] def change add_column :widget_cards, :columns, :integer, default: 4 end diff --git a/db/migrate/20190205131722_increase_tag_name_limit.rb b/db/migrate/20190205131722_increase_tag_name_limit.rb index 6b60ee697..ede7f0a40 100644 --- a/db/migrate/20190205131722_increase_tag_name_limit.rb +++ b/db/migrate/20190205131722_increase_tag_name_limit.rb @@ -1,4 +1,4 @@ -class IncreaseTagNameLimit < ActiveRecord::Migration +class IncreaseTagNameLimit < ActiveRecord::Migration[4.2] def up change_column :tags, :name, :string, limit: 160 end diff --git a/db/schema.rb b/db/schema.rb index 61b5e923f..5494af68c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -24,11 +23,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "description" + t.index ["active_poll_id"], name: "index_active_poll_translations_on_active_poll_id", using: :btree + t.index ["locale"], name: "index_active_poll_translations_on_locale", using: :btree end - add_index "active_poll_translations", ["active_poll_id"], name: "index_active_poll_translations_on_active_poll_id", using: :btree - add_index "active_poll_translations", ["locale"], name: "index_active_poll_translations_on_locale", using: :btree - create_table "active_polls", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -37,15 +35,14 @@ ActiveRecord::Schema.define(version: 20190205131722) do create_table "activities", force: :cascade do |t| t.integer "user_id" t.string "action" - t.integer "actionable_id" t.string "actionable_type" + t.integer "actionable_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["actionable_id", "actionable_type"], name: "index_activities_on_actionable_id_and_actionable_type", using: :btree + t.index ["user_id"], name: "index_activities_on_user_id", using: :btree end - add_index "activities", ["actionable_id", "actionable_type"], name: "index_activities_on_actionable_id_and_actionable_type", using: :btree - add_index "activities", ["user_id"], name: "index_activities_on_user_id", using: :btree - create_table "admin_notification_translations", force: :cascade do |t| t.integer "admin_notification_id", null: false t.string "locale", null: false @@ -53,11 +50,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.string "title" t.text "body" + t.index ["admin_notification_id"], name: "index_admin_notification_translations_on_admin_notification_id", using: :btree + t.index ["locale"], name: "index_admin_notification_translations_on_locale", using: :btree end - add_index "admin_notification_translations", ["admin_notification_id"], name: "index_admin_notification_translations_on_admin_notification_id", using: :btree - add_index "admin_notification_translations", ["locale"], name: "index_admin_notification_translations_on_locale", using: :btree - create_table "admin_notifications", force: :cascade do |t| t.string "title" t.text "body" @@ -71,10 +67,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do create_table "administrators", force: :cascade do |t| t.integer "user_id" + t.index ["user_id"], name: "index_administrators_on_user_id", using: :btree end - add_index "administrators", ["user_id"], name: "index_administrators_on_user_id", using: :btree - create_table "ahoy_events", id: :uuid, default: nil, force: :cascade do |t| t.uuid "visit_id" t.integer "user_id" @@ -82,13 +77,12 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.jsonb "properties" t.datetime "time" t.string "ip" + t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time", using: :btree + t.index ["time"], name: "index_ahoy_events_on_time", using: :btree + t.index ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree + t.index ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree end - add_index "ahoy_events", ["name", "time"], name: "index_ahoy_events_on_name_and_time", using: :btree - add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree - add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree - add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree - create_table "banner_sections", force: :cascade do |t| t.integer "banner_id" t.integer "web_section_id" @@ -103,11 +97,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.string "title" t.text "description" + t.index ["banner_id"], name: "index_banner_translations_on_banner_id", using: :btree + t.index ["locale"], name: "index_banner_translations_on_locale", using: :btree end - add_index "banner_translations", ["banner_id"], name: "index_banner_translations_on_banner_id", using: :btree - add_index "banner_translations", ["locale"], name: "index_banner_translations_on_locale", using: :btree - create_table "banners", force: :cascade do |t| t.string "title", limit: 80 t.string "description" @@ -119,10 +112,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.text "background_color" t.text "font_color" + t.index ["hidden_at"], name: "index_banners_on_hidden_at", using: :btree end - add_index "banners", ["hidden_at"], name: "index_banners_on_hidden_at", using: :btree - create_table "budget_ballot_lines", force: :cascade do |t| t.integer "ballot_id" t.integer "investment_id" @@ -131,12 +123,11 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "budget_id" t.integer "group_id" t.integer "heading_id" + t.index ["ballot_id", "investment_id"], name: "index_budget_ballot_lines_on_ballot_id_and_investment_id", unique: true, using: :btree + t.index ["ballot_id"], name: "index_budget_ballot_lines_on_ballot_id", using: :btree + t.index ["investment_id"], name: "index_budget_ballot_lines_on_investment_id", using: :btree end - add_index "budget_ballot_lines", ["ballot_id", "investment_id"], name: "index_budget_ballot_lines_on_ballot_id_and_investment_id", unique: true, using: :btree - add_index "budget_ballot_lines", ["ballot_id"], name: "index_budget_ballot_lines_on_ballot_id", using: :btree - add_index "budget_ballot_lines", ["investment_id"], name: "index_budget_ballot_lines_on_investment_id", using: :btree - create_table "budget_ballots", force: :cascade do |t| t.integer "user_id" t.integer "budget_id" @@ -152,54 +143,49 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "locale" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["heading_id"], name: "index_budget_content_blocks_on_heading_id", using: :btree end - add_index "budget_content_blocks", ["heading_id"], name: "index_budget_content_blocks_on_heading_id", using: :btree - create_table "budget_group_translations", force: :cascade do |t| t.integer "budget_group_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "name" + t.index ["budget_group_id"], name: "index_budget_group_translations_on_budget_group_id", using: :btree + t.index ["locale"], name: "index_budget_group_translations_on_locale", using: :btree end - add_index "budget_group_translations", ["budget_group_id"], name: "index_budget_group_translations_on_budget_group_id", using: :btree - add_index "budget_group_translations", ["locale"], name: "index_budget_group_translations_on_locale", using: :btree - create_table "budget_groups", force: :cascade do |t| t.integer "budget_id" t.string "name", limit: 50 t.string "slug" t.integer "max_votable_headings", default: 1 + t.index ["budget_id"], name: "index_budget_groups_on_budget_id", using: :btree end - add_index "budget_groups", ["budget_id"], name: "index_budget_groups_on_budget_id", using: :btree - create_table "budget_heading_translations", force: :cascade do |t| t.integer "budget_heading_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "name" + t.index ["budget_heading_id"], name: "index_budget_heading_translations_on_budget_heading_id", using: :btree + t.index ["locale"], name: "index_budget_heading_translations_on_locale", using: :btree end - add_index "budget_heading_translations", ["budget_heading_id"], name: "index_budget_heading_translations_on_budget_heading_id", using: :btree - add_index "budget_heading_translations", ["locale"], name: "index_budget_heading_translations_on_locale", using: :btree - create_table "budget_headings", force: :cascade do |t| t.integer "group_id" t.string "name", limit: 50 - t.integer "price", limit: 8 + t.bigint "price" t.integer "population" t.string "slug" t.boolean "allow_custom_content", default: false t.text "latitude" t.text "longitude" + t.index ["group_id"], name: "index_budget_headings_on_group_id", using: :btree end - add_index "budget_headings", ["group_id"], name: "index_budget_headings_on_group_id", using: :btree - create_table "budget_investment_milestone_translations", force: :cascade do |t| t.integer "budget_investment_milestone_id", null: false t.string "locale", null: false @@ -207,11 +193,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.string "title" t.text "description" + t.index ["budget_investment_milestone_id"], name: "index_6770e7675fe296cf87aa0fd90492c141b5269e0b", using: :btree + t.index ["locale"], name: "index_budget_investment_milestone_translations_on_locale", using: :btree end - add_index "budget_investment_milestone_translations", ["budget_investment_milestone_id"], name: "index_6770e7675fe296cf87aa0fd90492c141b5269e0b", using: :btree - add_index "budget_investment_milestone_translations", ["locale"], name: "index_budget_investment_milestone_translations_on_locale", using: :btree - create_table "budget_investment_milestones", force: :cascade do |t| t.integer "investment_id" t.string "title", limit: 80 @@ -220,33 +205,31 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.datetime "publication_date" t.integer "status_id" + t.index ["status_id"], name: "index_budget_investment_milestones_on_status_id", using: :btree end - add_index "budget_investment_milestones", ["status_id"], name: "index_budget_investment_milestones_on_status_id", using: :btree - create_table "budget_investment_statuses", force: :cascade do |t| t.string "name" t.text "description" t.datetime "hidden_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["hidden_at"], name: "index_budget_investment_statuses_on_hidden_at", using: :btree end - add_index "budget_investment_statuses", ["hidden_at"], name: "index_budget_investment_statuses_on_hidden_at", using: :btree - create_table "budget_investments", force: :cascade do |t| t.integer "author_id" t.integer "administrator_id" t.string "title" t.text "description" t.string "external_url" - t.integer "price", limit: 8 + t.bigint "price" t.string "feasibility", limit: 15, default: "undecided" t.text "price_explanation" t.text "unfeasibility_explanation" t.boolean "valuation_finished", default: false t.integer "valuator_assignments_count", default: 0 - t.integer "price_first_year", limit: 8 + t.bigint "price_first_year" t.string "duration" t.datetime "hidden_at" t.integer "cached_votes_up", default: 0 @@ -274,14 +257,13 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "confirmed_hide_at" t.datetime "ignored_flag_at" t.integer "flags_count", default: 0 + t.index ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree + t.index ["author_id"], name: "index_budget_investments_on_author_id", using: :btree + t.index ["community_id"], name: "index_budget_investments_on_community_id", using: :btree + t.index ["heading_id"], name: "index_budget_investments_on_heading_id", using: :btree + t.index ["tsv"], name: "index_budget_investments_on_tsv", using: :gin end - add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree - add_index "budget_investments", ["author_id"], name: "index_budget_investments_on_author_id", using: :btree - add_index "budget_investments", ["community_id"], name: "index_budget_investments_on_community_id", using: :btree - add_index "budget_investments", ["heading_id"], name: "index_budget_investments_on_heading_id", using: :btree - add_index "budget_investments", ["tsv"], name: "index_budget_investments_on_tsv", using: :gin - create_table "budget_phase_translations", force: :cascade do |t| t.integer "budget_phase_id", null: false t.string "locale", null: false @@ -289,11 +271,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.text "description" t.text "summary" + t.index ["budget_phase_id"], name: "index_budget_phase_translations_on_budget_phase_id", using: :btree + t.index ["locale"], name: "index_budget_phase_translations_on_locale", using: :btree end - add_index "budget_phase_translations", ["budget_phase_id"], name: "index_budget_phase_translations_on_budget_phase_id", using: :btree - add_index "budget_phase_translations", ["locale"], name: "index_budget_phase_translations_on_locale", using: :btree - create_table "budget_phases", force: :cascade do |t| t.integer "budget_id" t.integer "next_phase_id" @@ -303,13 +284,12 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "starts_at" t.datetime "ends_at" t.boolean "enabled", default: true + t.index ["ends_at"], name: "index_budget_phases_on_ends_at", using: :btree + t.index ["kind"], name: "index_budget_phases_on_kind", using: :btree + t.index ["next_phase_id"], name: "index_budget_phases_on_next_phase_id", using: :btree + t.index ["starts_at"], name: "index_budget_phases_on_starts_at", using: :btree end - add_index "budget_phases", ["ends_at"], name: "index_budget_phases_on_ends_at", using: :btree - add_index "budget_phases", ["kind"], name: "index_budget_phases_on_kind", using: :btree - add_index "budget_phases", ["next_phase_id"], name: "index_budget_phases_on_next_phase_id", using: :btree - add_index "budget_phases", ["starts_at"], name: "index_budget_phases_on_starts_at", using: :btree - create_table "budget_reclassified_votes", force: :cascade do |t| t.integer "user_id" t.integer "investment_id" @@ -324,20 +304,18 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "name" + t.index ["budget_id"], name: "index_budget_translations_on_budget_id", using: :btree + t.index ["locale"], name: "index_budget_translations_on_locale", using: :btree end - add_index "budget_translations", ["budget_id"], name: "index_budget_translations_on_budget_id", using: :btree - add_index "budget_translations", ["locale"], name: "index_budget_translations_on_locale", using: :btree - create_table "budget_valuator_assignments", force: :cascade do |t| t.integer "valuator_id" t.integer "investment_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["investment_id"], name: "index_budget_valuator_assignments_on_investment_id", using: :btree end - add_index "budget_valuator_assignments", ["investment_id"], name: "index_budget_valuator_assignments_on_investment_id", using: :btree - create_table "budget_valuator_group_assignments", force: :cascade do |t| t.integer "valuator_group_id" t.integer "investment_id" @@ -379,10 +357,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "height" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["type"], name: "index_ckeditor_assets_on_type", using: :btree end - add_index "ckeditor_assets", ["type"], name: "index_ckeditor_assets_on_type", using: :btree - create_table "comments", force: :cascade do |t| t.integer "commentable_id" t.string "commentable_type" @@ -403,17 +380,16 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "ancestry" t.integer "confidence_score", default: 0, null: false t.boolean "valuation", default: false + t.index ["ancestry"], name: "index_comments_on_ancestry", using: :btree + t.index ["cached_votes_down"], name: "index_comments_on_cached_votes_down", using: :btree + t.index ["cached_votes_total"], name: "index_comments_on_cached_votes_total", using: :btree + t.index ["cached_votes_up"], name: "index_comments_on_cached_votes_up", using: :btree + t.index ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type", using: :btree + t.index ["hidden_at"], name: "index_comments_on_hidden_at", using: :btree + t.index ["user_id"], name: "index_comments_on_user_id", using: :btree + t.index ["valuation"], name: "index_comments_on_valuation", using: :btree end - add_index "comments", ["ancestry"], name: "index_comments_on_ancestry", using: :btree - add_index "comments", ["cached_votes_down"], name: "index_comments_on_cached_votes_down", using: :btree - add_index "comments", ["cached_votes_total"], name: "index_comments_on_cached_votes_total", using: :btree - add_index "comments", ["cached_votes_up"], name: "index_comments_on_cached_votes_up", using: :btree - add_index "comments", ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type", using: :btree - add_index "comments", ["hidden_at"], name: "index_comments_on_hidden_at", using: :btree - add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree - add_index "comments", ["valuation"], name: "index_comments_on_valuation", using: :btree - create_table "communities", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -436,26 +412,25 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "confirmed_hide_at" t.integer "cached_anonymous_votes_total", default: 0 t.integer "cached_votes_score", default: 0 - t.integer "hot_score", limit: 8, default: 0 + t.bigint "hot_score", default: 0 t.integer "confidence_score", default: 0 t.integer "geozone_id" t.tsvector "tsv" t.datetime "featured_at" + t.index ["author_id", "hidden_at"], name: "index_debates_on_author_id_and_hidden_at", using: :btree + t.index ["author_id"], name: "index_debates_on_author_id", using: :btree + t.index ["cached_votes_down"], name: "index_debates_on_cached_votes_down", using: :btree + t.index ["cached_votes_score"], name: "index_debates_on_cached_votes_score", using: :btree + t.index ["cached_votes_total"], name: "index_debates_on_cached_votes_total", using: :btree + t.index ["cached_votes_up"], name: "index_debates_on_cached_votes_up", using: :btree + t.index ["confidence_score"], name: "index_debates_on_confidence_score", using: :btree + t.index ["geozone_id"], name: "index_debates_on_geozone_id", using: :btree + t.index ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree + t.index ["hot_score"], name: "index_debates_on_hot_score", using: :btree + t.index ["title"], name: "index_debates_on_title", using: :btree + t.index ["tsv"], name: "index_debates_on_tsv", using: :gin end - add_index "debates", ["author_id", "hidden_at"], name: "index_debates_on_author_id_and_hidden_at", using: :btree - add_index "debates", ["author_id"], name: "index_debates_on_author_id", using: :btree - add_index "debates", ["cached_votes_down"], name: "index_debates_on_cached_votes_down", using: :btree - add_index "debates", ["cached_votes_score"], name: "index_debates_on_cached_votes_score", using: :btree - add_index "debates", ["cached_votes_total"], name: "index_debates_on_cached_votes_total", using: :btree - add_index "debates", ["cached_votes_up"], name: "index_debates_on_cached_votes_up", using: :btree - add_index "debates", ["confidence_score"], name: "index_debates_on_confidence_score", using: :btree - add_index "debates", ["geozone_id"], name: "index_debates_on_geozone_id", using: :btree - add_index "debates", ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree - add_index "debates", ["hot_score"], name: "index_debates_on_hot_score", using: :btree - add_index "debates", ["title"], name: "index_debates_on_title", using: :btree - add_index "debates", ["tsv"], name: "index_debates_on_tsv", using: :gin - create_table "delayed_jobs", force: :cascade do |t| t.integer "priority", default: 0, null: false t.integer "attempts", default: 0, null: false @@ -468,10 +443,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "queue" t.datetime "created_at" t.datetime "updated_at" + t.index ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree end - add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree - create_table "direct_messages", force: :cascade do |t| t.integer "sender_id" t.integer "receiver_id" @@ -488,16 +462,15 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "attachment_file_size" t.datetime "attachment_updated_at" t.integer "user_id" - t.integer "documentable_id" t.string "documentable_type" + t.integer "documentable_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["documentable_type", "documentable_id"], name: "index_documents_on_documentable_type_and_documentable_id", using: :btree + t.index ["user_id", "documentable_type", "documentable_id"], name: "access_documents", using: :btree + t.index ["user_id"], name: "index_documents_on_user_id", using: :btree end - add_index "documents", ["documentable_type", "documentable_id"], name: "index_documents_on_documentable_type_and_documentable_id", using: :btree - add_index "documents", ["user_id", "documentable_type", "documentable_id"], name: "access_documents", using: :btree - add_index "documents", ["user_id"], name: "index_documents_on_user_id", using: :btree - create_table "failed_census_calls", force: :cascade do |t| t.integer "user_id" t.string "document_number" @@ -509,34 +482,31 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "district_code" t.integer "poll_officer_id" t.integer "year_of_birth" + t.index ["user_id"], name: "index_failed_census_calls_on_user_id", using: :btree end - add_index "failed_census_calls", ["user_id"], name: "index_failed_census_calls_on_user_id", using: :btree - create_table "flags", force: :cascade do |t| t.integer "user_id" t.string "flaggable_type" t.integer "flaggable_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["flaggable_type", "flaggable_id"], name: "index_flags_on_flaggable_type_and_flaggable_id", using: :btree + t.index ["user_id", "flaggable_type", "flaggable_id"], name: "access_inappropiate_flags", using: :btree + t.index ["user_id"], name: "index_flags_on_user_id", using: :btree end - add_index "flags", ["flaggable_type", "flaggable_id"], name: "index_flags_on_flaggable_type_and_flaggable_id", using: :btree - add_index "flags", ["user_id", "flaggable_type", "flaggable_id"], name: "access_inappropiate_flags", using: :btree - add_index "flags", ["user_id"], name: "index_flags_on_user_id", using: :btree - create_table "follows", force: :cascade do |t| t.integer "user_id" - t.integer "followable_id" t.string "followable_type" + t.integer "followable_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["followable_type", "followable_id"], name: "index_follows_on_followable_type_and_followable_id", using: :btree + t.index ["user_id", "followable_type", "followable_id"], name: "access_follows", using: :btree + t.index ["user_id"], name: "index_follows_on_user_id", using: :btree end - add_index "follows", ["followable_type", "followable_id"], name: "index_follows_on_followable_type_and_followable_id", using: :btree - add_index "follows", ["user_id", "followable_type", "followable_id"], name: "access_follows", using: :btree - add_index "follows", ["user_id"], name: "index_follows_on_user_id", using: :btree - create_table "geozones", force: :cascade do |t| t.string "name" t.string "html_map_coordinates" @@ -549,22 +519,20 @@ ActiveRecord::Schema.define(version: 20190205131722) do create_table "geozones_polls", force: :cascade do |t| t.integer "geozone_id" t.integer "poll_id" + t.index ["geozone_id"], name: "index_geozones_polls_on_geozone_id", using: :btree + t.index ["poll_id"], name: "index_geozones_polls_on_poll_id", using: :btree end - add_index "geozones_polls", ["geozone_id"], name: "index_geozones_polls_on_geozone_id", using: :btree - add_index "geozones_polls", ["poll_id"], name: "index_geozones_polls_on_poll_id", using: :btree - create_table "i18n_content_translations", force: :cascade do |t| t.integer "i18n_content_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "value" + t.index ["i18n_content_id"], name: "index_i18n_content_translations_on_i18n_content_id", using: :btree + t.index ["locale"], name: "index_i18n_content_translations_on_locale", using: :btree end - add_index "i18n_content_translations", ["i18n_content_id"], name: "index_i18n_content_translations_on_i18n_content_id", using: :btree - add_index "i18n_content_translations", ["locale"], name: "index_i18n_content_translations_on_locale", using: :btree - create_table "i18n_contents", force: :cascade do |t| t.string "key" end @@ -575,13 +543,12 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "uid" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_identities_on_user_id", using: :btree end - add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree - create_table "images", force: :cascade do |t| - t.integer "imageable_id" t.string "imageable_type" + t.integer "imageable_id" t.string "title", limit: 80 t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -590,11 +557,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "attachment_file_size" t.datetime "attachment_updated_at" t.integer "user_id" + t.index ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id", using: :btree + t.index ["user_id"], name: "index_images_on_user_id", using: :btree end - add_index "images", ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id", using: :btree - add_index "images", ["user_id"], name: "index_images_on_user_id", using: :btree - create_table "legislation_annotations", force: :cascade do |t| t.string "quote" t.text "ranges" @@ -610,13 +576,12 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "range_end" t.integer "range_end_offset" t.text "context" + t.index ["author_id"], name: "index_legislation_annotations_on_author_id", using: :btree + t.index ["hidden_at"], name: "index_legislation_annotations_on_hidden_at", using: :btree + t.index ["legislation_draft_version_id"], name: "index_legislation_annotations_on_legislation_draft_version_id", using: :btree + t.index ["range_start", "range_end"], name: "index_legislation_annotations_on_range_start_and_range_end", using: :btree end - add_index "legislation_annotations", ["author_id"], name: "index_legislation_annotations_on_author_id", using: :btree - add_index "legislation_annotations", ["hidden_at"], name: "index_legislation_annotations_on_hidden_at", using: :btree - add_index "legislation_annotations", ["legislation_draft_version_id"], name: "index_legislation_annotations_on_legislation_draft_version_id", using: :btree - add_index "legislation_annotations", ["range_start", "range_end"], name: "index_legislation_annotations_on_range_start_and_range_end", using: :btree - create_table "legislation_answers", force: :cascade do |t| t.integer "legislation_question_id" t.integer "legislation_question_option_id" @@ -624,13 +589,12 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "hidden_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["hidden_at"], name: "index_legislation_answers_on_hidden_at", using: :btree + t.index ["legislation_question_id"], name: "index_legislation_answers_on_legislation_question_id", using: :btree + t.index ["legislation_question_option_id"], name: "index_legislation_answers_on_legislation_question_option_id", using: :btree + t.index ["user_id"], name: "index_legislation_answers_on_user_id", using: :btree end - add_index "legislation_answers", ["hidden_at"], name: "index_legislation_answers_on_hidden_at", using: :btree - add_index "legislation_answers", ["legislation_question_id"], name: "index_legislation_answers_on_legislation_question_id", using: :btree - add_index "legislation_answers", ["legislation_question_option_id"], name: "index_legislation_answers_on_legislation_question_option_id", using: :btree - add_index "legislation_answers", ["user_id"], name: "index_legislation_answers_on_user_id", using: :btree - create_table "legislation_draft_version_translations", force: :cascade do |t| t.integer "legislation_draft_version_id", null: false t.string "locale", null: false @@ -641,11 +605,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.text "body" t.text "body_html" t.text "toc_html" + t.index ["legislation_draft_version_id"], name: "index_900e5ba94457606e69e89193db426e8ddff809bc", using: :btree + t.index ["locale"], name: "index_legislation_draft_version_translations_on_locale", using: :btree end - add_index "legislation_draft_version_translations", ["legislation_draft_version_id"], name: "index_900e5ba94457606e69e89193db426e8ddff809bc", using: :btree - add_index "legislation_draft_version_translations", ["locale"], name: "index_legislation_draft_version_translations_on_locale", using: :btree - create_table "legislation_draft_versions", force: :cascade do |t| t.integer "legislation_process_id" t.string "title" @@ -658,12 +621,11 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.text "body_html" t.text "toc_html" + t.index ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at", using: :btree + t.index ["legislation_process_id"], name: "index_legislation_draft_versions_on_legislation_process_id", using: :btree + t.index ["status"], name: "index_legislation_draft_versions_on_status", using: :btree end - add_index "legislation_draft_versions", ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at", using: :btree - add_index "legislation_draft_versions", ["legislation_process_id"], name: "index_legislation_draft_versions_on_legislation_process_id", using: :btree - add_index "legislation_draft_versions", ["status"], name: "index_legislation_draft_versions_on_status", using: :btree - create_table "legislation_process_translations", force: :cascade do |t| t.integer "legislation_process_id", null: false t.string "locale", null: false @@ -675,11 +637,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.text "additional_info" t.text "milestones_summary" t.text "homepage" + t.index ["legislation_process_id"], name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55", using: :btree + t.index ["locale"], name: "index_legislation_process_translations_on_locale", using: :btree end - add_index "legislation_process_translations", ["legislation_process_id"], name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55", using: :btree - add_index "legislation_process_translations", ["locale"], name: "index_legislation_process_translations_on_locale", using: :btree - create_table "legislation_processes", force: :cascade do |t| t.string "title" t.text "description" @@ -711,20 +672,19 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.boolean "homepage_enabled", default: false t.text "background_color" t.text "font_color" + t.index ["allegations_end_date"], name: "index_legislation_processes_on_allegations_end_date", using: :btree + t.index ["allegations_start_date"], name: "index_legislation_processes_on_allegations_start_date", using: :btree + t.index ["debate_end_date"], name: "index_legislation_processes_on_debate_end_date", using: :btree + t.index ["debate_start_date"], name: "index_legislation_processes_on_debate_start_date", using: :btree + t.index ["draft_end_date"], name: "index_legislation_processes_on_draft_end_date", using: :btree + t.index ["draft_publication_date"], name: "index_legislation_processes_on_draft_publication_date", using: :btree + t.index ["draft_start_date"], name: "index_legislation_processes_on_draft_start_date", using: :btree + t.index ["end_date"], name: "index_legislation_processes_on_end_date", using: :btree + t.index ["hidden_at"], name: "index_legislation_processes_on_hidden_at", using: :btree + t.index ["result_publication_date"], name: "index_legislation_processes_on_result_publication_date", using: :btree + t.index ["start_date"], name: "index_legislation_processes_on_start_date", using: :btree end - add_index "legislation_processes", ["allegations_end_date"], name: "index_legislation_processes_on_allegations_end_date", using: :btree - add_index "legislation_processes", ["allegations_start_date"], name: "index_legislation_processes_on_allegations_start_date", using: :btree - add_index "legislation_processes", ["debate_end_date"], name: "index_legislation_processes_on_debate_end_date", using: :btree - add_index "legislation_processes", ["debate_start_date"], name: "index_legislation_processes_on_debate_start_date", using: :btree - add_index "legislation_processes", ["draft_end_date"], name: "index_legislation_processes_on_draft_end_date", using: :btree - add_index "legislation_processes", ["draft_publication_date"], name: "index_legislation_processes_on_draft_publication_date", using: :btree - add_index "legislation_processes", ["draft_start_date"], name: "index_legislation_processes_on_draft_start_date", using: :btree - add_index "legislation_processes", ["end_date"], name: "index_legislation_processes_on_end_date", using: :btree - add_index "legislation_processes", ["hidden_at"], name: "index_legislation_processes_on_hidden_at", using: :btree - add_index "legislation_processes", ["result_publication_date"], name: "index_legislation_processes_on_result_publication_date", using: :btree - add_index "legislation_processes", ["start_date"], name: "index_legislation_processes_on_start_date", using: :btree - create_table "legislation_proposals", force: :cascade do |t| t.integer "legislation_process_id" t.string "title", limit: 80 @@ -738,7 +698,7 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "cached_votes_up", default: 0 t.integer "comments_count", default: 0 t.datetime "confirmed_hide_at" - t.integer "hot_score", limit: 8, default: 0 + t.bigint "hot_score", default: 0 t.integer "confidence_score", default: 0 t.string "responsible_name", limit: 60 t.text "summary" @@ -755,22 +715,20 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "cached_votes_down", default: 0 t.boolean "selected" t.integer "cached_votes_score", default: 0 + t.index ["cached_votes_score"], name: "index_legislation_proposals_on_cached_votes_score", using: :btree + t.index ["legislation_process_id"], name: "index_legislation_proposals_on_legislation_process_id", using: :btree end - add_index "legislation_proposals", ["cached_votes_score"], name: "index_legislation_proposals_on_cached_votes_score", using: :btree - add_index "legislation_proposals", ["legislation_process_id"], name: "index_legislation_proposals_on_legislation_process_id", using: :btree - create_table "legislation_question_option_translations", force: :cascade do |t| t.integer "legislation_question_option_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "value" + t.index ["legislation_question_option_id"], name: "index_61bcec8729110b7f8e1e9e5ce08780878597a209", using: :btree + t.index ["locale"], name: "index_legislation_question_option_translations_on_locale", using: :btree end - add_index "legislation_question_option_translations", ["legislation_question_option_id"], name: "index_61bcec8729110b7f8e1e9e5ce08780878597a209", using: :btree - add_index "legislation_question_option_translations", ["locale"], name: "index_legislation_question_option_translations_on_locale", using: :btree - create_table "legislation_question_options", force: :cascade do |t| t.integer "legislation_question_id" t.string "value" @@ -778,22 +736,20 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "hidden_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["hidden_at"], name: "index_legislation_question_options_on_hidden_at", using: :btree + t.index ["legislation_question_id"], name: "index_legislation_question_options_on_legislation_question_id", using: :btree end - add_index "legislation_question_options", ["hidden_at"], name: "index_legislation_question_options_on_hidden_at", using: :btree - add_index "legislation_question_options", ["legislation_question_id"], name: "index_legislation_question_options_on_legislation_question_id", using: :btree - create_table "legislation_question_translations", force: :cascade do |t| t.integer "legislation_question_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "title" + t.index ["legislation_question_id"], name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3", using: :btree + t.index ["locale"], name: "index_legislation_question_translations_on_locale", using: :btree end - add_index "legislation_question_translations", ["legislation_question_id"], name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3", using: :btree - add_index "legislation_question_translations", ["locale"], name: "index_legislation_question_translations_on_locale", using: :btree - create_table "legislation_questions", force: :cascade do |t| t.integer "legislation_process_id" t.text "title" @@ -803,11 +759,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.integer "comments_count", default: 0 t.integer "author_id" + t.index ["hidden_at"], name: "index_legislation_questions_on_hidden_at", using: :btree + t.index ["legislation_process_id"], name: "index_legislation_questions_on_legislation_process_id", using: :btree end - add_index "legislation_questions", ["hidden_at"], name: "index_legislation_questions_on_hidden_at", using: :btree - add_index "legislation_questions", ["legislation_process_id"], name: "index_legislation_questions_on_legislation_process_id", using: :btree - create_table "local_census_records", force: :cascade do |t| t.string "document_number", null: false t.string "document_type", null: false @@ -823,37 +778,33 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "locked_until", default: '2000-01-01 01:01:01', null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_locks_on_user_id", using: :btree end - add_index "locks", ["user_id"], name: "index_locks_on_user_id", using: :btree - create_table "managers", force: :cascade do |t| t.integer "user_id" + t.index ["user_id"], name: "index_managers_on_user_id", using: :btree end - add_index "managers", ["user_id"], name: "index_managers_on_user_id", using: :btree - create_table "map_locations", force: :cascade do |t| t.float "latitude" t.float "longitude" t.integer "zoom" t.integer "proposal_id" t.integer "investment_id" + t.index ["investment_id"], name: "index_map_locations_on_investment_id", using: :btree + t.index ["proposal_id"], name: "index_map_locations_on_proposal_id", using: :btree end - add_index "map_locations", ["investment_id"], name: "index_map_locations_on_investment_id", using: :btree - add_index "map_locations", ["proposal_id"], name: "index_map_locations_on_proposal_id", using: :btree - create_table "milestone_statuses", force: :cascade do |t| t.string "name" t.text "description" t.datetime "hidden_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["hidden_at"], name: "index_milestone_statuses_on_hidden_at", using: :btree end - add_index "milestone_statuses", ["hidden_at"], name: "index_milestone_statuses_on_hidden_at", using: :btree - create_table "milestone_translations", force: :cascade do |t| t.integer "milestone_id", null: false t.string "locale", null: false @@ -861,30 +812,27 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.string "title" t.text "description" + t.index ["locale"], name: "index_milestone_translations_on_locale", using: :btree + t.index ["milestone_id"], name: "index_milestone_translations_on_milestone_id", using: :btree end - add_index "milestone_translations", ["locale"], name: "index_milestone_translations_on_locale", using: :btree - add_index "milestone_translations", ["milestone_id"], name: "index_milestone_translations_on_milestone_id", using: :btree - create_table "milestones", force: :cascade do |t| - t.integer "milestoneable_id" t.string "milestoneable_type" + t.integer "milestoneable_id" t.string "title", limit: 80 t.text "description" t.datetime "publication_date" t.integer "status_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["status_id"], name: "index_milestones_on_status_id", using: :btree end - add_index "milestones", ["status_id"], name: "index_milestones_on_status_id", using: :btree - create_table "moderators", force: :cascade do |t| t.integer "user_id" + t.index ["user_id"], name: "index_moderators_on_user_id", using: :btree end - add_index "moderators", ["user_id"], name: "index_moderators_on_user_id", using: :btree - create_table "newsletters", force: :cascade do |t| t.string "subject" t.string "segment_recipient", null: false @@ -898,48 +846,44 @@ ActiveRecord::Schema.define(version: 20190205131722) do create_table "notifications", force: :cascade do |t| t.integer "user_id" - t.integer "notifiable_id" t.string "notifiable_type" + t.integer "notifiable_id" t.integer "counter", default: 1 t.datetime "emailed_at" t.datetime "read_at" + t.index ["user_id"], name: "index_notifications_on_user_id", using: :btree end - add_index "notifications", ["user_id"], name: "index_notifications_on_user_id", using: :btree - create_table "organizations", force: :cascade do |t| t.integer "user_id" t.string "name", limit: 60 t.datetime "verified_at" t.datetime "rejected_at" t.string "responsible_name", limit: 60 + t.index ["user_id"], name: "index_organizations_on_user_id", using: :btree end - add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree - create_table "poll_answers", force: :cascade do |t| t.integer "question_id" t.integer "author_id" t.string "answer" t.datetime "created_at" t.datetime "updated_at" + t.index ["author_id"], name: "index_poll_answers_on_author_id", using: :btree + t.index ["question_id", "answer"], name: "index_poll_answers_on_question_id_and_answer", using: :btree + t.index ["question_id"], name: "index_poll_answers_on_question_id", using: :btree end - add_index "poll_answers", ["author_id"], name: "index_poll_answers_on_author_id", using: :btree - add_index "poll_answers", ["question_id", "answer"], name: "index_poll_answers_on_question_id_and_answer", using: :btree - add_index "poll_answers", ["question_id"], name: "index_poll_answers_on_question_id", using: :btree - create_table "poll_ballot_sheets", force: :cascade do |t| t.text "data" t.integer "poll_id" t.integer "officer_assignment_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["officer_assignment_id"], name: "index_poll_ballot_sheets_on_officer_assignment_id", using: :btree + t.index ["poll_id"], name: "index_poll_ballot_sheets_on_poll_id", using: :btree end - add_index "poll_ballot_sheets", ["officer_assignment_id"], name: "index_poll_ballot_sheets_on_officer_assignment_id", using: :btree - add_index "poll_ballot_sheets", ["poll_id"], name: "index_poll_ballot_sheets_on_poll_id", using: :btree - create_table "poll_ballots", force: :cascade do |t| t.integer "ballot_sheet_id" t.text "data" @@ -953,11 +897,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "poll_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["booth_id"], name: "index_poll_booth_assignments_on_booth_id", using: :btree + t.index ["poll_id"], name: "index_poll_booth_assignments_on_poll_id", using: :btree end - add_index "poll_booth_assignments", ["booth_id"], name: "index_poll_booth_assignments_on_booth_id", using: :btree - add_index "poll_booth_assignments", ["poll_id"], name: "index_poll_booth_assignments_on_poll_id", using: :btree - create_table "poll_booths", force: :cascade do |t| t.string "name" t.string "location" @@ -971,18 +914,16 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.date "date", null: false t.boolean "final", default: false t.string "user_data_log", default: "" + t.index ["booth_assignment_id"], name: "index_poll_officer_assignments_on_booth_assignment_id", using: :btree + t.index ["officer_id"], name: "index_poll_officer_assignments_on_officer_id", using: :btree end - add_index "poll_officer_assignments", ["booth_assignment_id"], name: "index_poll_officer_assignments_on_booth_assignment_id", using: :btree - add_index "poll_officer_assignments", ["officer_id"], name: "index_poll_officer_assignments_on_officer_id", using: :btree - create_table "poll_officers", force: :cascade do |t| t.integer "user_id" t.integer "failed_census_calls_count", default: 0 + t.index ["user_id"], name: "index_poll_officers_on_user_id", using: :btree end - add_index "poll_officers", ["user_id"], name: "index_poll_officers_on_user_id", using: :btree - create_table "poll_partial_results", force: :cascade do |t| t.integer "question_id" t.integer "author_id" @@ -995,14 +936,13 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.text "amount_log", default: "" t.text "officer_assignment_id_log", default: "" t.text "author_id_log", default: "" + t.index ["answer"], name: "index_poll_partial_results_on_answer", using: :btree + t.index ["author_id"], name: "index_poll_partial_results_on_author_id", using: :btree + t.index ["booth_assignment_id", "date"], name: "index_poll_partial_results_on_booth_assignment_id_and_date", using: :btree + t.index ["origin"], name: "index_poll_partial_results_on_origin", using: :btree + t.index ["question_id"], name: "index_poll_partial_results_on_question_id", using: :btree end - add_index "poll_partial_results", ["answer"], name: "index_poll_partial_results_on_answer", using: :btree - add_index "poll_partial_results", ["author_id"], name: "index_poll_partial_results_on_author_id", using: :btree - add_index "poll_partial_results", ["booth_assignment_id", "date"], name: "index_poll_partial_results_on_booth_assignment_id_and_date", using: :btree - add_index "poll_partial_results", ["origin"], name: "index_poll_partial_results_on_origin", using: :btree - add_index "poll_partial_results", ["question_id"], name: "index_poll_partial_results_on_question_id", using: :btree - create_table "poll_question_answer_translations", force: :cascade do |t| t.integer "poll_question_answer_id", null: false t.string "locale", null: false @@ -1010,40 +950,36 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.string "title" t.text "description" + t.index ["locale"], name: "index_poll_question_answer_translations_on_locale", using: :btree + t.index ["poll_question_answer_id"], name: "index_85270fa85f62081a3a227186b4c95fe4f7fa94b9", using: :btree end - add_index "poll_question_answer_translations", ["locale"], name: "index_poll_question_answer_translations_on_locale", using: :btree - add_index "poll_question_answer_translations", ["poll_question_answer_id"], name: "index_85270fa85f62081a3a227186b4c95fe4f7fa94b9", using: :btree - create_table "poll_question_answer_videos", force: :cascade do |t| t.string "title" t.string "url" t.integer "answer_id" + t.index ["answer_id"], name: "index_poll_question_answer_videos_on_answer_id", using: :btree end - add_index "poll_question_answer_videos", ["answer_id"], name: "index_poll_question_answer_videos_on_answer_id", using: :btree - create_table "poll_question_answers", force: :cascade do |t| t.string "title" t.text "description" t.integer "question_id" t.integer "given_order", default: 1 t.boolean "most_voted", default: false + t.index ["question_id"], name: "index_poll_question_answers_on_question_id", using: :btree end - add_index "poll_question_answers", ["question_id"], name: "index_poll_question_answers_on_question_id", using: :btree - create_table "poll_question_translations", force: :cascade do |t| t.integer "poll_question_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" + t.index ["locale"], name: "index_poll_question_translations_on_locale", using: :btree + t.index ["poll_question_id"], name: "index_poll_question_translations_on_poll_question_id", using: :btree end - add_index "poll_question_translations", ["locale"], name: "index_poll_question_translations_on_locale", using: :btree - add_index "poll_question_translations", ["poll_question_id"], name: "index_poll_question_translations_on_poll_question_id", using: :btree - create_table "poll_questions", force: :cascade do |t| t.integer "proposal_id" t.integer "poll_id" @@ -1056,13 +992,12 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at" t.tsvector "tsv" t.string "video_url" + t.index ["author_id"], name: "index_poll_questions_on_author_id", using: :btree + t.index ["poll_id"], name: "index_poll_questions_on_poll_id", using: :btree + t.index ["proposal_id"], name: "index_poll_questions_on_proposal_id", using: :btree + t.index ["tsv"], name: "index_poll_questions_on_tsv", using: :gin end - add_index "poll_questions", ["author_id"], name: "index_poll_questions_on_author_id", using: :btree - add_index "poll_questions", ["poll_id"], name: "index_poll_questions_on_poll_id", using: :btree - add_index "poll_questions", ["proposal_id"], name: "index_poll_questions_on_proposal_id", using: :btree - add_index "poll_questions", ["tsv"], name: "index_poll_questions_on_tsv", using: :gin - create_table "poll_recounts", force: :cascade do |t| t.integer "author_id" t.string "origin" @@ -1077,11 +1012,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.text "null_amount_log", default: "" t.integer "total_amount", default: 0 t.text "total_amount_log", default: "" + t.index ["booth_assignment_id"], name: "index_poll_recounts_on_booth_assignment_id", using: :btree + t.index ["officer_assignment_id"], name: "index_poll_recounts_on_officer_assignment_id", using: :btree end - add_index "poll_recounts", ["booth_assignment_id"], name: "index_poll_recounts_on_booth_assignment_id", using: :btree - add_index "poll_recounts", ["officer_assignment_id"], name: "index_poll_recounts_on_officer_assignment_id", using: :btree - create_table "poll_shifts", force: :cascade do |t| t.integer "booth_id" t.integer "officer_id" @@ -1091,12 +1025,11 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "officer_name" t.string "officer_email" t.integer "task", default: 0, null: false + t.index ["booth_id", "officer_id", "date", "task"], name: "index_poll_shifts_on_booth_id_and_officer_id_and_date_and_task", unique: true, using: :btree + t.index ["booth_id"], name: "index_poll_shifts_on_booth_id", using: :btree + t.index ["officer_id"], name: "index_poll_shifts_on_officer_id", using: :btree end - add_index "poll_shifts", ["booth_id", "officer_id", "date", "task"], name: "index_poll_shifts_on_booth_id_and_officer_id_and_date_and_task", unique: true, using: :btree - add_index "poll_shifts", ["booth_id"], name: "index_poll_shifts_on_booth_id", using: :btree - add_index "poll_shifts", ["officer_id"], name: "index_poll_shifts_on_officer_id", using: :btree - create_table "poll_translations", force: :cascade do |t| t.integer "poll_id", null: false t.string "locale", null: false @@ -1105,11 +1038,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "name" t.text "summary" t.text "description" + t.index ["locale"], name: "index_poll_translations_on_locale", using: :btree + t.index ["poll_id"], name: "index_poll_translations_on_poll_id", using: :btree end - add_index "poll_translations", ["locale"], name: "index_poll_translations_on_locale", using: :btree - add_index "poll_translations", ["poll_id"], name: "index_poll_translations_on_poll_id", using: :btree - create_table "poll_voters", force: :cascade do |t| t.string "document_number" t.string "document_type" @@ -1126,15 +1058,14 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "origin" t.integer "officer_id" t.string "token" + t.index ["booth_assignment_id"], name: "index_poll_voters_on_booth_assignment_id", using: :btree + t.index ["document_number"], name: "index_poll_voters_on_document_number", using: :btree + t.index ["officer_assignment_id"], name: "index_poll_voters_on_officer_assignment_id", using: :btree + t.index ["poll_id", "document_number", "document_type"], name: "doc_by_poll", using: :btree + t.index ["poll_id"], name: "index_poll_voters_on_poll_id", using: :btree + t.index ["user_id"], name: "index_poll_voters_on_user_id", using: :btree end - add_index "poll_voters", ["booth_assignment_id"], name: "index_poll_voters_on_booth_assignment_id", using: :btree - add_index "poll_voters", ["document_number"], name: "index_poll_voters_on_document_number", using: :btree - add_index "poll_voters", ["officer_assignment_id"], name: "index_poll_voters_on_officer_assignment_id", using: :btree - add_index "poll_voters", ["poll_id", "document_number", "document_type"], name: "doc_by_poll", using: :btree - add_index "poll_voters", ["poll_id"], name: "index_poll_voters_on_poll_id", using: :btree - add_index "poll_voters", ["user_id"], name: "index_poll_voters_on_user_id", using: :btree - create_table "polls", force: :cascade do |t| t.string "name" t.datetime "starts_at" @@ -1151,27 +1082,25 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "created_at" t.datetime "updated_at" t.integer "budget_id" + t.index ["budget_id"], name: "index_polls_on_budget_id", unique: true, using: :btree + t.index ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at", using: :btree end - add_index "polls", ["budget_id"], name: "index_polls_on_budget_id", unique: true, using: :btree - add_index "polls", ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at", using: :btree - create_table "progress_bar_translations", force: :cascade do |t| t.integer "progress_bar_id", null: false t.string "locale", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "title" + t.index ["locale"], name: "index_progress_bar_translations_on_locale", using: :btree + t.index ["progress_bar_id"], name: "index_progress_bar_translations_on_progress_bar_id", using: :btree end - add_index "progress_bar_translations", ["locale"], name: "index_progress_bar_translations_on_locale", using: :btree - add_index "progress_bar_translations", ["progress_bar_id"], name: "index_progress_bar_translations_on_progress_bar_id", using: :btree - create_table "progress_bars", force: :cascade do |t| t.integer "kind" t.integer "percentage" - t.integer "progressable_id" t.string "progressable_type" + t.integer "progressable_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false end @@ -1201,7 +1130,7 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "cached_votes_up", default: 0 t.integer "comments_count", default: 0 t.datetime "confirmed_hide_at" - t.integer "hot_score", limit: 8, default: 0 + t.bigint "hot_score", default: 0 t.integer "confidence_score", default: 0 t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -1214,60 +1143,56 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "retired_reason" t.text "retired_explanation" t.integer "community_id" + t.index ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree + t.index ["author_id"], name: "index_proposals_on_author_id", using: :btree + t.index ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree + t.index ["community_id"], name: "index_proposals_on_community_id", using: :btree + t.index ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree + t.index ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree + t.index ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree + t.index ["hot_score"], name: "index_proposals_on_hot_score", using: :btree + t.index ["question"], name: "index_proposals_on_question", using: :btree + t.index ["summary"], name: "index_proposals_on_summary", using: :btree + t.index ["title"], name: "index_proposals_on_title", using: :btree + t.index ["tsv"], name: "index_proposals_on_tsv", using: :gin end - add_index "proposals", ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree - add_index "proposals", ["author_id"], name: "index_proposals_on_author_id", using: :btree - add_index "proposals", ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree - add_index "proposals", ["community_id"], name: "index_proposals_on_community_id", using: :btree - add_index "proposals", ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree - add_index "proposals", ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree - add_index "proposals", ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree - add_index "proposals", ["hot_score"], name: "index_proposals_on_hot_score", using: :btree - add_index "proposals", ["question"], name: "index_proposals_on_question", using: :btree - add_index "proposals", ["summary"], name: "index_proposals_on_summary", using: :btree - add_index "proposals", ["title"], name: "index_proposals_on_title", using: :btree - add_index "proposals", ["tsv"], name: "index_proposals_on_tsv", using: :gin - create_table "related_content_scores", force: :cascade do |t| t.integer "user_id" t.integer "related_content_id" t.integer "value" + t.index ["related_content_id"], name: "index_related_content_scores_on_related_content_id", using: :btree + t.index ["user_id", "related_content_id"], name: "unique_user_related_content_scoring", unique: true, using: :btree + t.index ["user_id"], name: "index_related_content_scores_on_user_id", using: :btree end - add_index "related_content_scores", ["related_content_id"], name: "index_related_content_scores_on_related_content_id", using: :btree - add_index "related_content_scores", ["user_id", "related_content_id"], name: "unique_user_related_content_scoring", unique: true, using: :btree - add_index "related_content_scores", ["user_id"], name: "index_related_content_scores_on_user_id", using: :btree - create_table "related_contents", force: :cascade do |t| - t.integer "parent_relationable_id" t.string "parent_relationable_type" - t.integer "child_relationable_id" + t.integer "parent_relationable_id" t.string "child_relationable_type" + t.integer "child_relationable_id" t.integer "related_content_id" t.datetime "created_at" t.datetime "updated_at" t.datetime "hidden_at" t.integer "related_content_scores_count", default: 0 t.integer "author_id" + t.index ["child_relationable_type", "child_relationable_id"], name: "index_related_contents_on_child_relationable", using: :btree + t.index ["hidden_at"], name: "index_related_contents_on_hidden_at", using: :btree + t.index ["parent_relationable_id", "parent_relationable_type", "child_relationable_id", "child_relationable_type"], name: "unique_parent_child_related_content", unique: true, using: :btree + t.index ["parent_relationable_type", "parent_relationable_id"], name: "index_related_contents_on_parent_relationable", using: :btree + t.index ["related_content_id"], name: "opposite_related_content", using: :btree end - add_index "related_contents", ["child_relationable_type", "child_relationable_id"], name: "index_related_contents_on_child_relationable", using: :btree - add_index "related_contents", ["hidden_at"], name: "index_related_contents_on_hidden_at", using: :btree - add_index "related_contents", ["parent_relationable_id", "parent_relationable_type", "child_relationable_id", "child_relationable_type"], name: "unique_parent_child_related_content", unique: true, using: :btree - add_index "related_contents", ["parent_relationable_type", "parent_relationable_id"], name: "index_related_contents_on_parent_relationable", using: :btree - add_index "related_contents", ["related_content_id"], name: "opposite_related_content", using: :btree - create_table "settings", force: :cascade do |t| t.string "key" t.string "value" + t.index ["key"], name: "index_settings_on_key", using: :btree end - add_index "settings", ["key"], name: "index_settings_on_key", using: :btree - create_table "signature_sheets", force: :cascade do |t| - t.integer "signable_id" t.string "signable_type" + t.integer "signable_id" t.text "document_numbers" t.boolean "processed", default: false t.integer "author_id" @@ -1290,10 +1215,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.text "body" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["name", "locale"], name: "index_site_customization_content_blocks_on_name_and_locale", unique: true, using: :btree end - add_index "site_customization_content_blocks", ["name", "locale"], name: "index_site_customization_content_blocks_on_name_and_locale", unique: true, using: :btree - create_table "site_customization_images", force: :cascade do |t| t.string "name", null: false t.string "image_file_name" @@ -1302,10 +1226,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "image_updated_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["name"], name: "index_site_customization_images_on_name", unique: true, using: :btree end - add_index "site_customization_images", ["name"], name: "index_site_customization_images_on_name", unique: true, using: :btree - create_table "site_customization_page_translations", force: :cascade do |t| t.integer "site_customization_page_id", null: false t.string "locale", null: false @@ -1314,11 +1237,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "title" t.string "subtitle" t.text "content" + t.index ["locale"], name: "index_site_customization_page_translations_on_locale", using: :btree + t.index ["site_customization_page_id"], name: "index_7fa0f9505738cb31a31f11fb2f4c4531fed7178b", using: :btree end - add_index "site_customization_page_translations", ["locale"], name: "index_site_customization_page_translations_on_locale", using: :btree - add_index "site_customization_page_translations", ["site_customization_page_id"], name: "index_7fa0f9505738cb31a31f11fb2f4c4531fed7178b", using: :btree - create_table "site_customization_pages", force: :cascade do |t| t.string "slug", null: false t.string "title" @@ -1340,7 +1262,7 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "geozone_id" - t.integer "price", limit: 8 + t.bigint "price" t.boolean "feasible" t.string "association_name" t.text "price_explanation" @@ -1350,32 +1272,30 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.text "explanations_log" t.integer "administrator_id" t.integer "valuation_assignments_count", default: 0 - t.integer "price_first_year", limit: 8 + t.bigint "price_first_year" t.string "time_scope" t.datetime "unfeasible_email_sent_at" t.integer "cached_votes_up", default: 0 t.tsvector "tsv" t.string "responsible_name", limit: 60 t.integer "physical_votes", default: 0 + t.index ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree + t.index ["geozone_id"], name: "index_spending_proposals_on_geozone_id", using: :btree + t.index ["tsv"], name: "index_spending_proposals_on_tsv", using: :gin end - add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree - add_index "spending_proposals", ["geozone_id"], name: "index_spending_proposals_on_geozone_id", using: :btree - add_index "spending_proposals", ["tsv"], name: "index_spending_proposals_on_tsv", using: :gin - create_table "taggings", force: :cascade do |t| t.integer "tag_id" - t.integer "taggable_id" t.string "taggable_type" - t.integer "tagger_id" + t.integer "taggable_id" t.string "tagger_type" + t.integer "tagger_id" t.string "context", limit: 128 t.datetime "created_at" + t.index ["tag_id"], name: "index_taggings_on_tag_id", using: :btree + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree end - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree - create_table "tags", force: :cascade do |t| t.string "name", limit: 160 t.integer "taggings_count", default: 0 @@ -1386,15 +1306,14 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "budget/investments_count", default: 0 t.integer "legislation/proposals_count", default: 0 t.integer "legislation/processes_count", default: 0 + t.index ["debates_count"], name: "index_tags_on_debates_count", using: :btree + t.index ["legislation/processes_count"], name: "index_tags_on_legislation/processes_count", using: :btree + t.index ["legislation/proposals_count"], name: "index_tags_on_legislation/proposals_count", using: :btree + t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree + t.index ["proposals_count"], name: "index_tags_on_proposals_count", using: :btree + t.index ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree end - add_index "tags", ["debates_count"], name: "index_tags_on_debates_count", using: :btree - add_index "tags", ["legislation/processes_count"], name: "index_tags_on_legislation/processes_count", using: :btree - add_index "tags", ["legislation/proposals_count"], name: "index_tags_on_legislation/proposals_count", using: :btree - add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree - add_index "tags", ["proposals_count"], name: "index_tags_on_proposals_count", using: :btree - add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree - create_table "topics", force: :cascade do |t| t.string "title", null: false t.text "description" @@ -1404,11 +1323,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "hidden_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["community_id"], name: "index_topics_on_community_id", using: :btree + t.index ["hidden_at"], name: "index_topics_on_hidden_at", using: :btree end - add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree - add_index "topics", ["hidden_at"], name: "index_topics_on_hidden_at", using: :btree - create_table "users", force: :cascade do |t| t.string "email", default: "" t.string "encrypted_password", default: "", null: false @@ -1470,16 +1388,15 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.boolean "public_interests", default: false t.boolean "recommended_debates", default: true t.boolean "recommended_proposals", default: true + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree + t.index ["email"], name: "index_users_on_email", unique: true, using: :btree + t.index ["geozone_id"], name: "index_users_on_geozone_id", using: :btree + t.index ["hidden_at"], name: "index_users_on_hidden_at", using: :btree + t.index ["password_changed_at"], name: "index_users_on_password_changed_at", using: :btree + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree + t.index ["username"], name: "index_users_on_username", using: :btree end - add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["geozone_id"], name: "index_users_on_geozone_id", using: :btree - add_index "users", ["hidden_at"], name: "index_users_on_hidden_at", using: :btree - add_index "users", ["password_changed_at"], name: "index_users_on_password_changed_at", using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - add_index "users", ["username"], name: "index_users_on_username", using: :btree - create_table "valuation_assignments", force: :cascade do |t| t.integer "valuator_id" t.integer "spending_proposal_id" @@ -1498,10 +1415,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.integer "spending_proposals_count", default: 0 t.integer "budget_investments_count", default: 0 t.integer "valuator_group_id" + t.index ["user_id"], name: "index_valuators_on_user_id", using: :btree end - add_index "valuators", ["user_id"], name: "index_valuators_on_user_id", using: :btree - create_table "verified_users", force: :cascade do |t| t.string "document_number" t.string "document_type" @@ -1509,12 +1425,11 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["document_number"], name: "index_verified_users_on_document_number", using: :btree + t.index ["email"], name: "index_verified_users_on_email", using: :btree + t.index ["phone"], name: "index_verified_users_on_phone", using: :btree end - add_index "verified_users", ["document_number"], name: "index_verified_users_on_document_number", using: :btree - add_index "verified_users", ["email"], name: "index_verified_users_on_email", using: :btree - add_index "verified_users", ["phone"], name: "index_verified_users_on_phone", using: :btree - create_table "visits", id: :uuid, default: nil, force: :cascade do |t| t.uuid "visitor_id" t.string "ip" @@ -1541,28 +1456,26 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "utm_content" t.string "utm_campaign" t.datetime "started_at" + t.index ["started_at"], name: "index_visits_on_started_at", using: :btree + t.index ["user_id"], name: "index_visits_on_user_id", using: :btree end - add_index "visits", ["started_at"], name: "index_visits_on_started_at", using: :btree - add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree - create_table "votes", force: :cascade do |t| - t.integer "votable_id" t.string "votable_type" - t.integer "voter_id" + t.integer "votable_id" t.string "voter_type" + t.integer "voter_id" t.boolean "vote_flag" t.string "vote_scope" t.integer "vote_weight" t.datetime "created_at" t.datetime "updated_at" t.integer "signature_id" + t.index ["signature_id"], name: "index_votes_on_signature_id", using: :btree + t.index ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope", using: :btree + t.index ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope", using: :btree end - add_index "votes", ["signature_id"], name: "index_votes_on_signature_id", using: :btree - add_index "votes", ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope", using: :btree - add_index "votes", ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope", using: :btree - create_table "web_sections", force: :cascade do |t| t.text "name" t.datetime "created_at", null: false @@ -1578,11 +1491,10 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.string "title" t.text "description" t.string "link_text" + t.index ["locale"], name: "index_widget_card_translations_on_locale", using: :btree + t.index ["widget_card_id"], name: "index_widget_card_translations_on_widget_card_id", using: :btree end - add_index "widget_card_translations", ["locale"], name: "index_widget_card_translations_on_locale", using: :btree - add_index "widget_card_translations", ["widget_card_id"], name: "index_widget_card_translations_on_widget_card_id", using: :btree - create_table "widget_cards", force: :cascade do |t| t.string "title" t.text "description" @@ -1594,10 +1506,9 @@ ActiveRecord::Schema.define(version: 20190205131722) do t.datetime "updated_at", null: false t.integer "site_customization_page_id" t.integer "columns", default: 4 + t.index ["site_customization_page_id"], name: "index_widget_cards_on_site_customization_page_id", using: :btree end - add_index "widget_cards", ["site_customization_page_id"], name: "index_widget_cards_on_site_customization_page_id", using: :btree - create_table "widget_feeds", force: :cascade do |t| t.string "kind" t.integer "limit", default: 3 diff --git a/spec/controllers/admin/api/stats_controller_spec.rb b/spec/controllers/admin/api/stats_controller_spec.rb index 2db94c7d3..d9a2cdeb4 100644 --- a/spec/controllers/admin/api/stats_controller_spec.rb +++ b/spec/controllers/admin/api/stats_controller_spec.rb @@ -31,7 +31,7 @@ describe Admin::Api::StatsController do it "returns single events formated for working with c3.js" do sign_in user - get :show, events: "foo" + get :show, params: { events: "foo" } expect(response).to be_ok @@ -41,7 +41,7 @@ describe Admin::Api::StatsController do it "returns combined comma separated events formated for working with c3.js" do sign_in user - get :show, events: "foo,bar" + get :show, params: { events: "foo,bar" } expect(response).to be_ok @@ -60,7 +60,7 @@ describe Admin::Api::StatsController do create :visit, started_at: time_2 sign_in user - get :show, visits: true + get :show, params: { visits: true } expect(response).to be_ok @@ -83,7 +83,7 @@ describe Admin::Api::StatsController do create :visit, started_at: time_2 sign_in user - get :show, events: "foo", visits: true + get :show, params: { events: "foo", visits: true } expect(response).to be_ok @@ -102,7 +102,7 @@ describe Admin::Api::StatsController do budget_investment3 = create(:budget_investment, budget: @budget, created_at: time_2) sign_in user - get :show, budget_investments: true + get :show, params: { budget_investments: true } expect(response).to be_ok diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index c267f3814..02f1d5c6e 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -3,36 +3,57 @@ require "rails_helper" describe CommentsController do describe "POST create" do - before do - @process = create(:legislation_process, debate_start_date: Date.current - 3.days, debate_end_date: Date.current + 2.days) - @question = create(:legislation_question, process: @process, title: "Question 1") - @user = create(:user, :level_two) - @unverified_user = create(:user) - end + + let(:legal_process) { create(:legislation_process, debate_start_date: Date.current - 3.days, + debate_end_date: Date.current + 2.days) } + let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") } + let(:user) { create(:user, :level_two) } + let(:unverified_user) { create(:user) } it "creates an comment if the comments are open" do - sign_in @user + sign_in user expect do - xhr :post, :create, comment: {commentable_id: @question.id, commentable_type: "Legislation::Question", body: "a comment"} - end.to change { @question.reload.comments_count }.by(1) + post :create, xhr: true, + params: { + comment: { + commentable_id: question.id, + commentable_type: "Legislation::Question", + body: "a comment" + } + } + end.to change { question.reload.comments_count }.by(1) end it "does not create a comment if the comments are closed" do - sign_in @user - @process.update_attribute(:debate_end_date, Date.current - 1.day) + sign_in user + legal_process.update_attribute(:debate_end_date, Date.current - 1.day) expect do - xhr :post, :create, comment: {commentable_id: @question.id, commentable_type: "Legislation::Question", body: "a comment"} - end.not_to change { @question.reload.comments_count } + post :create, xhr: true, + params: { + comment: { + commentable_id: question.id, + commentable_type: "Legislation::Question", + body: "a comment" + } + } + end.not_to change { question.reload.comments_count } end it "does not create a comment for unverified users when the commentable requires it" do - sign_in @unverified_user + sign_in unverified_user expect do - xhr :post, :create, comment: {commentable_id: @question.id, commentable_type: "Legislation::Question", body: "a comment"} - end.not_to change { @question.reload.comments_count } + post :create, xhr: true, + params: { + comment: { + commentable_id: question.id, + commentable_type: "Legislation::Question", + body: "a comment" + } + } + end.not_to change { question.reload.comments_count } end end end diff --git a/spec/controllers/concerns/has_filters_spec.rb b/spec/controllers/concerns/has_filters_spec.rb index b7d2ba870..feedbccc4 100644 --- a/spec/controllers/concerns/has_filters_spec.rb +++ b/spec/controllers/concerns/has_filters_spec.rb @@ -9,7 +9,7 @@ describe HasFilters do has_filters ["all", "pending", "reviewed"], only: :index def index - render text: "#{@current_filter} (#{@valid_filters.join(" ")})" + render plain: "#{@current_filter} (#{@valid_filters.join(" ")})" end end @@ -25,12 +25,12 @@ describe HasFilters do end it "can be changed by the filter param" do - get :index, filter: "pending" + get :index, params: { filter: "pending" } expect(response.body).to eq("pending (all pending reviewed)") end it "defaults to the first one on the list if given a bogus filter" do - get :index, filter: "foobar" + get :index, params: { filter: "foobar" } expect(response.body).to eq("all (all pending reviewed)") end end diff --git a/spec/controllers/concerns/has_orders_spec.rb b/spec/controllers/concerns/has_orders_spec.rb index 4a6f66299..f2e0abb43 100644 --- a/spec/controllers/concerns/has_orders_spec.rb +++ b/spec/controllers/concerns/has_orders_spec.rb @@ -10,11 +10,11 @@ describe HasOrders do has_orders ->(c) { ["votes_count", "flags_count"] }, only: :new def index - render text: "#{@current_order} (#{@valid_orders.join(" ")})" + render plain: "#{@current_order} (#{@valid_orders.join(" ")})" end def new - render text: "#{@current_order} (#{@valid_orders.join(" ")})" + render plain: "#{@current_order} (#{@valid_orders.join(" ")})" end end @@ -29,7 +29,7 @@ describe HasOrders do end it "displays relevance when searching" do - get :index, search: "ipsum" + get :index, params: { search: "ipsum" } expect(response.body).to eq("created_at (created_at votes_count flags_count relevance)") end @@ -37,7 +37,7 @@ describe HasOrders do get :index # Since has_orders did valid_options.delete, the first call to :index might remove 'relevance' from # the list by mistake. - get :index, search: "ipsum" + get :index, params: { search: "ipsum" } expect(response.body).to eq("created_at (created_at votes_count flags_count relevance)") end @@ -48,12 +48,12 @@ describe HasOrders do end it "can be changed by the order param" do - get :index, order: "votes_count" + get :index, params: { order: "votes_count" } expect(response.body).to eq("votes_count (created_at votes_count flags_count)") end it "defaults to the first one on the list if given a bogus order" do - get :index, order: "foobar" + get :index, params: { order: "foobar" } expect(response.body).to eq("created_at (created_at votes_count flags_count)") end end diff --git a/spec/controllers/debates_controller_spec.rb b/spec/controllers/debates_controller_spec.rb index 7f89a75ae..60c977689 100644 --- a/spec/controllers/debates_controller_spec.rb +++ b/spec/controllers/debates_controller_spec.rb @@ -15,7 +15,13 @@ describe DebatesController do sign_in create(:user) - post :create, debate: { title: "A sample debate", description: "this is a sample debate", terms_of_service: 1 } + post :create, params: { + debate: { + title: "A sample debate", + description: "this is a sample debate", + terms_of_service: 1 + } + } expect(Ahoy::Event.where(name: :debate_created).count).to eq 1 expect(Ahoy::Event.last.properties["debate_id"]).to eq Debate.last.id end @@ -32,7 +38,7 @@ describe DebatesController do sign_in create(:user) expect do - xhr :post, :vote, id: debate.id, value: "yes" + post :vote, xhr: true, params: { id: debate.id, value: "yes" } end.to change { debate.reload.votes_for.size }.by(1) end @@ -42,7 +48,7 @@ describe DebatesController do sign_in create(:user) expect do - xhr :post, :vote, id: debate.id, value: "yes" + post :vote, xhr: true, params: { id: debate.id, value: "yes" } end.not_to change { debate.reload.votes_for.size } end end diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb index 4cd6ba8c6..b55816e39 100644 --- a/spec/controllers/graphql_controller_spec.rb +++ b/spec/controllers/graphql_controller_spec.rb @@ -13,14 +13,14 @@ describe GraphqlController, type: :request do describe "handles GET request" do specify "with query string inside query params" do - get "/graphql", query: "{ proposal(id: #{proposal.id}) { title } }" + get "/graphql", params: { query: "{ proposal(id: #{proposal.id}) { title } }" } expect(response).to have_http_status(:ok) expect(JSON.parse(response.body)["data"]["proposal"]["title"]).to eq(proposal.title) end specify "with malformed query string" do - get "/graphql", query: "Malformed query string" + get "/graphql", params: { query: "Malformed query string" } expect(response).to have_http_status(:ok) expect(parser_error_raised?(response)).to be_truthy @@ -38,7 +38,8 @@ describe GraphqlController, type: :request do let(:json_headers) { { "CONTENT_TYPE" => "application/json" } } specify "with json-encoded query string inside body" do - post "/graphql", { query: "{ proposal(id: #{proposal.id}) { title } }" }.to_json, json_headers + post "/graphql", params: { query: "{ proposal(id: #{proposal.id}) { title } }" }.to_json, + headers: json_headers expect(response).to have_http_status(:ok) expect(JSON.parse(response.body)["data"]["proposal"]["title"]).to eq(proposal.title) @@ -46,21 +47,22 @@ describe GraphqlController, type: :request do specify "with raw query string inside body" do graphql_headers = { "CONTENT_TYPE" => "application/graphql" } - post "/graphql", "{ proposal(id: #{proposal.id}) { title } }", graphql_headers + post "/graphql", params: "{ proposal(id: #{proposal.id}) { title } }", + headers: graphql_headers expect(response).to have_http_status(:ok) expect(JSON.parse(response.body)["data"]["proposal"]["title"]).to eq(proposal.title) end specify "with malformed query string" do - post "/graphql", { query: "Malformed query string" }.to_json, json_headers + post "/graphql", params: { query: "Malformed query string" }.to_json, headers: json_headers expect(response).to have_http_status(:ok) expect(parser_error_raised?(response)).to be_truthy end it "without query string" do - post "/graphql", json_headers + post "/graphql", headers: json_headers expect(response).to have_http_status(:bad_request) expect(JSON.parse(response.body)["message"]).to eq("Query string not present") @@ -71,19 +73,19 @@ describe GraphqlController, type: :request do let(:query_string) { "{ proposal(id: #{proposal.id}) { title } }" } specify "when absent" do - get "/graphql", query: query_string + get "/graphql", params: { query: query_string } expect(response).to have_http_status(:ok) end specify "when specified as the 'null' string" do - get "/graphql", query: query_string, variables: "null" + get "/graphql", params: { query: query_string, variables: "null" } expect(response).to have_http_status(:ok) end specify "when specified as an empty string" do - get "/graphql", query: query_string, variables: "" + get "/graphql", params: { query: query_string, variables: "" } expect(response).to have_http_status(:ok) end diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb index d7847d9fa..7e580b3c8 100644 --- a/spec/controllers/legislation/annotations_controller_spec.rb +++ b/spec/controllers/legislation/annotations_controller_spec.rb @@ -3,99 +3,161 @@ require "rails_helper" describe Legislation::AnnotationsController do describe "POST create" do - before do - @process = create(:legislation_process, allegations_start_date: Date.current - 3.days, allegations_end_date: Date.current + 2.days) - @draft_version = create(:legislation_draft_version, :published, process: @process, title: "Version 1") - @final_version = create(:legislation_draft_version, :published, :final_version, process: @process, title: "Final version") - @user = create(:user, :level_two) - end + + let(:legal_process) { create(:legislation_process, + allegations_start_date: Date.current - 3.days, + allegations_end_date: Date.current + 2.days) } + let(:draft_version) { create(:legislation_draft_version, :published, + process: legal_process, + title: "Version 1") } + let(:final_version) { create(:legislation_draft_version, :published, + :final_version, + process: legal_process, + title: "Final version") } + let(:user) { create(:user, :level_two) } + it "creates an ahoy event" do - sign_in @user + sign_in user - post :create, process_id: @process.id, - draft_version_id: @draft_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}], - "text": "una anotacion" + post :create, params: { + process_id: legal_process.id, + draft_version_id: draft_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" } + } expect(Ahoy::Event.where(name: :legislation_annotation_created).count).to eq 1 expect(Ahoy::Event.last.properties["legislation_annotation_id"]).to eq Legislation::Annotation.last.id end it "does not create an annotation if the draft version is a final version" do - sign_in @user + sign_in user - post :create, process_id: @process.id, - draft_version_id: @final_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}], - "text": "una anotacion" + post :create, params: { + process_id: legal_process.id, + draft_version_id: final_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" + } } expect(response).to have_http_status(:not_found) end it "creates an annotation if the process allegations phase is open" do - sign_in @user + sign_in user expect do - xhr :post, :create, process_id: @process.id, - draft_version_id: @draft_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}], - "text": "una anotacion" + post :create, xhr: true, + params: { + process_id: legal_process.id, + draft_version_id: draft_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" + } } - end.to change { @draft_version.annotations.count }.by(1) + end.to change { draft_version.annotations.count }.by(1) end it "does not create an annotation if the process allegations phase is not open" do - sign_in @user - @process.update_attribute(:allegations_end_date, Date.current - 1.day) + sign_in user + legal_process.update_attribute(:allegations_end_date, Date.current - 1.day) expect do - xhr :post, :create, process_id: @process.id, - draft_version_id: @draft_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}], - "text": "una anotacion" + post :create, xhr: true, + params: { + process_id: legal_process.id, + draft_version_id: draft_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges"=> [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" + } } - end.not_to change { @draft_version.annotations.count } + end.to_not change { draft_version.annotations.count } end it "creates an annotation by parsing parameters in JSON" do - sign_in @user + sign_in user expect do - xhr :post, :create, process_id: @process.id, - draft_version_id: @draft_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}].to_json, - "text": "una anotacion" + post :create, xhr: true, + params: { + process_id: legal_process.id, + draft_version_id: draft_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }].to_json, + "text" => "una anotacion" + } } - end.to change { @draft_version.annotations.count }.by(1) + end.to change { draft_version.annotations.count }.by(1) end it "creates a new comment on an existing annotation when range is the same" do - annotation = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", - ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}], - range_start: "/p[1]", range_start_offset: 6, range_end: "/p[1]", range_end_offset: 11) - sign_in @user + annotation = create(:legislation_annotation, draft_version: draft_version, + text: "my annotation", + ranges: [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + range_start: "/p[1]", + range_start_offset: 6, + range_end: "/p[1]", + range_end_offset: 11) + sign_in user expect do - xhr :post, :create, process_id: @process.id, - draft_version_id: @draft_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}], - "text": "una anotacion" + post :create, xhr: true, + params: { + process_id: legal_process.id, + draft_version_id: draft_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" + } } - end.not_to change { @draft_version.annotations.count } + end.to_not change { draft_version.annotations.count } expect(annotation.reload.comments_count).to eq(2) expect(annotation.comments.last.body).to eq("una anotacion") diff --git a/spec/controllers/legislation/answers_controller_spec.rb b/spec/controllers/legislation/answers_controller_spec.rb index b5ef6dd96..0388572cb 100644 --- a/spec/controllers/legislation/answers_controller_spec.rb +++ b/spec/controllers/legislation/answers_controller_spec.rb @@ -3,39 +3,56 @@ require "rails_helper" describe Legislation::AnswersController do describe "POST create" do - before do - @process = create(:legislation_process, debate_start_date: Date.current - 3.days, debate_end_date: Date.current + 2.days) - @question = create(:legislation_question, process: @process, title: "Question 1") - @question_option = create(:legislation_question_option, question: @question, value: "Yes") - @user = create(:user, :level_two) - end + + let(:legal_process) { create(:legislation_process, debate_start_date: Date.current - 3.days, + debate_end_date: Date.current + 2.days) } + let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") } + let(:question_option) { create(:legislation_question_option, question: question, value: "Yes") } + let(:user) { create(:user, :level_two) } it "creates an ahoy event" do - sign_in @user + sign_in user - post :create, process_id: @process.id, question_id: @question.id, - legislation_answer: { legislation_question_option_id: @question_option.id } + post :create, params: { + process_id: legal_process.id, + question_id: question.id, + legislation_answer: { + legislation_question_option_id: question_option.id + } + } expect(Ahoy::Event.where(name: :legislation_answer_created).count).to eq 1 expect(Ahoy::Event.last.properties["legislation_answer_id"]).to eq Legislation::Answer.last.id end it "creates an answer if the process debate phase is open" do - sign_in @user + sign_in user expect do - xhr :post, :create, process_id: @process.id, question_id: @question.id, - legislation_answer: { legislation_question_option_id: @question_option.id } - end.to change { @question.reload.answers_count }.by(1) + post :create, xhr: true, + params: { + process_id: legal_process.id, + question_id: question.id, + legislation_answer: { + legislation_question_option_id: question_option.id + } + } + end.to change { question.reload.answers_count }.by(1) end it "does not create an answer if the process debate phase is not open" do - sign_in @user - @process.update_attribute(:debate_end_date, Date.current - 1.day) + sign_in user + legal_process.update_attribute(:debate_end_date, Date.current - 1.day) expect do - xhr :post, :create, process_id: @process.id, question_id: @question.id, - legislation_answer: { legislation_question_option_id: @question_option.id } - end.not_to change { @question.reload.answers_count } + post :create, xhr: true, + params: { + process_id: legal_process.id, + question_id: question.id, + legislation_answer: { + legislation_question_option_id: question_option.id + } + } + end.not_to change { question.reload.answers_count } end end end diff --git a/spec/controllers/management/sessions_controller_spec.rb b/spec/controllers/management/sessions_controller_spec.rb index 7356169ad..650f53246 100644 --- a/spec/controllers/management/sessions_controller_spec.rb +++ b/spec/controllers/management/sessions_controller_spec.rb @@ -5,7 +5,9 @@ describe Management::SessionsController do describe "Sign in" do it "denies access if wrong manager credentials" do allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false) - expect { get :create, login: "nonexistent", clave_usuario: "wrong"}.to raise_error CanCan::AccessDenied + expect { + get :create, params: { login: "nonexistent", clave_usuario: "wrong" } + }.to raise_error CanCan::AccessDenied expect(session[:manager]).to be_nil end @@ -13,7 +15,11 @@ describe Management::SessionsController do manager = {login: "JJB033", user_key: "31415926", date: "20151031135905"} allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager) - get :create, login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905" + get :create, params: { + login: "JJB033" , + clave_usuario: "31415926", + fecha_conexion: "20151031135905" + } expect(response).to be_redirect expect(session[:manager][:login]).to eq "JJB033" end @@ -56,4 +62,4 @@ describe Management::SessionsController do end end -end \ No newline at end of file +end diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index a4b05f768..ac0678691 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -4,17 +4,17 @@ describe PagesController do describe "Static pages" do it "includes a privacy page" do - get :show, id: :privacy + get :show, params: { id: :privacy } expect(response).to be_ok end it "includes a conditions page" do - get :show, id: :conditions + get :show, params: { id: :conditions } expect(response).to be_ok end it "includes a accessibility page" do - get :show, id: :accessibility + get :show, params: { id: :accessibility } expect(response).to be_ok end end @@ -22,24 +22,24 @@ describe PagesController do describe "More info pages" do it "includes a more info page" do - get :show, id: "help/index" + get :show, params: { id: "help/index" } expect(response).to be_ok end it "includes a how_to_use page" do - get :show, id: "help/how_to_use/index" + get :show, params: { id: "help/how_to_use/index" } expect(response).to be_ok end it "includes a faq page" do - get :show, id: :faq + get :show, params: { id: :faq } expect(response).to be_ok end end describe "Not found pages" do it "returns a 404 message" do - get :show, id: "nonExistentPage" + get :show, params: { id: "nonExistentPage" } expect(response).to be_missing end end diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb index 82269703e..2a82842b0 100644 --- a/spec/controllers/users/registrations_controller_spec.rb +++ b/spec/controllers/users/registrations_controller_spec.rb @@ -10,7 +10,7 @@ describe Users::RegistrationsController do context "when username is available" do it "returns true with no error message" do - get :check_username, username: "available username" + get :check_username, params: { username: "available username" } data = JSON.parse response.body, symbolize_names: true expect(data[:available]).to be true @@ -21,7 +21,7 @@ describe Users::RegistrationsController do context "when username is not available" do it "returns false with an error message" do user = create(:user) - get :check_username, username: user.username + get :check_username, params: { username: user.username } data = JSON.parse response.body, symbolize_names: true expect(data[:available]).to be false diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index 1902ede45..38e9f5c11 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -172,7 +172,7 @@ feature "Account" do login_through_form_as(@user) - expect(page).to have_content "Invalid login or password" + expect(page).to have_content "Invalid Email or username or password" end context "Recommendations" do diff --git a/spec/features/admin/activity_spec.rb b/spec/features/admin/activity_spec.rb index 7e8813af5..94e6ef8f3 100644 --- a/spec/features/admin/activity_spec.rb +++ b/spec/features/admin/activity_spec.rb @@ -16,6 +16,7 @@ feature "Admin activity" do within("#proposal_#{proposal.id}") do accept_confirm { click_link "Hide" } end + expect(page).to have_css("#proposal_#{proposal.id}.faded") visit admin_activity_path @@ -78,6 +79,7 @@ feature "Admin activity" do within("#debate_#{debate.id}") do accept_confirm { click_link "Hide" } end + expect(page).to have_css("#debate_#{debate.id}.faded") visit admin_activity_path @@ -140,6 +142,7 @@ feature "Admin activity" do within("#comment_#{comment.id}") do accept_confirm { click_link "Hide" } + expect(page).to have_css(".faded") end visit admin_activity_path @@ -202,6 +205,7 @@ feature "Admin activity" do within("#proposal_#{proposal.id}") do click_link "Hide author" + expect(current_path).to eq(debates_path) end visit admin_activity_path diff --git a/spec/features/moderation/users_spec.rb b/spec/features/moderation/users_spec.rb index b2c6e37d9..3fd0255f7 100644 --- a/spec/features/moderation/users_spec.rb +++ b/spec/features/moderation/users_spec.rb @@ -46,7 +46,7 @@ feature "Moderate users" do fill_in "user_password", with: citizen.password click_button "Enter" - expect(page).to have_content "Invalid login or password" + expect(page).to have_content "Invalid Email or username or password" expect(page).to have_current_path(new_user_session_path) end diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index 040f64305..cffd8c453 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -88,7 +88,7 @@ feature "Users" do click_button "Enter" expect(page).not_to have_content "You have been signed in successfully." - expect(page).to have_content "Invalid login or password." + expect(page).to have_content "Invalid Email or username or password." fill_in "user_login", with: "venom@nyc.dev" fill_in "user_password", with: "symbiote" diff --git a/spec/models/concerns/sluggable.rb b/spec/models/concerns/sluggable.rb index cba8960f5..d1dd64720 100644 --- a/spec/models/concerns/sluggable.rb +++ b/spec/models/concerns/sluggable.rb @@ -3,7 +3,7 @@ require "spec_helper" shared_examples_for "sluggable" do |updatable_slug_trait:| describe "generate_slug" do - let(:factory_name) { described_class.name.parameterize("_").to_sym } + let(:factory_name) { described_class.name.parameterize(separator: "_").to_sym } let(:sluggable) { create(factory_name, name: "Marló Brañido Carlo") } context "when a new sluggable is created" do diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 12da638ee..8f4745007 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -273,7 +273,7 @@ describe Debate do newer_debate = create(:debate, created_at: now) 5.times { newer_debate.vote_by(voter: create(:user), vote: "yes") } - older_debate = create(:debate, created_at: 1.day.ago) + older_debate = create(:debate, created_at: 2.days.ago) 5.times { older_debate.vote_by(voter: create(:user), vote: "yes") } expect(newer_debate.hot_score).to be > older_debate.hot_score diff --git a/spec/models/legislation/proposal_spec.rb b/spec/models/legislation/proposal_spec.rb index 28ea9c72d..f2f72b055 100644 --- a/spec/models/legislation/proposal_spec.rb +++ b/spec/models/legislation/proposal_spec.rb @@ -67,7 +67,7 @@ describe Legislation::Proposal do newer_proposal = create(:legislation_proposal, created_at: now) 5.times { newer_proposal.vote_by(voter: create(:user), vote: "yes") } - older_proposal = create(:legislation_proposal, created_at: 1.day.ago) + older_proposal = create(:legislation_proposal, created_at: 2.day.ago) 5.times { older_proposal.vote_by(voter: create(:user), vote: "yes") } expect(newer_proposal.hot_score).to be > older_proposal.hot_score diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 334eee502..3f08f011a 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -291,7 +291,7 @@ describe Proposal do newer_proposal = create(:proposal, created_at: now) 5.times { newer_proposal.vote_by(voter: create(:user), vote: "yes") } - older_proposal = create(:proposal, created_at: 1.day.ago) + older_proposal = create(:proposal, created_at: 2.days.ago) 5.times { older_proposal.vote_by(voter: create(:user), vote: "yes") } expect(newer_proposal.hot_score).to be > older_proposal.hot_score diff --git a/spec/shared/features/relationable.rb b/spec/shared/features/relationable.rb index 0771c21b2..ea67fdcbb 100644 --- a/spec/shared/features/relationable.rb +++ b/spec/shared/features/relationable.rb @@ -1,6 +1,6 @@ shared_examples "relationable" do |relationable_model_name| - let(:relationable) { create(relationable_model_name.name.parameterize("_").to_sym) } + let(:relationable) { create(relationable_model_name.name.parameterize(separator: "_").to_sym) } let(:related1) { create([:proposal, :debate, :budget_investment].sample) } let(:related2) { create([:proposal, :debate, :budget_investment].sample) } let(:user) { create(:user) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 90a85ea3c..e83107566 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,7 +13,7 @@ RSpec.configure do |config| config.filter_run :focus config.run_all_when_everything_filtered = true - config.include Devise::TestHelpers, type: :controller + config.include Devise::Test::ControllerHelpers, type: :controller config.include FactoryBot::Syntax::Methods config.include(EmailSpec::Helpers) config.include(EmailSpec::Matchers) diff --git a/spec/support/common_actions/notifications.rb b/spec/support/common_actions/notifications.rb index 0aa0d9a82..3cae9c4ea 100644 --- a/spec/support/common_actions/notifications.rb +++ b/spec/support/common_actions/notifications.rb @@ -10,7 +10,7 @@ module Notifications end def comment_body(resource) - "comment-body-#{resource.class.name.parameterize("_").to_sym}_#{resource.id}" + "comment-body-#{resource.class.name.parameterize(separator: "_").to_sym}_#{resource.id}" end def create_proposal_notification(proposal)