From 31fa6b8bde2873b7aacb8152ae14a82a20324d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 26 Apr 2019 19:36:44 +0200 Subject: [PATCH 01/16] Upgrade Rails to 5.1 Note we need to upgrade the bullet gem, although another option would be to remove it completely. Now we don't need the rubocop rules for deprecated methods, since using them will raise an error and we'll be notified immediately. --- .rubocop.yml | 12 ------- Gemfile | 4 +-- Gemfile.lock | 99 ++++++++++++++++++++++++++-------------------------- 3 files changed, 51 insertions(+), 64 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7c151d364..8fb963919 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -198,15 +198,6 @@ Performance/EndWith: Performance/StartWith: Enabled: true -Rails/ActionFilter: - Enabled: true - -Rails/ApplicationJob: - Enabled: true - -Rails/ApplicationRecord: - Enabled: true - Rails/CreateTableWithTimestamps: Enabled: true Exclude: @@ -241,9 +232,6 @@ Rails/HasManyOrHasOneDependent: Enabled: true Severity: refactor -Rails/HttpPositionalArguments: - Enabled: true - Rails/InverseOf: Enabled: true Exclude: diff --git a/Gemfile b/Gemfile index 9fcadcea9..716f7c21b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "5.0.7.2" +gem "rails", "5.1.7" gem "acts-as-taggable-on", "~> 5.0.0" gem "acts_as_votable", "~> 0.11.1" @@ -66,7 +66,7 @@ source "https://rails-assets.org" do end group :development, :test do - gem "bullet", "~> 5.7.0" + gem "bullet", "~> 5.9.0" gem "byebug", "~> 10.0.0" gem "factory_bot_rails", "~> 4.8.2" gem "faker", "~> 1.8.7" diff --git a/Gemfile.lock b/Gemfile.lock index 22b2fc556..889d5e0cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,39 +10,39 @@ GEM remote: https://rubygems.org/ remote: https://rails-assets.org/ specs: - actioncable (5.0.7.2) - actionpack (= 5.0.7.2) - nio4r (>= 1.2, < 3.0) + actioncable (5.1.7) + actionpack (= 5.1.7) + nio4r (~> 2.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) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.7.2) - actionview (= 5.0.7.2) - activesupport (= 5.0.7.2) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.7.2) - activesupport (= 5.0.7.2) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.7.2) - activesupport (= 5.0.7.2) + activejob (5.1.7) + activesupport (= 5.1.7) 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) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) + arel (~> 8.0) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -70,7 +70,7 @@ GEM nokogiri ancestry (3.0.7) activerecord (>= 3.2.0) - arel (7.1.4) + arel (8.0.0) ast (2.4.0) audited (4.9.0) activerecord (>= 4.2, < 6.1) @@ -91,9 +91,9 @@ GEM smart_properties browser (2.5.3) builder (3.2.4) - bullet (5.7.1) + bullet (5.9.0) activesupport (>= 3.0.0) - uniform_notifier (~> 1.11.0) + uniform_notifier (~> 1.11) byebug (10.0.0) cancancan (2.3.0) capistrano (3.10.1) @@ -144,7 +144,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) coveralls (0.8.22) json (>= 1.8, < 3) simplecov (~> 0.16.1) @@ -210,7 +210,6 @@ GEM smart_properties errbase (0.0.3) erubi (1.8.0) - erubis (2.7.0) execjs (2.7.0) factory_bot (4.8.2) activesupport (>= 3.0.0) @@ -332,7 +331,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) + method_source (1.0.0) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) @@ -351,7 +350,7 @@ GEM net-ssh (5.0.2) newrelic_rpm (4.1.0.333) nio4r (2.5.2) - nokogiri (1.10.8) + nokogiri (1.10.9) mini_portile2 (~> 2.4.0) nori (2.6.0) oauth (0.5.4) @@ -405,26 +404,26 @@ GEM public_suffix (4.0.1) puma (4.3.3) nio4r (~> 2.0) - rack (2.1.1) + rack (2.2.2) rack-accept (0.4.5) rack (>= 0.4) rack-attack (5.0.1) rack rack-proxy (0.6.5) rack - rack-test (0.6.3) - rack (>= 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) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) bundler (>= 1.3.0) - railties (= 5.0.7.2) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-assets-leaflet (1.2.0) rails-assets-markdown-it (8.2.2) @@ -436,9 +435,9 @@ GEM rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.0.7.2) - actionpack (= 5.0.7.2) - activesupport (= 5.0.7.2) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -577,7 +576,7 @@ GEM uglifier (4.1.19) execjs (>= 0.3.0, < 3) unicode-display_width (1.6.0) - uniform_notifier (1.11.0) + uniform_notifier (1.13.0) user_agent_parser (2.6.0) uuidtools (2.1.5) warden (1.2.8) @@ -591,7 +590,7 @@ GEM railties (>= 4.2) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) whenever (0.10.0) chronic (>= 0.6.3) wicked_pdf (1.1.0) @@ -609,7 +608,7 @@ DEPENDENCIES ancestry (~> 3.0.7) audited (~> 4.9.0) autoprefixer-rails (~> 8.2.0) - bullet (~> 5.7.0) + bullet (~> 5.9.0) byebug (~> 10.0.0) cancancan (~> 2.3.0) capistrano (~> 3.10.1) @@ -664,7 +663,7 @@ DEPENDENCIES pg (~> 0.21.0) pg_search (~> 2.0.1) puma (~> 4.3.3) - rails (= 5.0.7.2) + rails (= 5.1.7) rails-assets-leaflet! rails-assets-markdown-it (~> 8.2.1)! recipient_interceptor (~> 0.2.0) From 1de1cb0353fc18210ee6169655587a71641e90cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 26 Apr 2019 20:03:12 +0200 Subject: [PATCH 02/16] Use Rails 5.1 schema file format Rails 5.1 doesn't align the columns in the schema file anymore, so there aren't unrelated changes when we add or remove columns to a table: https://github.com/rails/rails/pull/25675 We're sorry for developers who are really concerned about code alignment. --- db/schema.rb | 2562 +++++++++++++++++++++++++------------------------- 1 file changed, 1281 insertions(+), 1281 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 1eccac194..3dafb07b9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -17,1589 +17,1589 @@ ActiveRecord::Schema.define(version: 20191108173350) do enable_extension "unaccent" enable_extension "pg_trgm" - create_table "active_poll_translations", force: :cascade do |t| - t.integer "active_poll_id", null: false - t.string "locale", null: false - 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 + create_table "active_poll_translations", id: :serial, force: :cascade do |t| + t.integer "active_poll_id", null: false + t.string "locale", null: false + 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" + t.index ["locale"], name: "index_active_poll_translations_on_locale" end - create_table "active_polls", force: :cascade do |t| + create_table "active_polls", id: :serial, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "activities", force: :cascade do |t| - t.integer "user_id" - t.string "action" - t.string "actionable_type" - t.integer "actionable_id" + create_table "activities", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.string "action" + 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 + t.index ["actionable_id", "actionable_type"], name: "index_activities_on_actionable_id_and_actionable_type" + t.index ["user_id"], name: "index_activities_on_user_id" end - create_table "admin_notification_translations", force: :cascade do |t| - t.integer "admin_notification_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - 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 + create_table "admin_notification_translations", id: :serial, force: :cascade do |t| + t.integer "admin_notification_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + 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" + t.index ["locale"], name: "index_admin_notification_translations_on_locale" end - create_table "admin_notifications", force: :cascade do |t| - t.string "link" - t.string "segment_recipient" - t.integer "recipients_count" - t.date "sent_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "admin_notifications", id: :serial, force: :cascade do |t| + t.string "link" + t.string "segment_recipient" + t.integer "recipients_count" + t.date "sent_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "administrators", force: :cascade do |t| + create_table "administrators", id: :serial, force: :cascade do |t| t.integer "user_id" - t.string "description" - t.index ["user_id"], name: "index_administrators_on_user_id", using: :btree + t.string "description" + t.index ["user_id"], name: "index_administrators_on_user_id" end create_table "ahoy_events", id: :uuid, default: nil, force: :cascade do |t| - t.uuid "visit_id" - t.integer "user_id" - t.string "name" - t.jsonb "properties" + t.uuid "visit_id" + t.integer "user_id" + t.string "name" + 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 + t.string "ip" + t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time" + t.index ["time"], name: "index_ahoy_events_on_time" + t.index ["user_id"], name: "index_ahoy_events_on_user_id" + t.index ["visit_id"], name: "index_ahoy_events_on_visit_id" end - create_table "audits", force: :cascade do |t| - t.integer "auditable_id" - t.string "auditable_type" - t.integer "associated_id" - t.string "associated_type" - t.integer "user_id" - t.string "user_type" - t.string "username" - t.string "action" - t.jsonb "audited_changes" - t.integer "version", default: 0 - t.string "comment" - t.string "remote_address" - t.string "request_uuid" + create_table "audits", id: :serial, force: :cascade do |t| + t.integer "auditable_id" + t.string "auditable_type" + t.integer "associated_id" + t.string "associated_type" + t.integer "user_id" + t.string "user_type" + t.string "username" + t.string "action" + t.jsonb "audited_changes" + t.integer "version", default: 0 + t.string "comment" + t.string "remote_address" + t.string "request_uuid" t.datetime "created_at" - t.index ["associated_type", "associated_id"], name: "associated_index", using: :btree - t.index ["auditable_type", "auditable_id", "version"], name: "auditable_index", using: :btree - t.index ["created_at"], name: "index_audits_on_created_at", using: :btree - t.index ["request_uuid"], name: "index_audits_on_request_uuid", using: :btree - t.index ["user_id", "user_type"], name: "user_index", using: :btree + t.index ["associated_type", "associated_id"], name: "associated_index" + t.index ["auditable_type", "auditable_id", "version"], name: "auditable_index" + t.index ["created_at"], name: "index_audits_on_created_at" + t.index ["request_uuid"], name: "index_audits_on_request_uuid" + t.index ["user_id", "user_type"], name: "user_index" end - create_table "banner_sections", force: :cascade do |t| - t.integer "banner_id" - t.integer "web_section_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "banner_translations", force: :cascade do |t| - t.integer "banner_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "title" - t.text "description" - t.datetime "hidden_at" - t.index ["banner_id"], name: "index_banner_translations_on_banner_id", using: :btree - t.index ["hidden_at"], name: "index_banner_translations_on_hidden_at", using: :btree - t.index ["locale"], name: "index_banner_translations_on_locale", using: :btree - end - - create_table "banners", force: :cascade do |t| - t.string "target_url" - t.date "post_started_at" - t.date "post_ended_at" - t.datetime "hidden_at" - t.datetime "created_at", null: false - 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 - - create_table "budget_administrators", force: :cascade do |t| - t.integer "budget_id" - t.integer "administrator_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["administrator_id"], name: "index_budget_administrators_on_administrator_id", using: :btree - t.index ["budget_id"], name: "index_budget_administrators_on_budget_id", using: :btree - end - - create_table "budget_ballot_lines", force: :cascade do |t| - t.integer "ballot_id" - t.integer "investment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - 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 - - create_table "budget_ballots", force: :cascade do |t| - t.integer "user_id" - t.integer "budget_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "ballot_lines_count", default: 0 - t.boolean "physical", default: false - t.integer "poll_ballot_id" - end - - create_table "budget_content_blocks", force: :cascade do |t| - t.integer "heading_id" - t.text "body" - t.string "locale" + create_table "banner_sections", id: :serial, force: :cascade do |t| + t.integer "banner_id" + t.integer "web_section_id" 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 - 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 + create_table "banner_translations", id: :serial, force: :cascade do |t| + t.integer "banner_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "description" + t.datetime "hidden_at" + t.index ["banner_id"], name: "index_banner_translations_on_banner_id" + t.index ["hidden_at"], name: "index_banner_translations_on_hidden_at" + t.index ["locale"], name: "index_banner_translations_on_locale" end - create_table "budget_groups", force: :cascade do |t| - t.integer "budget_id" - t.string "slug" - t.integer "max_votable_headings", default: 1 + create_table "banners", id: :serial, force: :cascade do |t| + t.string "target_url" + t.date "post_started_at" + t.date "post_ended_at" + t.datetime "hidden_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "background_color" + t.text "font_color" + t.index ["hidden_at"], name: "index_banners_on_hidden_at" + end + + create_table "budget_administrators", id: :serial, force: :cascade do |t| + t.integer "budget_id" + t.integer "administrator_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["administrator_id"], name: "index_budget_administrators_on_administrator_id" + t.index ["budget_id"], name: "index_budget_administrators_on_budget_id" + end + + create_table "budget_ballot_lines", id: :serial, force: :cascade do |t| + t.integer "ballot_id" + t.integer "investment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + 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 + t.index ["ballot_id"], name: "index_budget_ballot_lines_on_ballot_id" + t.index ["investment_id"], name: "index_budget_ballot_lines_on_investment_id" + end + + create_table "budget_ballots", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "budget_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "ballot_lines_count", default: 0 + t.boolean "physical", default: false + t.integer "poll_ballot_id" + end + + create_table "budget_content_blocks", id: :serial, force: :cascade do |t| + t.integer "heading_id" + t.text "body" + 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" + end + + create_table "budget_group_translations", id: :serial, 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" + t.index ["locale"], name: "index_budget_group_translations_on_locale" + end + + create_table "budget_groups", id: :serial, force: :cascade do |t| + t.integer "budget_id" + t.string "slug" + t.integer "max_votable_headings", default: 1 t.datetime "created_at" t.datetime "updated_at" - t.index ["budget_id"], name: "index_budget_groups_on_budget_id", using: :btree + t.index ["budget_id"], name: "index_budget_groups_on_budget_id" end - 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 + create_table "budget_heading_translations", id: :serial, 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" + t.index ["locale"], name: "index_budget_heading_translations_on_locale" end - create_table "budget_headings", force: :cascade do |t| - t.integer "group_id" - t.bigint "price" - t.integer "population" - t.string "slug" - t.boolean "allow_custom_content", default: false - t.text "latitude" - t.text "longitude" + create_table "budget_headings", id: :serial, force: :cascade do |t| + t.integer "group_id" + t.bigint "price" + t.integer "population" + t.string "slug" + t.boolean "allow_custom_content", default: false + t.text "latitude" + t.text "longitude" t.datetime "created_at" t.datetime "updated_at" - t.index ["group_id"], name: "index_budget_headings_on_group_id", using: :btree + t.index ["group_id"], name: "index_budget_headings_on_group_id" end - create_table "budget_investment_translations", force: :cascade do |t| - t.integer "budget_investment_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "title" - t.text "description" + create_table "budget_investment_translations", id: :serial, force: :cascade do |t| + t.integer "budget_investment_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "description" t.datetime "hidden_at" - t.index ["budget_investment_id"], name: "index_budget_investment_translations_on_budget_investment_id", using: :btree - t.index ["hidden_at"], name: "index_budget_investment_translations_on_hidden_at", using: :btree - t.index ["locale"], name: "index_budget_investment_translations_on_locale", using: :btree + t.index ["budget_investment_id"], name: "index_budget_investment_translations_on_budget_investment_id" + t.index ["hidden_at"], name: "index_budget_investment_translations_on_hidden_at" + t.index ["locale"], name: "index_budget_investment_translations_on_locale" end - create_table "budget_investments", force: :cascade do |t| - t.integer "author_id" - t.integer "administrator_id" - t.string "deprecated_title" - t.text "deprecated_description" - t.string "external_url" - 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.bigint "price_first_year" - t.string "duration" + create_table "budget_investments", id: :serial, force: :cascade do |t| + t.integer "author_id" + t.integer "administrator_id" + t.string "deprecated_title" + t.text "deprecated_description" + t.string "external_url" + 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.bigint "price_first_year" + t.string "duration" t.datetime "hidden_at" - t.integer "cached_votes_up", default: 0 - t.integer "comments_count", default: 0 - t.integer "confidence_score", default: 0, null: false - t.integer "physical_votes", default: 0 + t.integer "cached_votes_up", default: 0 + t.integer "comments_count", default: 0 + t.integer "confidence_score", default: 0, null: false + t.integer "physical_votes", default: 0 t.tsvector "tsv" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "heading_id" - t.string "responsible_name" - t.integer "budget_id" - t.integer "group_id" - t.boolean "selected", default: false - t.string "location" - t.string "organization_name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "heading_id" + t.string "responsible_name" + t.integer "budget_id" + t.integer "group_id" + t.boolean "selected", default: false + t.string "location" + t.string "organization_name" t.datetime "unfeasible_email_sent_at" - t.integer "ballot_lines_count", default: 0 - t.integer "previous_heading_id" - t.boolean "winner", default: false - t.boolean "incompatible", default: false - t.integer "community_id" - t.boolean "visible_to_valuators", default: false - t.integer "valuator_group_assignments_count", default: 0 + t.integer "ballot_lines_count", default: 0 + t.integer "previous_heading_id" + t.boolean "winner", default: false + t.boolean "incompatible", default: false + t.integer "community_id" + t.boolean "visible_to_valuators", default: false + t.integer "valuator_group_assignments_count", default: 0 t.datetime "confirmed_hide_at" t.datetime "ignored_flag_at" - t.integer "flags_count", default: 0 - t.integer "original_heading_id" - 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.integer "flags_count", default: 0 + t.integer "original_heading_id" + t.index ["administrator_id"], name: "index_budget_investments_on_administrator_id" + t.index ["author_id"], name: "index_budget_investments_on_author_id" + t.index ["community_id"], name: "index_budget_investments_on_community_id" + t.index ["heading_id"], name: "index_budget_investments_on_heading_id" t.index ["tsv"], name: "index_budget_investments_on_tsv", using: :gin end - create_table "budget_phase_translations", force: :cascade do |t| - t.integer "budget_phase_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - 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 - - create_table "budget_phases", force: :cascade do |t| - t.integer "budget_id" - t.integer "next_phase_id" - t.string "kind", null: false - 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 - - create_table "budget_reclassified_votes", force: :cascade do |t| - t.integer "user_id" - t.integer "investment_id" - t.string "reason" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "budget_translations", force: :cascade do |t| - t.integer "budget_id", null: false - t.string "locale", null: false + create_table "budget_phase_translations", id: :serial, force: :cascade do |t| + t.integer "budget_phase_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_id"], name: "index_budget_translations_on_budget_id", using: :btree - t.index ["locale"], name: "index_budget_translations_on_locale", using: :btree + t.text "description" + t.text "summary" + t.index ["budget_phase_id"], name: "index_budget_phase_translations_on_budget_phase_id" + t.index ["locale"], name: "index_budget_phase_translations_on_locale" end - 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 + create_table "budget_phases", id: :serial, force: :cascade do |t| + t.integer "budget_id" + t.integer "next_phase_id" + t.string "kind", null: false + t.datetime "starts_at" + t.datetime "ends_at" + t.boolean "enabled", default: true + t.index ["ends_at"], name: "index_budget_phases_on_ends_at" + t.index ["kind"], name: "index_budget_phases_on_kind" + t.index ["next_phase_id"], name: "index_budget_phases_on_next_phase_id" + t.index ["starts_at"], name: "index_budget_phases_on_starts_at" end - create_table "budget_valuator_group_assignments", force: :cascade do |t| + create_table "budget_reclassified_votes", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "investment_id" + t.string "reason" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "budget_translations", id: :serial, force: :cascade do |t| + t.integer "budget_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_id"], name: "index_budget_translations_on_budget_id" + t.index ["locale"], name: "index_budget_translations_on_locale" + end + + create_table "budget_valuator_assignments", id: :serial, 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" + end + + create_table "budget_valuator_group_assignments", id: :serial, force: :cascade do |t| t.integer "valuator_group_id" t.integer "investment_id" end - create_table "budget_valuators", force: :cascade do |t| - t.integer "budget_id" - t.integer "valuator_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["budget_id"], name: "index_budget_valuators_on_budget_id", using: :btree - t.index ["valuator_id"], name: "index_budget_valuators_on_valuator_id", using: :btree + create_table "budget_valuators", id: :serial, force: :cascade do |t| + t.integer "budget_id" + t.integer "valuator_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["budget_id"], name: "index_budget_valuators_on_budget_id" + t.index ["valuator_id"], name: "index_budget_valuators_on_valuator_id" end - create_table "budgets", force: :cascade do |t| - t.string "currency_symbol", limit: 10 - t.string "phase", limit: 40, default: "accepting" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.text "description_accepting" - t.text "description_reviewing" - t.text "description_selecting" - t.text "description_valuating" - t.text "description_balloting" - t.text "description_reviewing_ballots" - t.text "description_finished" - t.string "slug" - t.text "description_drafting" - t.text "description_publishing_prices" - t.text "description_informing" + create_table "budgets", id: :serial, force: :cascade do |t| + t.string "currency_symbol", limit: 10 + t.string "phase", limit: 40, default: "accepting" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "description_accepting" + t.text "description_reviewing" + t.text "description_selecting" + t.text "description_valuating" + t.text "description_balloting" + t.text "description_reviewing_ballots" + t.text "description_finished" + t.string "slug" + t.text "description_drafting" + t.text "description_publishing_prices" + t.text "description_informing" end - create_table "campaigns", force: :cascade do |t| - t.string "name" - t.string "track_id" + create_table "campaigns", id: :serial, force: :cascade do |t| + t.string "name" + t.string "track_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "ckeditor_assets", force: :cascade do |t| - t.string "data_file_name", null: false - t.string "data_content_type" - t.integer "data_file_size" - t.string "data_fingerprint" - t.string "type", limit: 30 - t.integer "width" - 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 - - create_table "comment_translations", force: :cascade do |t| - t.integer "comment_id", null: false - t.string "locale", null: false + create_table "ckeditor_assets", id: :serial, force: :cascade do |t| + t.string "data_file_name", null: false + t.string "data_content_type" + t.integer "data_file_size" + t.string "data_fingerprint" + t.string "type", limit: 30 + t.integer "width" + t.integer "height" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.text "body" + t.index ["type"], name: "index_ckeditor_assets_on_type" + end + + create_table "comment_translations", id: :serial, force: :cascade do |t| + t.integer "comment_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "body" t.datetime "hidden_at" - t.index ["comment_id"], name: "index_comment_translations_on_comment_id", using: :btree - t.index ["hidden_at"], name: "index_comment_translations_on_hidden_at", using: :btree - t.index ["locale"], name: "index_comment_translations_on_locale", using: :btree + t.index ["comment_id"], name: "index_comment_translations_on_comment_id" + t.index ["hidden_at"], name: "index_comment_translations_on_hidden_at" + t.index ["locale"], name: "index_comment_translations_on_locale" end - create_table "comments", force: :cascade do |t| - t.integer "commentable_id" - t.string "commentable_type" - t.text "deprecated_body" - t.string "subject" - t.integer "user_id", null: false + create_table "comments", id: :serial, force: :cascade do |t| + t.integer "commentable_id" + t.string "commentable_type" + t.text "deprecated_body" + t.string "subject" + t.integer "user_id", null: false t.datetime "created_at" t.datetime "updated_at" t.datetime "hidden_at" - t.integer "flags_count", default: 0 + t.integer "flags_count", default: 0 t.datetime "ignored_flag_at" - t.integer "moderator_id" - t.integer "administrator_id" - t.integer "cached_votes_total", default: 0 - t.integer "cached_votes_up", default: 0 - t.integer "cached_votes_down", default: 0 + t.integer "moderator_id" + t.integer "administrator_id" + t.integer "cached_votes_total", default: 0 + t.integer "cached_votes_up", default: 0 + t.integer "cached_votes_down", default: 0 t.datetime "confirmed_hide_at" - 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 + t.string "ancestry" + t.integer "confidence_score", default: 0, null: false + t.boolean "valuation", default: false + t.index ["ancestry"], name: "index_comments_on_ancestry" + t.index ["cached_votes_down"], name: "index_comments_on_cached_votes_down" + t.index ["cached_votes_total"], name: "index_comments_on_cached_votes_total" + t.index ["cached_votes_up"], name: "index_comments_on_cached_votes_up" + t.index ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type" + t.index ["hidden_at"], name: "index_comments_on_hidden_at" + t.index ["user_id"], name: "index_comments_on_user_id" + t.index ["valuation"], name: "index_comments_on_valuation" end - create_table "communities", force: :cascade do |t| + create_table "communities", id: :serial, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "dashboard_actions", force: :cascade do |t| - t.string "title", limit: 80 - t.text "description" - t.string "link" - t.boolean "request_to_administrators", default: false - t.integer "day_offset", default: 0 - t.integer "required_supports", default: 0 - t.integer "order", default: 0 - t.boolean "active", default: true + create_table "dashboard_actions", id: :serial, force: :cascade do |t| + t.string "title", limit: 80 + t.text "description" + t.string "link" + t.boolean "request_to_administrators", default: false + t.integer "day_offset", default: 0 + t.integer "required_supports", default: 0 + t.integer "order", default: 0 + t.boolean "active", default: true t.datetime "hidden_at" - t.integer "action_type", default: 0, null: false - t.string "short_description" + t.integer "action_type", default: 0, null: false + t.string "short_description" t.datetime "created_at" t.datetime "updated_at" - t.boolean "published_proposal", default: false + t.boolean "published_proposal", default: false end - create_table "dashboard_administrator_tasks", force: :cascade do |t| - t.string "source_type" - t.integer "source_id" - t.integer "user_id" + create_table "dashboard_administrator_tasks", id: :serial, force: :cascade do |t| + t.string "source_type" + t.integer "source_id" + t.integer "user_id" t.datetime "executed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["source_type", "source_id"], name: "index_dashboard_administrator_tasks_on_source", using: :btree - t.index ["user_id"], name: "index_dashboard_administrator_tasks_on_user_id", using: :btree + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["source_type", "source_id"], name: "index_dashboard_administrator_tasks_on_source" + t.index ["user_id"], name: "index_dashboard_administrator_tasks_on_user_id" end - create_table "dashboard_executed_actions", force: :cascade do |t| - t.integer "proposal_id" - t.integer "action_id" + create_table "dashboard_executed_actions", id: :serial, force: :cascade do |t| + t.integer "proposal_id" + t.integer "action_id" t.datetime "executed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["action_id"], name: "index_proposal_action", using: :btree - t.index ["proposal_id"], name: "index_dashboard_executed_actions_on_proposal_id", using: :btree + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["action_id"], name: "index_proposal_action" + t.index ["proposal_id"], name: "index_dashboard_executed_actions_on_proposal_id" end - create_table "debate_translations", force: :cascade do |t| - t.integer "debate_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "title" - t.text "description" + create_table "debate_translations", id: :serial, force: :cascade do |t| + t.integer "debate_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "description" t.datetime "hidden_at" - t.index ["debate_id"], name: "index_debate_translations_on_debate_id", using: :btree - t.index ["hidden_at"], name: "index_debate_translations_on_hidden_at", using: :btree - t.index ["locale"], name: "index_debate_translations_on_locale", using: :btree + t.index ["debate_id"], name: "index_debate_translations_on_debate_id" + t.index ["hidden_at"], name: "index_debate_translations_on_hidden_at" + t.index ["locale"], name: "index_debate_translations_on_locale" end - create_table "debates", force: :cascade do |t| - t.string "deprecated_title", limit: 80 - t.text "deprecated_description" - t.integer "author_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "visit_id" + create_table "debates", id: :serial, force: :cascade do |t| + t.string "deprecated_title", limit: 80 + t.text "deprecated_description" + t.integer "author_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "visit_id" t.datetime "hidden_at" - t.integer "flags_count", default: 0 + t.integer "flags_count", default: 0 t.datetime "ignored_flag_at" - t.integer "cached_votes_total", default: 0 - t.integer "cached_votes_up", default: 0 - t.integer "cached_votes_down", default: 0 - t.integer "comments_count", default: 0 + t.integer "cached_votes_total", default: 0 + t.integer "cached_votes_up", default: 0 + t.integer "cached_votes_down", default: 0 + t.integer "comments_count", default: 0 t.datetime "confirmed_hide_at" - t.integer "cached_anonymous_votes_total", default: 0 - t.integer "cached_votes_score", default: 0 - t.bigint "hot_score", default: 0 - t.integer "confidence_score", default: 0 - t.integer "geozone_id" + t.integer "cached_anonymous_votes_total", default: 0 + t.integer "cached_votes_score", 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 ["author_id", "hidden_at"], name: "index_debates_on_author_id_and_hidden_at" + t.index ["author_id"], name: "index_debates_on_author_id" + t.index ["cached_votes_down"], name: "index_debates_on_cached_votes_down" + t.index ["cached_votes_score"], name: "index_debates_on_cached_votes_score" + t.index ["cached_votes_total"], name: "index_debates_on_cached_votes_total" + t.index ["cached_votes_up"], name: "index_debates_on_cached_votes_up" + t.index ["confidence_score"], name: "index_debates_on_confidence_score" + t.index ["geozone_id"], name: "index_debates_on_geozone_id" + t.index ["hidden_at"], name: "index_debates_on_hidden_at" + t.index ["hot_score"], name: "index_debates_on_hot_score" t.index ["tsv"], name: "index_debates_on_tsv", using: :gin end - create_table "delayed_jobs", force: :cascade do |t| - t.integer "priority", default: 0, null: false - t.integer "attempts", default: 0, null: false - t.text "handler", null: false - t.text "last_error" + create_table "delayed_jobs", id: :serial, force: :cascade do |t| + t.integer "priority", default: 0, null: false + t.integer "attempts", default: 0, null: false + t.text "handler", null: false + t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" - t.string "locked_by" - t.string "queue" + t.string "locked_by" + t.string "queue" t.datetime "created_at" t.datetime "updated_at" - t.index ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree + t.index ["priority", "run_at"], name: "delayed_jobs_priority" end - create_table "direct_messages", force: :cascade do |t| - t.integer "sender_id" - t.integer "receiver_id" - t.string "title" - t.text "body" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "direct_messages", id: :serial, force: :cascade do |t| + t.integer "sender_id" + t.integer "receiver_id" + t.string "title" + t.text "body" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "documents", force: :cascade do |t| - t.string "title" - t.string "attachment_file_name" - t.string "attachment_content_type" - t.integer "attachment_file_size" + create_table "documents", id: :serial, force: :cascade do |t| + t.string "title" + t.string "attachment_file_name" + t.string "attachment_content_type" + t.integer "attachment_file_size" t.datetime "attachment_updated_at" - t.integer "user_id" - t.string "documentable_type" - t.integer "documentable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "admin", default: 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 + t.integer "user_id" + t.string "documentable_type" + t.integer "documentable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "admin", default: false + t.index ["documentable_type", "documentable_id"], name: "index_documents_on_documentable_type_and_documentable_id" + t.index ["user_id", "documentable_type", "documentable_id"], name: "access_documents" + t.index ["user_id"], name: "index_documents_on_user_id" end - create_table "failed_census_calls", force: :cascade do |t| - t.integer "user_id" - t.string "document_number" - t.string "document_type" - t.date "date_of_birth" - t.string "postal_code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - 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 + create_table "failed_census_calls", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.string "document_number" + t.string "document_type" + t.date "date_of_birth" + t.string "postal_code" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + 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" end - create_table "flags", force: :cascade do |t| - t.integer "user_id" - t.string "flaggable_type" - t.integer "flaggable_id" + create_table "flags", id: :serial, 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 + t.index ["flaggable_type", "flaggable_id"], name: "index_flags_on_flaggable_type_and_flaggable_id" + t.index ["user_id", "flaggable_type", "flaggable_id"], name: "access_inappropiate_flags" + t.index ["user_id"], name: "index_flags_on_user_id" end - create_table "follows", force: :cascade do |t| - t.integer "user_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 + create_table "follows", id: :serial, force: :cascade do |t| + t.integer "user_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" + t.index ["user_id", "followable_type", "followable_id"], name: "access_follows" + t.index ["user_id"], name: "index_follows_on_user_id" end - create_table "geozones", force: :cascade do |t| - t.string "name" - t.string "html_map_coordinates" - t.string "external_code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "census_code" + create_table "geozones", id: :serial, force: :cascade do |t| + t.string "name" + t.string "html_map_coordinates" + t.string "external_code" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "census_code" end - create_table "geozones_polls", force: :cascade do |t| + create_table "geozones_polls", id: :serial, 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 + t.index ["geozone_id"], name: "index_geozones_polls_on_geozone_id" + t.index ["poll_id"], name: "index_geozones_polls_on_poll_id" end - 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 + create_table "i18n_content_translations", id: :serial, 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" + t.index ["locale"], name: "index_i18n_content_translations_on_locale" end - create_table "i18n_contents", force: :cascade do |t| + create_table "i18n_contents", id: :serial, force: :cascade do |t| t.string "key" end - create_table "identities", force: :cascade do |t| - t.integer "user_id" - t.string "provider" - t.string "uid" + create_table "identities", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.string "provider" + 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 + t.index ["user_id"], name: "index_identities_on_user_id" end - create_table "images", force: :cascade do |t| - 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 - t.string "attachment_file_name" - t.string "attachment_content_type" - t.integer "attachment_file_size" + create_table "images", id: :serial, force: :cascade do |t| + 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 + t.string "attachment_file_name" + t.string "attachment_content_type" + 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 - - create_table "legislation_annotations", force: :cascade do |t| - t.string "quote" - t.text "ranges" - t.text "text" - t.integer "legislation_draft_version_id" - t.integer "author_id" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "comments_count", default: 0 - t.string "range_start" - t.integer "range_start_offset" - 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 - - create_table "legislation_answers", force: :cascade do |t| - t.integer "legislation_question_id" - t.integer "legislation_question_option_id" - t.integer "user_id" - 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 - - create_table "legislation_draft_version_translations", force: :cascade do |t| - t.integer "legislation_draft_version_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "title" - t.text "changelog" - t.text "body" - t.datetime "hidden_at" - t.index ["hidden_at"], name: "index_legislation_draft_version_translations_on_hidden_at", using: :btree - 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 - - create_table "legislation_draft_versions", force: :cascade do |t| - t.integer "legislation_process_id" - t.string "status", default: "draft" - t.boolean "final_version", default: false - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - 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 - - create_table "legislation_process_translations", force: :cascade do |t| - t.integer "legislation_process_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "title" - t.text "summary" - t.text "description" - t.text "additional_info" - t.text "milestones_summary" - t.text "homepage" - t.datetime "hidden_at" - t.index ["hidden_at"], name: "index_legislation_process_translations_on_hidden_at", using: :btree - t.index ["legislation_process_id"], name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55", using: :btree - t.index ["locale"], name: "index_legislation_process_translations_on_locale", using: :btree - end - - create_table "legislation_processes", force: :cascade do |t| - t.date "start_date" - t.date "end_date" - t.date "debate_start_date" - t.date "debate_end_date" - t.date "draft_publication_date" - t.date "allegations_start_date" - t.date "allegations_end_date" - t.date "result_publication_date" - t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "debate_phase_enabled", default: false - t.boolean "allegations_phase_enabled", default: false - t.boolean "draft_publication_enabled", default: false - t.boolean "result_publication_enabled", default: false - t.boolean "published", default: true - t.date "proposals_phase_start_date" - t.date "proposals_phase_end_date" - t.boolean "proposals_phase_enabled" - t.text "proposals_description" - t.date "draft_start_date" - t.date "draft_end_date" - t.boolean "draft_phase_enabled", default: false - 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 - - create_table "legislation_proposals", force: :cascade do |t| - t.integer "legislation_process_id" - t.string "title", limit: 80 - t.text "description" - t.integer "author_id" - t.datetime "hidden_at" - t.integer "flags_count", default: 0 - t.datetime "ignored_flag_at" - t.integer "cached_votes_up", default: 0 - t.integer "comments_count", default: 0 - t.datetime "confirmed_hide_at" - t.bigint "hot_score", default: 0 - t.integer "confidence_score", default: 0 - t.string "responsible_name", limit: 60 - t.text "summary" - t.string "video_url" - t.tsvector "tsv" - t.integer "geozone_id" - t.datetime "retired_at" - t.string "retired_reason" - t.text "retired_explanation" - t.integer "community_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "cached_votes_total", default: 0 - 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 - - 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.datetime "hidden_at" - t.index ["hidden_at"], name: "index_legislation_question_option_translations_on_hidden_at", using: :btree - 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 - - create_table "legislation_question_options", force: :cascade do |t| - t.integer "legislation_question_id" - t.integer "answers_count", default: 0 - 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 - - 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.datetime "hidden_at" - t.index ["hidden_at"], name: "index_legislation_question_translations_on_hidden_at", using: :btree - t.index ["legislation_question_id"], name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3", using: :btree - t.index ["locale"], name: "index_legislation_question_translations_on_locale", using: :btree - end - - create_table "legislation_questions", force: :cascade do |t| - t.integer "legislation_process_id" - t.integer "answers_count", default: 0 - t.datetime "hidden_at" - t.datetime "created_at", null: false - 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 - - create_table "links", force: :cascade do |t| - t.string "label" - t.string "url" - t.string "linkable_type" - t.integer "linkable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["linkable_type", "linkable_id"], name: "index_links_on_linkable_type_and_linkable_id", using: :btree - end - - create_table "local_census_records", force: :cascade do |t| - t.string "document_number", null: false - t.string "document_type", null: false - t.date "date_of_birth", null: false - t.string "postal_code", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["document_number", "document_type"], name: "index_local_census_records_on_document_number_and_document_type", unique: true, using: :btree - t.index ["document_number"], name: "index_local_census_records_on_document_number", using: :btree - end - - create_table "locks", force: :cascade do |t| - t.integer "user_id" - t.integer "tries", default: 0 - 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 - - create_table "managers", force: :cascade do |t| t.integer "user_id" - t.index ["user_id"], name: "index_managers_on_user_id", using: :btree + t.index ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id" + t.index ["user_id"], name: "index_images_on_user_id" end - create_table "map_locations", force: :cascade do |t| - t.float "latitude" - t.float "longitude" + create_table "legislation_annotations", id: :serial, force: :cascade do |t| + t.string "quote" + t.text "ranges" + t.text "text" + t.integer "legislation_draft_version_id" + t.integer "author_id" + t.datetime "hidden_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "comments_count", default: 0 + t.string "range_start" + t.integer "range_start_offset" + t.string "range_end" + t.integer "range_end_offset" + t.text "context" + t.index ["author_id"], name: "index_legislation_annotations_on_author_id" + t.index ["hidden_at"], name: "index_legislation_annotations_on_hidden_at" + t.index ["legislation_draft_version_id"], name: "index_legislation_annotations_on_legislation_draft_version_id" + t.index ["range_start", "range_end"], name: "index_legislation_annotations_on_range_start_and_range_end" + end + + create_table "legislation_answers", id: :serial, force: :cascade do |t| + t.integer "legislation_question_id" + t.integer "legislation_question_option_id" + t.integer "user_id" + 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" + t.index ["legislation_question_id"], name: "index_legislation_answers_on_legislation_question_id" + t.index ["legislation_question_option_id"], name: "index_legislation_answers_on_legislation_question_option_id" + t.index ["user_id"], name: "index_legislation_answers_on_user_id" + end + + create_table "legislation_draft_version_translations", id: :serial, force: :cascade do |t| + t.integer "legislation_draft_version_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "changelog" + t.text "body" + t.datetime "hidden_at" + t.index ["hidden_at"], name: "index_legislation_draft_version_translations_on_hidden_at" + t.index ["legislation_draft_version_id"], name: "index_900e5ba94457606e69e89193db426e8ddff809bc" + t.index ["locale"], name: "index_legislation_draft_version_translations_on_locale" + end + + create_table "legislation_draft_versions", id: :serial, force: :cascade do |t| + t.integer "legislation_process_id" + t.string "status", default: "draft" + t.boolean "final_version", default: false + t.datetime "hidden_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at" + t.index ["legislation_process_id"], name: "index_legislation_draft_versions_on_legislation_process_id" + t.index ["status"], name: "index_legislation_draft_versions_on_status" + end + + create_table "legislation_process_translations", id: :serial, force: :cascade do |t| + t.integer "legislation_process_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "summary" + t.text "description" + t.text "additional_info" + t.text "milestones_summary" + t.text "homepage" + t.datetime "hidden_at" + t.index ["hidden_at"], name: "index_legislation_process_translations_on_hidden_at" + t.index ["legislation_process_id"], name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55" + t.index ["locale"], name: "index_legislation_process_translations_on_locale" + end + + create_table "legislation_processes", id: :serial, force: :cascade do |t| + t.date "start_date" + t.date "end_date" + t.date "debate_start_date" + t.date "debate_end_date" + t.date "draft_publication_date" + t.date "allegations_start_date" + t.date "allegations_end_date" + t.date "result_publication_date" + t.datetime "hidden_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "debate_phase_enabled", default: false + t.boolean "allegations_phase_enabled", default: false + t.boolean "draft_publication_enabled", default: false + t.boolean "result_publication_enabled", default: false + t.boolean "published", default: true + t.date "proposals_phase_start_date" + t.date "proposals_phase_end_date" + t.boolean "proposals_phase_enabled" + t.text "proposals_description" + t.date "draft_start_date" + t.date "draft_end_date" + t.boolean "draft_phase_enabled", default: false + 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" + t.index ["allegations_start_date"], name: "index_legislation_processes_on_allegations_start_date" + t.index ["debate_end_date"], name: "index_legislation_processes_on_debate_end_date" + t.index ["debate_start_date"], name: "index_legislation_processes_on_debate_start_date" + t.index ["draft_end_date"], name: "index_legislation_processes_on_draft_end_date" + t.index ["draft_publication_date"], name: "index_legislation_processes_on_draft_publication_date" + t.index ["draft_start_date"], name: "index_legislation_processes_on_draft_start_date" + t.index ["end_date"], name: "index_legislation_processes_on_end_date" + t.index ["hidden_at"], name: "index_legislation_processes_on_hidden_at" + t.index ["result_publication_date"], name: "index_legislation_processes_on_result_publication_date" + t.index ["start_date"], name: "index_legislation_processes_on_start_date" + end + + create_table "legislation_proposals", id: :serial, force: :cascade do |t| + t.integer "legislation_process_id" + t.string "title", limit: 80 + t.text "description" + t.integer "author_id" + t.datetime "hidden_at" + t.integer "flags_count", default: 0 + t.datetime "ignored_flag_at" + t.integer "cached_votes_up", default: 0 + t.integer "comments_count", default: 0 + t.datetime "confirmed_hide_at" + t.bigint "hot_score", default: 0 + t.integer "confidence_score", default: 0 + t.string "responsible_name", limit: 60 + t.text "summary" + t.string "video_url" + t.tsvector "tsv" + t.integer "geozone_id" + t.datetime "retired_at" + t.string "retired_reason" + t.text "retired_explanation" + t.integer "community_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "cached_votes_total", default: 0 + 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" + t.index ["legislation_process_id"], name: "index_legislation_proposals_on_legislation_process_id" + end + + create_table "legislation_question_option_translations", id: :serial, 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.datetime "hidden_at" + t.index ["hidden_at"], name: "index_legislation_question_option_translations_on_hidden_at" + t.index ["legislation_question_option_id"], name: "index_61bcec8729110b7f8e1e9e5ce08780878597a209" + t.index ["locale"], name: "index_legislation_question_option_translations_on_locale" + end + + create_table "legislation_question_options", id: :serial, force: :cascade do |t| + t.integer "legislation_question_id" + t.integer "answers_count", default: 0 + 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" + t.index ["legislation_question_id"], name: "index_legislation_question_options_on_legislation_question_id" + end + + create_table "legislation_question_translations", id: :serial, 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.datetime "hidden_at" + t.index ["hidden_at"], name: "index_legislation_question_translations_on_hidden_at" + t.index ["legislation_question_id"], name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3" + t.index ["locale"], name: "index_legislation_question_translations_on_locale" + end + + create_table "legislation_questions", id: :serial, force: :cascade do |t| + t.integer "legislation_process_id" + t.integer "answers_count", default: 0 + t.datetime "hidden_at" + t.datetime "created_at", null: false + 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" + t.index ["legislation_process_id"], name: "index_legislation_questions_on_legislation_process_id" + end + + create_table "links", id: :serial, force: :cascade do |t| + t.string "label" + t.string "url" + t.string "linkable_type" + t.integer "linkable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["linkable_type", "linkable_id"], name: "index_links_on_linkable_type_and_linkable_id" + end + + create_table "local_census_records", id: :serial, force: :cascade do |t| + t.string "document_number", null: false + t.string "document_type", null: false + t.date "date_of_birth", null: false + t.string "postal_code", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["document_number", "document_type"], name: "index_local_census_records_on_document_number_and_document_type", unique: true + t.index ["document_number"], name: "index_local_census_records_on_document_number" + end + + create_table "locks", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "tries", default: 0 + 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" + end + + create_table "managers", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.index ["user_id"], name: "index_managers_on_user_id" + end + + create_table "map_locations", id: :serial, 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 + t.index ["investment_id"], name: "index_map_locations_on_investment_id" + t.index ["proposal_id"], name: "index_map_locations_on_proposal_id" end - create_table "milestone_statuses", force: :cascade do |t| - t.string "name" - t.text "description" + create_table "milestone_statuses", id: :serial, 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 - - create_table "milestone_translations", force: :cascade do |t| - t.integer "milestone_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - 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 - - create_table "milestones", force: :cascade do |t| - t.string "milestoneable_type" - t.integer "milestoneable_id" - 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 - - create_table "moderators", force: :cascade do |t| - t.integer "user_id" - t.index ["user_id"], name: "index_moderators_on_user_id", using: :btree - end - - create_table "newsletters", force: :cascade do |t| - t.string "subject" - t.string "segment_recipient", null: false - t.string "from" - t.text "body" - t.date "sent_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "hidden_at" - end - - create_table "notifications", force: :cascade do |t| - t.integer "user_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 - - 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 - - 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 - - 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 - - create_table "poll_ballots", force: :cascade do |t| - t.integer "ballot_sheet_id" - t.text "data" - t.integer "external_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "poll_booth_assignments", force: :cascade do |t| - t.integer "booth_id" - 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 + t.index ["hidden_at"], name: "index_milestone_statuses_on_hidden_at" end - create_table "poll_booths", force: :cascade do |t| + create_table "milestone_translations", id: :serial, force: :cascade do |t| + t.integer "milestone_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "description" + t.index ["locale"], name: "index_milestone_translations_on_locale" + t.index ["milestone_id"], name: "index_milestone_translations_on_milestone_id" + end + + create_table "milestones", id: :serial, force: :cascade do |t| + t.string "milestoneable_type" + t.integer "milestoneable_id" + 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" + end + + create_table "moderators", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.index ["user_id"], name: "index_moderators_on_user_id" + end + + create_table "newsletters", id: :serial, force: :cascade do |t| + t.string "subject" + t.string "segment_recipient", null: false + t.string "from" + t.text "body" + t.date "sent_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "hidden_at" + end + + create_table "notifications", id: :serial, force: :cascade do |t| + t.integer "user_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" + end + + create_table "organizations", id: :serial, 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" + end + + create_table "poll_answers", id: :serial, 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" + t.index ["question_id", "answer"], name: "index_poll_answers_on_question_id_and_answer" + t.index ["question_id"], name: "index_poll_answers_on_question_id" + end + + create_table "poll_ballot_sheets", id: :serial, 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" + t.index ["poll_id"], name: "index_poll_ballot_sheets_on_poll_id" + end + + create_table "poll_ballots", id: :serial, force: :cascade do |t| + t.integer "ballot_sheet_id" + t.text "data" + t.integer "external_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "poll_booth_assignments", id: :serial, force: :cascade do |t| + t.integer "booth_id" + 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" + t.index ["poll_id"], name: "index_poll_booth_assignments_on_poll_id" + end + + create_table "poll_booths", id: :serial, force: :cascade do |t| t.string "name" t.string "location" end - create_table "poll_officer_assignments", force: :cascade do |t| - t.integer "booth_assignment_id" - t.integer "officer_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - 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 + create_table "poll_officer_assignments", id: :serial, force: :cascade do |t| + t.integer "booth_assignment_id" + t.integer "officer_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + 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" + t.index ["officer_id"], name: "index_poll_officer_assignments_on_officer_id" end - create_table "poll_officers", force: :cascade do |t| + create_table "poll_officers", id: :serial, 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 + t.index ["user_id"], name: "index_poll_officers_on_user_id" end - create_table "poll_partial_results", force: :cascade do |t| + create_table "poll_partial_results", id: :serial, force: :cascade do |t| t.integer "question_id" t.integer "author_id" - t.string "answer" + t.string "answer" t.integer "amount" - t.string "origin" - t.date "date" + t.string "origin" + t.date "date" t.integer "booth_assignment_id" t.integer "officer_assignment_id" - 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 + 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" + t.index ["author_id"], name: "index_poll_partial_results_on_author_id" + t.index ["booth_assignment_id", "date"], name: "index_poll_partial_results_on_booth_assignment_id_and_date" + t.index ["origin"], name: "index_poll_partial_results_on_origin" + t.index ["question_id"], name: "index_poll_partial_results_on_question_id" end - create_table "poll_question_answer_translations", force: :cascade do |t| - t.integer "poll_question_answer_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - 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 + create_table "poll_question_answer_translations", id: :serial, force: :cascade do |t| + t.integer "poll_question_answer_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "description" + t.index ["locale"], name: "index_poll_question_answer_translations_on_locale" + t.index ["poll_question_answer_id"], name: "index_85270fa85f62081a3a227186b4c95fe4f7fa94b9" end - create_table "poll_question_answer_videos", force: :cascade do |t| - t.string "title" - t.string "url" + create_table "poll_question_answer_videos", id: :serial, 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 + t.index ["answer_id"], name: "index_poll_question_answer_videos_on_answer_id" end - create_table "poll_question_answers", force: :cascade do |t| + create_table "poll_question_answers", id: :serial, force: :cascade do |t| 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 + t.boolean "most_voted", default: false + t.index ["question_id"], name: "index_poll_question_answers_on_question_id" end - 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" + create_table "poll_question_translations", id: :serial, 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.datetime "hidden_at" - t.index ["hidden_at"], name: "index_poll_question_translations_on_hidden_at", using: :btree - 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 + t.index ["hidden_at"], name: "index_poll_question_translations_on_hidden_at" + t.index ["locale"], name: "index_poll_question_translations_on_locale" + t.index ["poll_question_id"], name: "index_poll_question_translations_on_poll_question_id" end - create_table "poll_questions", force: :cascade do |t| - t.integer "proposal_id" - t.integer "poll_id" - t.integer "author_id" - t.string "author_visible_name" - t.integer "comments_count" + create_table "poll_questions", id: :serial, force: :cascade do |t| + t.integer "proposal_id" + t.integer "poll_id" + t.integer "author_id" + t.string "author_visible_name" + t.integer "comments_count" t.datetime "hidden_at" t.datetime "created_at" 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.string "video_url" + t.index ["author_id"], name: "index_poll_questions_on_author_id" + t.index ["poll_id"], name: "index_poll_questions_on_poll_id" + t.index ["proposal_id"], name: "index_poll_questions_on_proposal_id" t.index ["tsv"], name: "index_poll_questions_on_tsv", using: :gin end - create_table "poll_recounts", force: :cascade do |t| + create_table "poll_recounts", id: :serial, force: :cascade do |t| t.integer "author_id" - t.string "origin" - t.date "date" + t.string "origin" + t.date "date" t.integer "booth_assignment_id" t.integer "officer_assignment_id" - t.text "officer_assignment_id_log", default: "" - t.text "author_id_log", default: "" - t.integer "white_amount", default: 0 - t.text "white_amount_log", default: "" - t.integer "null_amount", default: 0 - 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 + t.text "officer_assignment_id_log", default: "" + t.text "author_id_log", default: "" + t.integer "white_amount", default: 0 + t.text "white_amount_log", default: "" + t.integer "null_amount", default: 0 + 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" + t.index ["officer_assignment_id"], name: "index_poll_recounts_on_officer_assignment_id" end - create_table "poll_shifts", force: :cascade do |t| - t.integer "booth_id" - t.integer "officer_id" - t.date "date" + create_table "poll_shifts", id: :serial, force: :cascade do |t| + t.integer "booth_id" + t.integer "officer_id" + t.date "date" t.datetime "created_at" t.datetime "updated_at" - 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 + 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 + t.index ["booth_id"], name: "index_poll_shifts_on_booth_id" + t.index ["officer_id"], name: "index_poll_shifts_on_officer_id" end - create_table "poll_translations", force: :cascade do |t| - t.integer "poll_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name" - t.text "summary" - t.text "description" + create_table "poll_translations", id: :serial, force: :cascade do |t| + t.integer "poll_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name" + t.text "summary" + t.text "description" t.datetime "hidden_at" - t.index ["hidden_at"], name: "index_poll_translations_on_hidden_at", using: :btree - t.index ["locale"], name: "index_poll_translations_on_locale", using: :btree - t.index ["poll_id"], name: "index_poll_translations_on_poll_id", using: :btree + t.index ["hidden_at"], name: "index_poll_translations_on_hidden_at" + t.index ["locale"], name: "index_poll_translations_on_locale" + t.index ["poll_id"], name: "index_poll_translations_on_poll_id" end - create_table "poll_voters", force: :cascade do |t| - t.string "document_number" - t.string "document_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "poll_id", null: false - t.integer "booth_assignment_id" - t.integer "age" - t.string "gender" - t.integer "geozone_id" - t.integer "answer_id" - t.integer "officer_assignment_id" - t.integer "user_id" - 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 + create_table "poll_voters", id: :serial, force: :cascade do |t| + t.string "document_number" + t.string "document_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "poll_id", null: false + t.integer "booth_assignment_id" + t.integer "age" + t.string "gender" + t.integer "geozone_id" + t.integer "answer_id" + t.integer "officer_assignment_id" + t.integer "user_id" + t.string "origin" + t.integer "officer_id" + t.string "token" + t.index ["booth_assignment_id"], name: "index_poll_voters_on_booth_assignment_id" + t.index ["document_number"], name: "index_poll_voters_on_document_number" + t.index ["officer_assignment_id"], name: "index_poll_voters_on_officer_assignment_id" + t.index ["poll_id", "document_number", "document_type"], name: "doc_by_poll" + t.index ["poll_id"], name: "index_poll_voters_on_poll_id" + t.index ["user_id"], name: "index_poll_voters_on_user_id" end - create_table "polls", force: :cascade do |t| + create_table "polls", id: :serial, force: :cascade do |t| t.datetime "starts_at" t.datetime "ends_at" - t.boolean "published", default: false - t.boolean "geozone_restricted", default: false - t.integer "comments_count", default: 0 - t.integer "author_id" + t.boolean "published", default: false + t.boolean "geozone_restricted", default: false + t.integer "comments_count", default: 0 + t.integer "author_id" t.datetime "hidden_at" - t.string "slug" + t.string "slug" t.datetime "created_at" t.datetime "updated_at" - t.integer "budget_id" - t.string "related_type" - t.integer "related_id" - t.index ["budget_id"], name: "index_polls_on_budget_id", unique: true, using: :btree - t.index ["related_type", "related_id"], name: "index_polls_on_related_type_and_related_id", using: :btree - t.index ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at", using: :btree + t.integer "budget_id" + t.string "related_type" + t.integer "related_id" + t.index ["budget_id"], name: "index_polls_on_budget_id", unique: true + t.index ["related_type", "related_id"], name: "index_polls_on_related_type_and_related_id" + t.index ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at" end - 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 + create_table "progress_bar_translations", id: :serial, 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" + t.index ["progress_bar_id"], name: "index_progress_bar_translations_on_progress_bar_id" end - create_table "progress_bars", force: :cascade do |t| - t.integer "kind" - t.integer "percentage" - t.string "progressable_type" - t.integer "progressable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "progress_bars", id: :serial, force: :cascade do |t| + t.integer "kind" + t.integer "percentage" + t.string "progressable_type" + t.integer "progressable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "proposal_notifications", force: :cascade do |t| - t.string "title" - t.text "body" - t.integer "author_id" - t.integer "proposal_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "moderated", default: false + create_table "proposal_notifications", id: :serial, force: :cascade do |t| + t.string "title" + t.text "body" + t.integer "author_id" + t.integer "proposal_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "moderated", default: false t.datetime "hidden_at" t.datetime "ignored_at" t.datetime "confirmed_hide_at" end - create_table "proposal_translations", force: :cascade do |t| - t.integer "proposal_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "title" - t.text "description" - t.text "summary" - t.text "retired_explanation" + create_table "proposal_translations", id: :serial, force: :cascade do |t| + t.integer "proposal_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.text "description" + t.text "summary" + t.text "retired_explanation" t.datetime "hidden_at" - t.index ["hidden_at"], name: "index_proposal_translations_on_hidden_at", using: :btree - t.index ["locale"], name: "index_proposal_translations_on_locale", using: :btree - t.index ["proposal_id"], name: "index_proposal_translations_on_proposal_id", using: :btree + t.index ["hidden_at"], name: "index_proposal_translations_on_hidden_at" + t.index ["locale"], name: "index_proposal_translations_on_locale" + t.index ["proposal_id"], name: "index_proposal_translations_on_proposal_id" end - create_table "proposals", force: :cascade do |t| - t.string "deprecated_title", limit: 80 - t.text "deprecated_description" - t.integer "author_id" + create_table "proposals", id: :serial, force: :cascade do |t| + t.string "deprecated_title", limit: 80 + t.text "deprecated_description" + t.integer "author_id" t.datetime "hidden_at" - t.integer "flags_count", default: 0 + t.integer "flags_count", default: 0 t.datetime "ignored_flag_at" - t.integer "cached_votes_up", default: 0 - t.integer "comments_count", default: 0 + t.integer "cached_votes_up", default: 0 + t.integer "comments_count", default: 0 t.datetime "confirmed_hide_at" - t.bigint "hot_score", default: 0 - t.integer "confidence_score", default: 0 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "responsible_name", limit: 60 - t.text "deprecated_summary" - t.string "video_url" + t.bigint "hot_score", default: 0 + t.integer "confidence_score", default: 0 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "responsible_name", limit: 60 + t.text "deprecated_summary" + t.string "video_url" t.tsvector "tsv" - t.integer "geozone_id" + t.integer "geozone_id" t.datetime "retired_at" - t.string "retired_reason" - t.text "deprecated_retired_explanation" - t.integer "community_id" + t.string "retired_reason" + t.text "deprecated_retired_explanation" + t.integer "community_id" t.datetime "published_at" - t.boolean "selected", default: false - 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.boolean "selected", default: false + t.index ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at" + t.index ["author_id"], name: "index_proposals_on_author_id" + t.index ["cached_votes_up"], name: "index_proposals_on_cached_votes_up" + t.index ["community_id"], name: "index_proposals_on_community_id" + t.index ["confidence_score"], name: "index_proposals_on_confidence_score" + t.index ["geozone_id"], name: "index_proposals_on_geozone_id" + t.index ["hidden_at"], name: "index_proposals_on_hidden_at" + t.index ["hot_score"], name: "index_proposals_on_hot_score" t.index ["tsv"], name: "index_proposals_on_tsv", using: :gin end - create_table "related_content_scores", force: :cascade do |t| + create_table "related_content_scores", id: :serial, 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 + t.index ["related_content_id"], name: "index_related_content_scores_on_related_content_id" + t.index ["user_id", "related_content_id"], name: "unique_user_related_content_scoring", unique: true + t.index ["user_id"], name: "index_related_content_scores_on_user_id" end - create_table "related_contents", force: :cascade do |t| - t.string "parent_relationable_type" - t.integer "parent_relationable_id" - t.string "child_relationable_type" - t.integer "child_relationable_id" - t.integer "related_content_id" + create_table "related_contents", id: :serial, force: :cascade do |t| + t.string "parent_relationable_type" + 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 + 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" + t.index ["hidden_at"], name: "index_related_contents_on_hidden_at" + t.index ["parent_relationable_id", "parent_relationable_type", "child_relationable_id", "child_relationable_type"], name: "unique_parent_child_related_content", unique: true + t.index ["parent_relationable_type", "parent_relationable_id"], name: "index_related_contents_on_parent_relationable" + t.index ["related_content_id"], name: "opposite_related_content" end - create_table "remote_translations", force: :cascade do |t| - t.string "locale" - t.integer "remote_translatable_id" - t.string "remote_translatable_type" - t.text "error_message" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "reports", force: :cascade do |t| - t.boolean "stats" - t.boolean "results" - t.string "process_type" - t.integer "process_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "advanced_stats" - t.index ["process_type", "process_id"], name: "index_reports_on_process_type_and_process_id", using: :btree - end - - create_table "settings", force: :cascade do |t| - t.string "key" - t.string "value" - t.index ["key"], name: "index_settings_on_key", using: :btree - end - - create_table "signature_sheets", force: :cascade do |t| - t.string "signable_type" - t.integer "signable_id" - t.text "required_fields_to_verify" - t.boolean "processed", default: false - t.integer "author_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "title" - end - - create_table "signatures", force: :cascade do |t| - t.integer "signature_sheet_id" - t.integer "user_id" - t.string "document_number" - t.boolean "verified", default: false - t.datetime "created_at" - t.datetime "updated_at" - t.date "date_of_birth" - t.string "postal_code" - end - - create_table "site_customization_content_blocks", force: :cascade do |t| - t.string "name" - t.string "locale" - t.text "body" + create_table "remote_translations", id: :serial, force: :cascade do |t| + t.string "locale" + t.integer "remote_translatable_id" + t.string "remote_translatable_type" + t.text "error_message" 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 - create_table "site_customization_images", force: :cascade do |t| - t.string "name", null: false - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - 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 + create_table "reports", id: :serial, force: :cascade do |t| + t.boolean "stats" + t.boolean "results" + t.string "process_type" + t.integer "process_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "advanced_stats" + t.index ["process_type", "process_id"], name: "index_reports_on_process_type_and_process_id" end - create_table "site_customization_page_translations", force: :cascade do |t| - t.integer "site_customization_page_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - 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 + create_table "settings", id: :serial, force: :cascade do |t| + t.string "key" + t.string "value" + t.index ["key"], name: "index_settings_on_key" end - create_table "site_customization_pages", force: :cascade do |t| - t.string "slug", null: false - t.boolean "more_info_flag" - t.boolean "print_content_flag" - t.string "status", default: "draft" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "locale" - end - - create_table "stats_versions", force: :cascade do |t| - t.string "process_type" - t.integer "process_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["process_type", "process_id"], name: "index_stats_versions_on_process_type_and_process_id", using: :btree - end - - create_table "taggings", force: :cascade do |t| - t.integer "tag_id" - t.string "taggable_type" - t.integer "taggable_id" - t.string "tagger_type" - t.integer "tagger_id" - t.string "context", limit: 128 + create_table "signature_sheets", id: :serial, force: :cascade do |t| + t.string "signable_type" + t.integer "signable_id" + t.text "required_fields_to_verify" + t.boolean "processed", default: false + t.integer "author_id" 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 + t.datetime "updated_at" + t.string "title" end - create_table "tags", force: :cascade do |t| - t.string "name", limit: 160 - t.integer "taggings_count", default: 0 - t.integer "debates_count", default: 0 - t.integer "proposals_count", default: 0 - t.string "kind" - 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 + create_table "signatures", id: :serial, force: :cascade do |t| + t.integer "signature_sheet_id" + t.integer "user_id" + t.string "document_number" + t.boolean "verified", default: false + t.datetime "created_at" + t.datetime "updated_at" + t.date "date_of_birth" + t.string "postal_code" end - create_table "topics", force: :cascade do |t| - t.string "title", null: false - t.text "description" - t.integer "author_id" - t.integer "comments_count", default: 0 - t.integer "community_id" + create_table "site_customization_content_blocks", id: :serial, force: :cascade do |t| + t.string "name" + t.string "locale" + 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 + end + + create_table "site_customization_images", id: :serial, force: :cascade do |t| + t.string "name", null: false + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + 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 + end + + create_table "site_customization_page_translations", id: :serial, force: :cascade do |t| + t.integer "site_customization_page_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "title" + t.string "subtitle" + t.text "content" + t.index ["locale"], name: "index_site_customization_page_translations_on_locale" + t.index ["site_customization_page_id"], name: "index_7fa0f9505738cb31a31f11fb2f4c4531fed7178b" + end + + create_table "site_customization_pages", id: :serial, force: :cascade do |t| + t.string "slug", null: false + t.boolean "more_info_flag" + t.boolean "print_content_flag" + t.string "status", default: "draft" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "locale" + end + + create_table "stats_versions", id: :serial, force: :cascade do |t| + t.string "process_type" + t.integer "process_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["process_type", "process_id"], name: "index_stats_versions_on_process_type_and_process_id" + end + + create_table "taggings", id: :serial, force: :cascade do |t| + t.integer "tag_id" + t.string "taggable_type" + 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" + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" + end + + create_table "tags", id: :serial, force: :cascade do |t| + t.string "name", limit: 160 + t.integer "taggings_count", default: 0 + t.integer "debates_count", default: 0 + t.integer "proposals_count", default: 0 + t.string "kind" + 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" + t.index ["legislation/processes_count"], name: "index_tags_on_legislation/processes_count" + t.index ["legislation/proposals_count"], name: "index_tags_on_legislation/proposals_count" + t.index ["name"], name: "index_tags_on_name", unique: true + t.index ["proposals_count"], name: "index_tags_on_proposals_count" + end + + create_table "topics", id: :serial, force: :cascade do |t| + t.string "title", null: false + t.text "description" + t.integer "author_id" + t.integer "comments_count", default: 0 + t.integer "community_id" 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 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["community_id"], name: "index_topics_on_community_id" + t.index ["hidden_at"], name: "index_topics_on_hidden_at" end - create_table "users", force: :cascade do |t| - t.string "email", default: "" - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + create_table "users", id: :serial, force: :cascade do |t| + t.string "email", default: "" + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "confirmation_token" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "unconfirmed_email" - t.boolean "email_on_comment", default: false - t.boolean "email_on_comment_reply", default: false - t.string "phone_number", limit: 30 - t.string "official_position" - t.integer "official_level", default: 0 + t.string "unconfirmed_email" + t.boolean "email_on_comment", default: false + t.boolean "email_on_comment_reply", default: false + t.string "phone_number", limit: 30 + t.string "official_position" + t.integer "official_level", default: 0 t.datetime "hidden_at" - t.string "sms_confirmation_code" - t.string "username", limit: 60 - t.string "document_number" - t.string "document_type" + t.string "sms_confirmation_code" + t.string "username", limit: 60 + t.string "document_number" + t.string "document_type" t.datetime "residence_verified_at" - t.string "email_verification_token" + t.string "email_verification_token" t.datetime "verified_at" - t.string "unconfirmed_phone" - t.string "confirmed_phone" + t.string "unconfirmed_phone" + t.string "confirmed_phone" t.datetime "letter_requested_at" t.datetime "confirmed_hide_at" - t.string "letter_verification_code" - t.integer "failed_census_calls_count", default: 0 + t.string "letter_verification_code" + t.integer "failed_census_calls_count", default: 0 t.datetime "level_two_verified_at" - t.string "erase_reason" + t.string "erase_reason" t.datetime "erased_at" - t.boolean "public_activity", default: true - t.boolean "newsletter", default: true - t.integer "notifications_count", default: 0 - t.boolean "registering_with_oauth", default: false - t.string "locale" - t.string "oauth_email" - t.integer "geozone_id" - t.string "redeemable_code" - t.string "gender", limit: 10 + t.boolean "public_activity", default: true + t.boolean "newsletter", default: true + t.integer "notifications_count", default: 0 + t.boolean "registering_with_oauth", default: false + t.string "locale" + t.string "oauth_email" + t.integer "geozone_id" + t.string "redeemable_code" + t.string "gender", limit: 10 t.datetime "date_of_birth" - t.boolean "email_on_proposal_notification", default: true - t.boolean "email_digest", default: true - t.boolean "email_on_direct_message", default: true - t.boolean "official_position_badge", default: false - t.datetime "password_changed_at", default: '2015-01-01 01:01:01', null: false - t.boolean "created_from_signature", default: false - t.integer "failed_email_digests_count", default: 0 - t.text "former_users_data_log", default: "" - t.integer "balloted_heading_id" - 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 + t.boolean "email_on_proposal_notification", default: true + t.boolean "email_digest", default: true + t.boolean "email_on_direct_message", default: true + t.boolean "official_position_badge", default: false + t.datetime "password_changed_at", default: "2015-01-01 01:01:01", null: false + t.boolean "created_from_signature", default: false + t.integer "failed_email_digests_count", default: 0 + t.text "former_users_data_log", default: "" + t.integer "balloted_heading_id" + 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 + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["geozone_id"], name: "index_users_on_geozone_id" + t.index ["hidden_at"], name: "index_users_on_hidden_at" + t.index ["password_changed_at"], name: "index_users_on_password_changed_at" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["username"], name: "index_users_on_username" end - create_table "valuator_groups", force: :cascade do |t| - t.string "name" + create_table "valuator_groups", id: :serial, force: :cascade do |t| + t.string "name" t.integer "budget_investments_count", default: 0 end - create_table "valuators", force: :cascade do |t| + create_table "valuators", id: :serial, force: :cascade do |t| t.integer "user_id" - t.string "description" + t.string "description" t.integer "budget_investments_count", default: 0 t.integer "valuator_group_id" - t.boolean "can_comment", default: true - t.boolean "can_edit_dossier", default: true - t.index ["user_id"], name: "index_valuators_on_user_id", using: :btree + t.boolean "can_comment", default: true + t.boolean "can_edit_dossier", default: true + t.index ["user_id"], name: "index_valuators_on_user_id" end - create_table "verified_users", force: :cascade do |t| - t.string "document_number" - t.string "document_type" - t.string "phone" - 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 + create_table "verified_users", id: :serial, force: :cascade do |t| + t.string "document_number" + t.string "document_type" + t.string "phone" + 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" + t.index ["email"], name: "index_verified_users_on_email" + t.index ["phone"], name: "index_verified_users_on_phone" end create_table "visits", id: :uuid, default: nil, force: :cascade do |t| - t.uuid "visitor_id" - t.string "ip" - t.text "user_agent" - t.text "referrer" - t.text "landing_page" - t.integer "user_id" - t.string "referring_domain" - t.string "search_keyword" - t.string "browser" - t.string "os" - t.string "device_type" - t.integer "screen_height" - t.integer "screen_width" - t.string "country" - t.string "region" - t.string "city" - t.string "postal_code" - t.decimal "latitude" - t.decimal "longitude" - t.string "utm_source" - t.string "utm_medium" - t.string "utm_term" - t.string "utm_content" - t.string "utm_campaign" + t.uuid "visitor_id" + t.string "ip" + t.text "user_agent" + t.text "referrer" + t.text "landing_page" + t.integer "user_id" + t.string "referring_domain" + t.string "search_keyword" + t.string "browser" + t.string "os" + t.string "device_type" + t.integer "screen_height" + t.integer "screen_width" + t.string "country" + t.string "region" + t.string "city" + t.string "postal_code" + t.decimal "latitude" + t.decimal "longitude" + t.string "utm_source" + t.string "utm_medium" + t.string "utm_term" + 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 + t.index ["started_at"], name: "index_visits_on_started_at" + t.index ["user_id"], name: "index_visits_on_user_id" end - create_table "votes", force: :cascade do |t| - t.string "votable_type" - t.integer "votable_id" - t.string "voter_type" - t.integer "voter_id" - t.boolean "vote_flag" - t.string "vote_scope" - t.integer "vote_weight" + create_table "votes", id: :serial, force: :cascade do |t| + t.string "votable_type" + 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 + t.integer "signature_id" + t.index ["signature_id"], name: "index_votes_on_signature_id" + t.index ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope" + t.index ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope" end - create_table "web_sections", force: :cascade do |t| - t.text "name" + create_table "web_sections", id: :serial, force: :cascade do |t| + t.text "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "widget_card_translations", force: :cascade do |t| - t.integer "widget_card_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "label" - 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 + create_table "widget_card_translations", id: :serial, force: :cascade do |t| + t.integer "widget_card_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "label" + t.string "title" + t.text "description" + t.string "link_text" + t.index ["locale"], name: "index_widget_card_translations_on_locale" + t.index ["widget_card_id"], name: "index_widget_card_translations_on_widget_card_id" end - create_table "widget_cards", force: :cascade do |t| - t.string "link_url" - t.boolean "header", default: false - t.datetime "created_at", null: false - 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 + create_table "widget_cards", id: :serial, force: :cascade do |t| + t.string "link_url" + t.boolean "header", default: false + t.datetime "created_at", null: false + 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" end - create_table "widget_feeds", force: :cascade do |t| - t.string "kind" - t.integer "limit", default: 3 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "widget_feeds", id: :serial, force: :cascade do |t| + t.string "kind" + t.integer "limit", default: 3 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_foreign_key "administrators", "users" From 3526aef1e42261726fddf6c9f81127bd96dbbdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Oct 2019 19:02:41 +0200 Subject: [PATCH 03/16] Remove callback terminator initializer We no longer need it since this is the default behavior in Rails 5.1. --- config/initializers/callback_terminator.rb | 1 - 1 file changed, 1 deletion(-) delete mode 100644 config/initializers/callback_terminator.rb diff --git a/config/initializers/callback_terminator.rb b/config/initializers/callback_terminator.rb deleted file mode 100644 index de64962d2..000000000 --- a/config/initializers/callback_terminator.rb +++ /dev/null @@ -1 +0,0 @@ -ActiveSupport.halt_callback_chains_on_return_false = false From 1118c732f11201f399ba41cf8a2a38d9f4ee4db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 19 Jun 2019 15:52:16 +0200 Subject: [PATCH 04/16] Bump acts-as-taggable-on to 6.0.0 Rails 5.1 introduced certain changes in the way a record is touched when the counter cache option is enabled in a belongs to association. We need to upgrade acts-as-taggable-on so it keeps changing the `updated_at` attribute when a new tag is added to a record. Note we now need to reload the records in some cases to get the `context_tag_list` method to return what we expect. Methods like `context_tags` however work properly with no need to reload the record. --- Gemfile | 2 +- Gemfile.lock | 6 ++--- ...ique_indices.acts_as_taggable_on_engine.rb | 17 ++++++++++++++ ..._on_taggings.acts_as_taggable_on_engine.rb | 22 +++++++++++++++++++ db/schema.rb | 7 ++++++ spec/models/budget/investment_spec.rb | 2 +- spec/models/legislation/process_spec.rb | 2 +- spec/models/proposal_spec.rb | 2 +- 8 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20190619133544_add_missing_unique_indices.acts_as_taggable_on_engine.rb create mode 100644 db/migrate/20190619133547_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb diff --git a/Gemfile b/Gemfile index 716f7c21b..8fa28ccf9 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" gem "rails", "5.1.7" -gem "acts-as-taggable-on", "~> 5.0.0" +gem "acts-as-taggable-on", "~> 6.0.0" gem "acts_as_votable", "~> 0.11.1" gem "ahoy_matey", "~> 1.6.0" gem "ancestry", "~> 3.0.7" diff --git a/Gemfile.lock b/Gemfile.lock index 889d5e0cd..5b2eeb0e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,8 +47,8 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - acts-as-taggable-on (5.0.0) - activerecord (>= 4.2.8) + acts-as-taggable-on (6.0.0) + activerecord (~> 5.0) acts_as_votable (0.11.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) @@ -602,7 +602,7 @@ PLATFORMS ruby DEPENDENCIES - acts-as-taggable-on (~> 5.0.0) + acts-as-taggable-on (~> 6.0.0) acts_as_votable (~> 0.11.1) ahoy_matey (~> 1.6.0) ancestry (~> 3.0.7) diff --git a/db/migrate/20190619133544_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20190619133544_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..b766e234f --- /dev/null +++ b/db/migrate/20190619133544_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -0,0 +1,17 @@ +# This migration comes from acts_as_taggable_on_engine (originally 2) +if ActiveRecord.gem_version >= Gem::Version.new("5.0") + class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]; end +else + class AddMissingUniqueIndices < ActiveRecord::Migration; end +end +AddMissingUniqueIndices.class_eval do + def self.up + add_index :taggings, + [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: "taggings_idx" + end + + def self.down + remove_index :taggings, name: "taggings_idx" + end +end diff --git a/db/migrate/20190619133547_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20190619133547_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..185a6a3bf --- /dev/null +++ b/db/migrate/20190619133547_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -0,0 +1,22 @@ +# This migration comes from acts_as_taggable_on_engine (originally 6) +if ActiveRecord.gem_version >= Gem::Version.new("5.0") + class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end +else + class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end +end +AddMissingIndexesOnTaggings.class_eval do + def change + add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id + add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type + add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id + add_index :taggings, :context unless index_exists? :taggings, :context + + unless index_exists? :taggings, [:tagger_id, :tagger_type] + add_index :taggings, [:tagger_id, :tagger_type] + end + + unless index_exists? :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: "taggings_idy" + add_index :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: "taggings_idy" + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 3dafb07b9..57012aa3c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1390,8 +1390,15 @@ ActiveRecord::Schema.define(version: 20191108173350) do t.integer "tagger_id" t.string "context", limit: 128 t.datetime "created_at" + t.index ["context"], name: "index_taggings_on_context" + t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true t.index ["tag_id"], name: "index_taggings_on_tag_id" t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" + t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy" + t.index ["taggable_id"], name: "index_taggings_on_taggable_id" + t.index ["taggable_type"], name: "index_taggings_on_taggable_type" + t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type" + t.index ["tagger_id"], name: "index_taggings_on_tagger_id" end create_table "tags", id: :serial, force: :cascade do |t| diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index f358584c3..35961a911 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -1327,7 +1327,7 @@ describe Budget::Investment do let(:investment) { create(:budget_investment, :with_milestone_tags) } it "has milestone_tags" do - expect(investment.milestone_tag_list.count).to eq(1) + expect(investment.reload.milestone_tag_list.count).to eq(1) end end end diff --git a/spec/models/legislation/process_spec.rb b/spec/models/legislation/process_spec.rb index 6c31e175f..8a2c9eee7 100644 --- a/spec/models/legislation/process_spec.rb +++ b/spec/models/legislation/process_spec.rb @@ -218,7 +218,7 @@ describe Legislation::Process do let(:process) { create(:legislation_process, :with_milestone_tags) } it "has milestone_tags" do - expect(process.milestone_tag_list.count).to eq(1) + expect(process.reload.milestone_tag_list.count).to eq(1) end end end diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index b92d4726c..e15d796ae 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -1045,7 +1045,7 @@ describe Proposal do let(:proposal) { create(:proposal, :with_milestone_tags) } it "has milestone_tags" do - expect(proposal.milestone_tag_list.count).to eq(1) + expect(proposal.reload.milestone_tag_list.count).to eq(1) end end end From c6a8aa1301321f294bc3c3499522d22ef297780d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 26 Apr 2019 20:28:46 +0200 Subject: [PATCH 05/16] Replace `attribute_changed?` in `before` callbacks This method is deprecated in Rails 5.1 because its behavior will be different in `before` and `after` callbacks. Here we're replacing the deprecated `attribute_changed?` and `attribute_was` with `will_save_change_to_attribute?` and `attribute_in_database` during `before_save` callbacks. https://github.com/rails/rails/pull/32835/ --- app/models/budget/investment.rb | 2 +- app/models/poll/partial_result.rb | 8 ++++---- app/models/poll/recount.rb | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index d685b8507..347eeef2d 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -396,7 +396,7 @@ class Budget private def set_denormalized_ids - self.group_id = heading&.group_id if heading_id_changed? + self.group_id = heading&.group_id if will_save_change_to_heading_id? self.budget_id ||= heading&.group&.budget_id end diff --git a/app/models/poll/partial_result.rb b/app/models/poll/partial_result.rb index 134cf377d..d8e9cc18b 100644 --- a/app/models/poll/partial_result.rb +++ b/app/models/poll/partial_result.rb @@ -19,10 +19,10 @@ class Poll::PartialResult < ApplicationRecord before_save :update_logs def update_logs - if amount_changed? && amount_was.present? - self.amount_log += ":#{amount_was}" - self.officer_assignment_id_log += ":#{officer_assignment_id_was}" - self.author_id_log += ":#{author_id_was}" + if will_save_change_to_amount? && amount_in_database.present? + self.amount_log += ":#{amount_in_database}" + self.officer_assignment_id_log += ":#{officer_assignment_id_in_database}" + self.author_id_log += ":#{author_id_in_database}" end end end diff --git a/app/models/poll/recount.rb b/app/models/poll/recount.rb index 9895d99e8..b5fb52bbf 100644 --- a/app/models/poll/recount.rb +++ b/app/models/poll/recount.rb @@ -20,9 +20,9 @@ class Poll::Recount < ApplicationRecord amounts_changed = false [:white, :null, :total].each do |amount| - next unless send("#{amount}_amount_changed?") && send("#{amount}_amount_was").present? + next unless send("will_save_change_to_#{amount}_amount?") && send("#{amount}_amount_in_database").present? - self["#{amount}_amount_log"] += ":#{send("#{amount}_amount_was")}" + self["#{amount}_amount_log"] += ":#{send("#{amount}_amount_in_database")}" amounts_changed = true end @@ -30,7 +30,7 @@ class Poll::Recount < ApplicationRecord end def update_officer_author - self.officer_assignment_id_log += ":#{officer_assignment_id_was}" - self.author_id_log += ":#{author_id_was}" + self.officer_assignment_id_log += ":#{officer_assignment_id_in_database}" + self.author_id_log += ":#{author_id_in_database}" end end From 12774c74847c97c05cc5ed86abff3537ef984046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 26 Apr 2019 20:47:07 +0200 Subject: [PATCH 06/16] Replace `attribute_changed?` in `after` callbacks This method is deprecated in Rails 5.1 because its behavior will be different in `before` and `after` callbacks. We're replacing the deprecated `attribute_changed?` and `attribute_was` methods with `saved_change_to_attribute?` and `attribute_before_last_save` during `after_save` callbacks. https://github.com/rails/rails/pull/32835/ --- app/models/budget/investment.rb | 2 +- app/models/budget/phase.rb | 2 +- app/models/budget/reclassification.rb | 10 +++++----- spec/models/budget/investment_spec.rb | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 347eeef2d..f12bcee70 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -319,7 +319,7 @@ class Budget end def recalculate_heading_winners - Budget::Result.new(budget, heading).calculate_winners if incompatible_changed? + Budget::Result.new(budget, heading).calculate_winners if saved_change_to_incompatible? end def set_responsible_name diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index de3b8c0f1..8294b7c17 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -68,7 +68,7 @@ class Budget if enabled? next_enabled_phase&.update_column(:starts_at, ends_at) prev_enabled_phase&.update_column(:ends_at, starts_at) - elsif enabled_changed? + elsif saved_change_to_enabled? next_enabled_phase&.update_column(:starts_at, starts_at) end end diff --git a/app/models/budget/reclassification.rb b/app/models/budget/reclassification.rb index 9c8c5cf1c..798fb7ad4 100644 --- a/app/models/budget/reclassification.rb +++ b/app/models/budget/reclassification.rb @@ -7,7 +7,7 @@ class Budget end def check_for_reclassification - if heading_changed? + if saved_change_to_heading? log_heading_change store_reclassified_votes("heading_changed") remove_reclassified_votes @@ -17,16 +17,16 @@ class Budget end end - def heading_changed? - budget.balloting? && heading_id_changed? + def saved_change_to_heading? + budget.balloting? && saved_change_to_heading_id? end def marked_as_unfeasible? - budget.balloting? && feasibility_changed? && unfeasible? + budget.balloting? && saved_change_to_feasibility? && unfeasible? end def log_heading_change - update_column(:previous_heading_id, heading_id_was) + update_column(:previous_heading_id, heading_id_before_last_save) end def store_reclassified_votes(reason) diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index 35961a911..8a1b2ef29 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -1096,29 +1096,29 @@ describe Budget::Investment do let(:heading1) { create(:budget_heading, group: group) } let(:heading2) { create(:budget_heading, group: group) } - describe "heading_changed?" do + describe "saved_change_to_heading?" do it "returns true if budget is in balloting phase and heading has changed" do investment = create(:budget_investment, heading: heading1) - investment.heading = heading2 + investment.update!(heading: heading2) - expect(investment.heading_changed?).to eq(true) + expect(investment.saved_change_to_heading?).to eq(true) end it "returns false if heading has not changed" do - investment = create(:budget_investment) - investment.heading = investment.heading + investment = create(:budget_investment, heading: heading1) + investment.update!(heading: heading1) - expect(investment.heading_changed?).to eq(false) + expect(investment.saved_change_to_heading?).to eq(false) end it "returns false if budget is not balloting phase" do Budget::Phase::PHASE_KINDS.reject { |phase| phase == "balloting" }.each do |phase| budget.update!(phase: phase) - investment = create(:budget_investment, budget: budget) + investment = create(:budget_investment, heading: heading1) - investment.heading = heading2 + investment.update!(heading: heading2) - expect(investment.heading_changed?).to eq(false) + expect(investment.saved_change_to_heading?).to eq(false) end end end From 9427f014423870b45314ee2c71e2c04598bc2fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 29 Apr 2019 12:26:17 +0200 Subject: [PATCH 07/16] Use system specs instead of feature specs We get rid of database cleaner, and JavaScript tests are faster because between tests we now rollback transactions instead of truncating the database. --- Gemfile | 2 +- db/dev_seeds.rb | 6 ++- spec/lib/tasks/sitemap_spec.rb | 2 +- spec/rails_helper.rb | 6 --- .../admin_milestoneable.rb | 0 .../admin_progressable.rb | 0 .../{features => system}/documentable.rb | 0 .../shared/{features => system}/followable.rb | 0 spec/shared/{features => system}/imageable.rb | 0 spec/shared/{features => system}/mappable.rb | 0 .../{features => system}/milestoneable.rb | 0 .../nested_documentable.rb | 0 .../{features => system}/nested_imageable.rb | 0 .../{features => system}/notifiable_in_app.rb | 0 .../{features => system}/progressable.rb | 0 .../{features => system}/relationable.rb | 0 .../remotely_translatable.rb | 0 spec/spec_helper.rb | 52 +++---------------- spec/{features => system}/account_spec.rb | 0 .../admin/activity_spec.rb | 0 .../admin/admin_notifications_spec.rb | 0 .../admin/administrators_spec.rb | 0 .../{features => system}/admin/audits_spec.rb | 0 .../admin/banners_spec.rb | 0 .../admin/budget_groups_spec.rb | 0 .../admin/budget_headings_spec.rb | 0 .../admin/budget_investments_spec.rb | 0 .../admin/budget_phases_spec.rb | 0 .../admin/budgets_spec.rb | 0 .../admin/comments_spec.rb | 0 .../admin/dashboard/actions_spec.rb | 0 .../dashboard/administrator_tasks_spec.rb | 0 .../admin/debates_spec.rb | 0 .../admin/emails/emails_download_spec.rb | 0 .../admin/emails/newsletters_spec.rb | 0 .../admin/feature_flags_spec.rb | 0 .../admin/geozones_spec.rb | 0 .../admin/hidden_budget_investments_spec.rb | 0 .../admin/hidden_comments_spec.rb | 0 .../admin/hidden_debates_spec.rb | 0 .../admin/hidden_proposals_spec.rb | 0 .../admin/hidden_users_spec.rb | 0 .../admin/homepage/homepage_spec.rb | 0 .../admin/legislation/draft_versions_spec.rb | 0 .../admin/legislation/processes_spec.rb | 0 .../admin/legislation/proposals_spec.rb | 0 .../admin/legislation/questions_spec.rb | 0 .../local_census_records/imports_spec.rb | 0 .../admin/local_census_records_spec.rb | 0 .../admin/managers_spec.rb | 0 .../admin/milestone_statuses_spec.rb | 0 .../admin/moderators_spec.rb | 0 .../admin/officials_spec.rb | 0 .../admin/organizations_spec.rb | 0 .../admin/poll/active_polls_spec.rb | 0 .../admin/poll/booth_assigments_spec.rb | 0 .../admin/poll/booths_spec.rb | 0 .../admin/poll/officer_assignments_spec.rb | 0 .../admin/poll/officers_spec.rb | 0 .../admin/poll/polls_spec.rb | 0 .../poll/questions/answers/answers_spec.rb | 0 .../answers/documents/documents_spec.rb | 0 .../questions/answers/images/images_spec.rb | 0 .../questions/answers/videos/videos_spec.rb | 0 .../admin/poll/questions_spec.rb | 0 .../admin/poll/shifts_spec.rb | 0 .../admin/proposal_notifications_spec.rb | 0 .../admin/proposals_spec.rb | 0 .../admin/settings_spec.rb | 0 .../admin/signature_sheets_spec.rb | 0 .../site_customization/content_blocks_spec.rb | 0 .../site_customization/documents_spec.rb | 0 .../admin/site_customization/images_spec.rb | 0 .../information_texts_spec.rb | 0 .../admin/site_customization/pages_spec.rb | 0 spec/{features => system}/admin/stats_spec.rb | 0 .../admin/system_emails_spec.rb | 0 spec/{features => system}/admin/tags_spec.rb | 0 .../admin/translatable_spec.rb | 0 spec/{features => system}/admin/users_spec.rb | 0 .../admin/valuator_groups_spec.rb | 0 .../admin/valuators_spec.rb | 0 .../admin/verifications_spec.rb | 0 .../admin/widgets/cards_spec.rb | 0 spec/{features => system}/admin_spec.rb | 0 spec/{features => system}/banners_spec.rb | 0 .../budget_polls/ballot_sheets_spec.rb | 0 .../budget_polls/budgets_spec.rb | 0 .../budget_polls/officing_spec.rb | 0 .../budget_polls/polls_spec.rb | 0 .../budget_polls/questions_spec.rb | 0 .../budget_polls/voter_spec.rb | 0 .../budgets/ballots_spec.rb | 0 .../budgets/budgets_spec.rb | 0 .../budgets/executions_spec.rb | 0 .../budgets/groups_spec.rb | 0 .../budgets/investments_spec.rb | 0 .../budgets/results_spec.rb | 0 .../budgets/stats_spec.rb | 0 .../budgets/votes_spec.rb | 0 spec/{features => system}/campaigns_spec.rb | 0 spec/{features => system}/ckeditor_spec.rb | 0 .../comments/budget_investments_spec.rb | 0 .../budget_investments_valuation_spec.rb | 0 .../comments/debates_spec.rb | 0 .../comments/legislation_annotations_spec.rb | 0 .../comments/legislation_questions_spec.rb | 0 .../comments/poll_questions_spec.rb | 0 .../comments/polls_spec.rb | 0 .../comments/proposals_spec.rb | 0 .../comments/topics_spec.rb | 0 spec/{features => system}/communities_spec.rb | 0 .../dashboard/dashboard_spec.rb | 0 .../dashboard/mailing_spec.rb | 0 .../dashboard/polls_spec.rb | 0 .../dashboard/poster_spec.rb | 0 spec/{features => system}/debates_spec.rb | 0 .../direct_messages_spec.rb | 0 spec/{features => system}/emails_spec.rb | 0 spec/{features => system}/help_page_spec.rb | 0 spec/{features => system}/home_spec.rb | 0 .../legislation/draft_versions_spec.rb | 0 .../legislation/processes_spec.rb | 0 .../legislation/proposals_spec.rb | 0 .../legislation/questions_spec.rb | 0 .../{features => system}/localization_spec.rb | 0 .../management/account_spec.rb | 0 .../management/budget_investments_spec.rb | 0 .../management/document_verifications_spec.rb | 0 .../management/email_verifications_spec.rb | 0 .../management/localization_spec.rb | 0 .../management/managed_users_spec.rb | 0 .../management/proposals_spec.rb | 0 .../management/users_spec.rb | 0 spec/{features => system}/management_spec.rb | 0 .../moderation/budget_investments_spec.rb | 0 .../moderation/comments_spec.rb | 0 .../moderation/debates_spec.rb | 0 .../moderation/legislation_proposals_spec.rb | 0 .../moderation/proposal_notifications_spec.rb | 0 .../moderation/proposals_spec.rb | 0 .../moderation/users_spec.rb | 0 spec/{features => system}/moderation_spec.rb | 0 .../notifications_spec.rb | 0 .../official_positions_spec.rb | 0 .../officing/booth_spec.rb | 0 .../officing/residence_spec.rb | 0 .../officing/results_spec.rb | 0 .../officing/voters_spec.rb | 0 spec/{features => system}/officing_spec.rb | 0 .../organizations_spec.rb | 0 spec/{features => system}/polls/polls_spec.rb | 0 .../polls/questions_spec.rb | 0 .../polls/results_spec.rb | 0 spec/{features => system}/polls/voter_spec.rb | 0 .../proposal_ballots_spec.rb | 0 .../proposal_notifications_spec.rb | 0 spec/{features => system}/proposals_spec.rb | 0 .../registration_form_spec.rb | 0 .../remote_translations_spec.rb | 0 spec/{features => system}/sessions_spec.rb | 0 .../site_customization/content_blocks_spec.rb | 0 .../site_customization/custom_pages_spec.rb | 0 .../information_texts_spec.rb | 0 .../social_media_meta_tags_spec.rb | 0 spec/{features => system}/stats_spec.rb | 0 .../tags/budget_investments_spec.rb | 0 .../{features => system}/tags/debates_spec.rb | 0 .../tags/proposals_spec.rb | 0 spec/{features => system}/tags_spec.rb | 0 spec/{features => system}/topics_spec.rb | 0 spec/{features => system}/tracks_spec.rb | 0 .../{features => system}/translatable_spec.rb | 0 .../{features => system}/user_invites_spec.rb | 0 spec/{features => system}/users_auth_spec.rb | 0 spec/{features => system}/users_spec.rb | 0 .../valuation/budget_investments_spec.rb | 0 .../valuation/budgets_spec.rb | 0 spec/{features => system}/valuation_spec.rb | 0 .../verification/email_spec.rb | 0 .../verification/letter_spec.rb | 0 .../level_three_verification_spec.rb | 0 .../level_two_verification_spec.rb | 0 .../verification/residence_spec.rb | 0 .../verification/sms_spec.rb | 0 .../verification/verification_path_spec.rb | 0 .../verification/verified_user_spec.rb | 0 spec/{features => system}/votes_spec.rb | 0 spec/{features => system}/welcome_spec.rb | 0 spec/{features => system}/xss_spec.rb | 0 190 files changed, 14 insertions(+), 54 deletions(-) rename spec/shared/{features => system}/admin_milestoneable.rb (100%) rename spec/shared/{features => system}/admin_progressable.rb (100%) rename spec/shared/{features => system}/documentable.rb (100%) rename spec/shared/{features => system}/followable.rb (100%) rename spec/shared/{features => system}/imageable.rb (100%) rename spec/shared/{features => system}/mappable.rb (100%) rename spec/shared/{features => system}/milestoneable.rb (100%) rename spec/shared/{features => system}/nested_documentable.rb (100%) rename spec/shared/{features => system}/nested_imageable.rb (100%) rename spec/shared/{features => system}/notifiable_in_app.rb (100%) rename spec/shared/{features => system}/progressable.rb (100%) rename spec/shared/{features => system}/relationable.rb (100%) rename spec/shared/{features => system}/remotely_translatable.rb (100%) rename spec/{features => system}/account_spec.rb (100%) rename spec/{features => system}/admin/activity_spec.rb (100%) rename spec/{features => system}/admin/admin_notifications_spec.rb (100%) rename spec/{features => system}/admin/administrators_spec.rb (100%) rename spec/{features => system}/admin/audits_spec.rb (100%) rename spec/{features => system}/admin/banners_spec.rb (100%) rename spec/{features => system}/admin/budget_groups_spec.rb (100%) rename spec/{features => system}/admin/budget_headings_spec.rb (100%) rename spec/{features => system}/admin/budget_investments_spec.rb (100%) rename spec/{features => system}/admin/budget_phases_spec.rb (100%) rename spec/{features => system}/admin/budgets_spec.rb (100%) rename spec/{features => system}/admin/comments_spec.rb (100%) rename spec/{features => system}/admin/dashboard/actions_spec.rb (100%) rename spec/{features => system}/admin/dashboard/administrator_tasks_spec.rb (100%) rename spec/{features => system}/admin/debates_spec.rb (100%) rename spec/{features => system}/admin/emails/emails_download_spec.rb (100%) rename spec/{features => system}/admin/emails/newsletters_spec.rb (100%) rename spec/{features => system}/admin/feature_flags_spec.rb (100%) rename spec/{features => system}/admin/geozones_spec.rb (100%) rename spec/{features => system}/admin/hidden_budget_investments_spec.rb (100%) rename spec/{features => system}/admin/hidden_comments_spec.rb (100%) rename spec/{features => system}/admin/hidden_debates_spec.rb (100%) rename spec/{features => system}/admin/hidden_proposals_spec.rb (100%) rename spec/{features => system}/admin/hidden_users_spec.rb (100%) rename spec/{features => system}/admin/homepage/homepage_spec.rb (100%) rename spec/{features => system}/admin/legislation/draft_versions_spec.rb (100%) rename spec/{features => system}/admin/legislation/processes_spec.rb (100%) rename spec/{features => system}/admin/legislation/proposals_spec.rb (100%) rename spec/{features => system}/admin/legislation/questions_spec.rb (100%) rename spec/{features => system}/admin/local_census_records/imports_spec.rb (100%) rename spec/{features => system}/admin/local_census_records_spec.rb (100%) rename spec/{features => system}/admin/managers_spec.rb (100%) rename spec/{features => system}/admin/milestone_statuses_spec.rb (100%) rename spec/{features => system}/admin/moderators_spec.rb (100%) rename spec/{features => system}/admin/officials_spec.rb (100%) rename spec/{features => system}/admin/organizations_spec.rb (100%) rename spec/{features => system}/admin/poll/active_polls_spec.rb (100%) rename spec/{features => system}/admin/poll/booth_assigments_spec.rb (100%) rename spec/{features => system}/admin/poll/booths_spec.rb (100%) rename spec/{features => system}/admin/poll/officer_assignments_spec.rb (100%) rename spec/{features => system}/admin/poll/officers_spec.rb (100%) rename spec/{features => system}/admin/poll/polls_spec.rb (100%) rename spec/{features => system}/admin/poll/questions/answers/answers_spec.rb (100%) rename spec/{features => system}/admin/poll/questions/answers/documents/documents_spec.rb (100%) rename spec/{features => system}/admin/poll/questions/answers/images/images_spec.rb (100%) rename spec/{features => system}/admin/poll/questions/answers/videos/videos_spec.rb (100%) rename spec/{features => system}/admin/poll/questions_spec.rb (100%) rename spec/{features => system}/admin/poll/shifts_spec.rb (100%) rename spec/{features => system}/admin/proposal_notifications_spec.rb (100%) rename spec/{features => system}/admin/proposals_spec.rb (100%) rename spec/{features => system}/admin/settings_spec.rb (100%) rename spec/{features => system}/admin/signature_sheets_spec.rb (100%) rename spec/{features => system}/admin/site_customization/content_blocks_spec.rb (100%) rename spec/{features => system}/admin/site_customization/documents_spec.rb (100%) rename spec/{features => system}/admin/site_customization/images_spec.rb (100%) rename spec/{features => system}/admin/site_customization/information_texts_spec.rb (100%) rename spec/{features => system}/admin/site_customization/pages_spec.rb (100%) rename spec/{features => system}/admin/stats_spec.rb (100%) rename spec/{features => system}/admin/system_emails_spec.rb (100%) rename spec/{features => system}/admin/tags_spec.rb (100%) rename spec/{features => system}/admin/translatable_spec.rb (100%) rename spec/{features => system}/admin/users_spec.rb (100%) rename spec/{features => system}/admin/valuator_groups_spec.rb (100%) rename spec/{features => system}/admin/valuators_spec.rb (100%) rename spec/{features => system}/admin/verifications_spec.rb (100%) rename spec/{features => system}/admin/widgets/cards_spec.rb (100%) rename spec/{features => system}/admin_spec.rb (100%) rename spec/{features => system}/banners_spec.rb (100%) rename spec/{features => system}/budget_polls/ballot_sheets_spec.rb (100%) rename spec/{features => system}/budget_polls/budgets_spec.rb (100%) rename spec/{features => system}/budget_polls/officing_spec.rb (100%) rename spec/{features => system}/budget_polls/polls_spec.rb (100%) rename spec/{features => system}/budget_polls/questions_spec.rb (100%) rename spec/{features => system}/budget_polls/voter_spec.rb (100%) rename spec/{features => system}/budgets/ballots_spec.rb (100%) rename spec/{features => system}/budgets/budgets_spec.rb (100%) rename spec/{features => system}/budgets/executions_spec.rb (100%) rename spec/{features => system}/budgets/groups_spec.rb (100%) rename spec/{features => system}/budgets/investments_spec.rb (100%) rename spec/{features => system}/budgets/results_spec.rb (100%) rename spec/{features => system}/budgets/stats_spec.rb (100%) rename spec/{features => system}/budgets/votes_spec.rb (100%) rename spec/{features => system}/campaigns_spec.rb (100%) rename spec/{features => system}/ckeditor_spec.rb (100%) rename spec/{features => system}/comments/budget_investments_spec.rb (100%) rename spec/{features => system}/comments/budget_investments_valuation_spec.rb (100%) rename spec/{features => system}/comments/debates_spec.rb (100%) rename spec/{features => system}/comments/legislation_annotations_spec.rb (100%) rename spec/{features => system}/comments/legislation_questions_spec.rb (100%) rename spec/{features => system}/comments/poll_questions_spec.rb (100%) rename spec/{features => system}/comments/polls_spec.rb (100%) rename spec/{features => system}/comments/proposals_spec.rb (100%) rename spec/{features => system}/comments/topics_spec.rb (100%) rename spec/{features => system}/communities_spec.rb (100%) rename spec/{features => system}/dashboard/dashboard_spec.rb (100%) rename spec/{features => system}/dashboard/mailing_spec.rb (100%) rename spec/{features => system}/dashboard/polls_spec.rb (100%) rename spec/{features => system}/dashboard/poster_spec.rb (100%) rename spec/{features => system}/debates_spec.rb (100%) rename spec/{features => system}/direct_messages_spec.rb (100%) rename spec/{features => system}/emails_spec.rb (100%) rename spec/{features => system}/help_page_spec.rb (100%) rename spec/{features => system}/home_spec.rb (100%) rename spec/{features => system}/legislation/draft_versions_spec.rb (100%) rename spec/{features => system}/legislation/processes_spec.rb (100%) rename spec/{features => system}/legislation/proposals_spec.rb (100%) rename spec/{features => system}/legislation/questions_spec.rb (100%) rename spec/{features => system}/localization_spec.rb (100%) rename spec/{features => system}/management/account_spec.rb (100%) rename spec/{features => system}/management/budget_investments_spec.rb (100%) rename spec/{features => system}/management/document_verifications_spec.rb (100%) rename spec/{features => system}/management/email_verifications_spec.rb (100%) rename spec/{features => system}/management/localization_spec.rb (100%) rename spec/{features => system}/management/managed_users_spec.rb (100%) rename spec/{features => system}/management/proposals_spec.rb (100%) rename spec/{features => system}/management/users_spec.rb (100%) rename spec/{features => system}/management_spec.rb (100%) rename spec/{features => system}/moderation/budget_investments_spec.rb (100%) rename spec/{features => system}/moderation/comments_spec.rb (100%) rename spec/{features => system}/moderation/debates_spec.rb (100%) rename spec/{features => system}/moderation/legislation_proposals_spec.rb (100%) rename spec/{features => system}/moderation/proposal_notifications_spec.rb (100%) rename spec/{features => system}/moderation/proposals_spec.rb (100%) rename spec/{features => system}/moderation/users_spec.rb (100%) rename spec/{features => system}/moderation_spec.rb (100%) rename spec/{features => system}/notifications_spec.rb (100%) rename spec/{features => system}/official_positions_spec.rb (100%) rename spec/{features => system}/officing/booth_spec.rb (100%) rename spec/{features => system}/officing/residence_spec.rb (100%) rename spec/{features => system}/officing/results_spec.rb (100%) rename spec/{features => system}/officing/voters_spec.rb (100%) rename spec/{features => system}/officing_spec.rb (100%) rename spec/{features => system}/organizations_spec.rb (100%) rename spec/{features => system}/polls/polls_spec.rb (100%) rename spec/{features => system}/polls/questions_spec.rb (100%) rename spec/{features => system}/polls/results_spec.rb (100%) rename spec/{features => system}/polls/voter_spec.rb (100%) rename spec/{features => system}/proposal_ballots_spec.rb (100%) rename spec/{features => system}/proposal_notifications_spec.rb (100%) rename spec/{features => system}/proposals_spec.rb (100%) rename spec/{features => system}/registration_form_spec.rb (100%) rename spec/{features => system}/remote_translations_spec.rb (100%) rename spec/{features => system}/sessions_spec.rb (100%) rename spec/{features => system}/site_customization/content_blocks_spec.rb (100%) rename spec/{features => system}/site_customization/custom_pages_spec.rb (100%) rename spec/{features => system}/site_customization/information_texts_spec.rb (100%) rename spec/{features => system}/social_media_meta_tags_spec.rb (100%) rename spec/{features => system}/stats_spec.rb (100%) rename spec/{features => system}/tags/budget_investments_spec.rb (100%) rename spec/{features => system}/tags/debates_spec.rb (100%) rename spec/{features => system}/tags/proposals_spec.rb (100%) rename spec/{features => system}/tags_spec.rb (100%) rename spec/{features => system}/topics_spec.rb (100%) rename spec/{features => system}/tracks_spec.rb (100%) rename spec/{features => system}/translatable_spec.rb (100%) rename spec/{features => system}/user_invites_spec.rb (100%) rename spec/{features => system}/users_auth_spec.rb (100%) rename spec/{features => system}/users_spec.rb (100%) rename spec/{features => system}/valuation/budget_investments_spec.rb (100%) rename spec/{features => system}/valuation/budgets_spec.rb (100%) rename spec/{features => system}/valuation_spec.rb (100%) rename spec/{features => system}/verification/email_spec.rb (100%) rename spec/{features => system}/verification/letter_spec.rb (100%) rename spec/{features => system}/verification/level_three_verification_spec.rb (100%) rename spec/{features => system}/verification/level_two_verification_spec.rb (100%) rename spec/{features => system}/verification/residence_spec.rb (100%) rename spec/{features => system}/verification/sms_spec.rb (100%) rename spec/{features => system}/verification/verification_path_spec.rb (100%) rename spec/{features => system}/verification/verified_user_spec.rb (100%) rename spec/{features => system}/votes_spec.rb (100%) rename spec/{features => system}/welcome_spec.rb (100%) rename spec/{features => system}/xss_spec.rb (100%) diff --git a/Gemfile b/Gemfile index 8fa28ccf9..c72ff433b 100644 --- a/Gemfile +++ b/Gemfile @@ -82,7 +82,6 @@ group :test do gem "capybara", "~> 3.29.0" gem "capybara-webmock", "~> 0.5.3" gem "coveralls", "~> 0.8.22", require: false - gem "database_cleaner", "~> 1.7.0" gem "email_spec", "~> 2.2.0" gem "rspec-rails", "~> 3.8" gem "selenium-webdriver", "~> 3.141" @@ -94,6 +93,7 @@ group :development do gem "capistrano-rails", "~> 1.4.0", require: false gem "capistrano3-delayed-job", "~> 1.7.3" gem "capistrano3-puma", "~> 4.0.0" + gem "database_cleaner", "~> 1.7.0" gem "erb_lint", require: false gem "github_changelog_generator", "~> 1.15.0" gem "mdl", "~> 0.5.0", require: false diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index f3c154b64..a63ccd86d 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -1,5 +1,7 @@ -require "database_cleaner" -DatabaseCleaner.clean_with :truncation +unless Rails.env.test? + require "database_cleaner" + DatabaseCleaner.clean_with :truncation +end @logger = Logger.new(STDOUT) @logger.formatter = proc do |_severity, _datetime, _progname, msg| msg unless @avoid_log diff --git a/spec/lib/tasks/sitemap_spec.rb b/spec/lib/tasks/sitemap_spec.rb index a3f1ad59f..d72bb9061 100644 --- a/spec/lib/tasks/sitemap_spec.rb +++ b/spec/lib/tasks/sitemap_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "rake sitemap:create", type: :feature do +describe "rake sitemap:create", type: :system do let(:file) { Rails.root.join("public", "sitemap.xml") } before do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index e8d6b0646..c4756dd02 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -26,10 +26,6 @@ RSpec.configure do |config| end end -Capybara.register_driver :chrome do |app| - Capybara::Selenium::Driver.new(app, browser: :chrome) -end - Capybara.register_driver :headless_chrome do |app| capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( "goog:chromeOptions" => { @@ -44,8 +40,6 @@ Capybara.register_driver :headless_chrome do |app| ) end -Capybara.javascript_driver = :headless_chrome - Capybara.exact = true OmniAuth.config.test_mode = true diff --git a/spec/shared/features/admin_milestoneable.rb b/spec/shared/system/admin_milestoneable.rb similarity index 100% rename from spec/shared/features/admin_milestoneable.rb rename to spec/shared/system/admin_milestoneable.rb diff --git a/spec/shared/features/admin_progressable.rb b/spec/shared/system/admin_progressable.rb similarity index 100% rename from spec/shared/features/admin_progressable.rb rename to spec/shared/system/admin_progressable.rb diff --git a/spec/shared/features/documentable.rb b/spec/shared/system/documentable.rb similarity index 100% rename from spec/shared/features/documentable.rb rename to spec/shared/system/documentable.rb diff --git a/spec/shared/features/followable.rb b/spec/shared/system/followable.rb similarity index 100% rename from spec/shared/features/followable.rb rename to spec/shared/system/followable.rb diff --git a/spec/shared/features/imageable.rb b/spec/shared/system/imageable.rb similarity index 100% rename from spec/shared/features/imageable.rb rename to spec/shared/system/imageable.rb diff --git a/spec/shared/features/mappable.rb b/spec/shared/system/mappable.rb similarity index 100% rename from spec/shared/features/mappable.rb rename to spec/shared/system/mappable.rb diff --git a/spec/shared/features/milestoneable.rb b/spec/shared/system/milestoneable.rb similarity index 100% rename from spec/shared/features/milestoneable.rb rename to spec/shared/system/milestoneable.rb diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/system/nested_documentable.rb similarity index 100% rename from spec/shared/features/nested_documentable.rb rename to spec/shared/system/nested_documentable.rb diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/system/nested_imageable.rb similarity index 100% rename from spec/shared/features/nested_imageable.rb rename to spec/shared/system/nested_imageable.rb diff --git a/spec/shared/features/notifiable_in_app.rb b/spec/shared/system/notifiable_in_app.rb similarity index 100% rename from spec/shared/features/notifiable_in_app.rb rename to spec/shared/system/notifiable_in_app.rb diff --git a/spec/shared/features/progressable.rb b/spec/shared/system/progressable.rb similarity index 100% rename from spec/shared/features/progressable.rb rename to spec/shared/system/progressable.rb diff --git a/spec/shared/features/relationable.rb b/spec/shared/system/relationable.rb similarity index 100% rename from spec/shared/features/relationable.rb rename to spec/shared/system/relationable.rb diff --git a/spec/shared/features/remotely_translatable.rb b/spec/shared/system/remotely_translatable.rb similarity index 100% rename from spec/shared/features/remotely_translatable.rb rename to spec/shared/system/remotely_translatable.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ccacaa333..4a1956218 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,4 @@ require "factory_bot_rails" -require "database_cleaner" require "email_spec" require "devise" require "knapsack_pro" @@ -9,7 +8,7 @@ Dir["./spec/support/**/*.rb"].sort.each { |f| require f } Dir["./spec/shared/**/*.rb"].sort.each { |f| require f } RSpec.configure do |config| - config.use_transactional_fixtures = false + config.use_transactional_fixtures = true config.filter_run :focus config.run_all_when_everything_filtered = true @@ -21,29 +20,7 @@ RSpec.configure do |config| config.include(CommonActions) config.include(ActiveSupport::Testing::TimeHelpers) - config.before(:suite) do - DatabaseCleaner.clean_with :truncation - end - - config.before(:suite) do - if config.use_transactional_fixtures? - raise(<<-MSG) - Delete line `config.use_transactional_fixtures = true` from rails_helper.rb - (or set it to false) to prevent uncommitted transactions being used in - JavaScript-dependent specs. - - During testing, the app-under-test that the browser driver connects to - uses a different database connection to the database connection used by - the spec. The app's database connection would not be able to access - uncommitted transaction data setup over the spec's database connection. - MSG - end - - DatabaseCleaner.clean_with(:truncation) - end - config.before do |example| - DatabaseCleaner.strategy = :transaction I18n.locale = :en Globalize.locale = nil Globalize.set_fallbacks_to_all_available_locales @@ -51,20 +28,7 @@ RSpec.configure do |config| Setting["feature.user.skip_verification"] = nil end - config.before(:each, type: :feature) do - # :rack_test driver's Rack app under test shares database connection - # with the specs, so continue to use transaction strategy for speed. - driver_shares_db_connection_with_specs = Capybara.current_driver == :rack_test - - unless driver_shares_db_connection_with_specs - # Driver is probably for an external browser with an app - # under test that does *not* share a database connection with the - # specs, so use truncation strategy. - DatabaseCleaner.strategy = :truncation - end - end - - config.before(:each, type: :feature) do + config.before(:each, type: :system) do Capybara::Webmock.start end @@ -76,20 +40,20 @@ RSpec.configure do |config| page.driver.reset! end - config.before do - DatabaseCleaner.start + config.before(:each, type: :system) do |example| + driven_by :rack_test end - config.append_after do - DatabaseCleaner.clean + config.before(:each, type: :system, js: true) do + driven_by :headless_chrome end - config.before(:each, type: :feature) do + config.before(:each, type: :system) do Bullet.start_request allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(0) end - config.after(:each, type: :feature) do + config.after(:each, type: :system) do Bullet.perform_out_of_channel_notifications if Bullet.notification? Bullet.end_request end diff --git a/spec/features/account_spec.rb b/spec/system/account_spec.rb similarity index 100% rename from spec/features/account_spec.rb rename to spec/system/account_spec.rb diff --git a/spec/features/admin/activity_spec.rb b/spec/system/admin/activity_spec.rb similarity index 100% rename from spec/features/admin/activity_spec.rb rename to spec/system/admin/activity_spec.rb diff --git a/spec/features/admin/admin_notifications_spec.rb b/spec/system/admin/admin_notifications_spec.rb similarity index 100% rename from spec/features/admin/admin_notifications_spec.rb rename to spec/system/admin/admin_notifications_spec.rb diff --git a/spec/features/admin/administrators_spec.rb b/spec/system/admin/administrators_spec.rb similarity index 100% rename from spec/features/admin/administrators_spec.rb rename to spec/system/admin/administrators_spec.rb diff --git a/spec/features/admin/audits_spec.rb b/spec/system/admin/audits_spec.rb similarity index 100% rename from spec/features/admin/audits_spec.rb rename to spec/system/admin/audits_spec.rb diff --git a/spec/features/admin/banners_spec.rb b/spec/system/admin/banners_spec.rb similarity index 100% rename from spec/features/admin/banners_spec.rb rename to spec/system/admin/banners_spec.rb diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/system/admin/budget_groups_spec.rb similarity index 100% rename from spec/features/admin/budget_groups_spec.rb rename to spec/system/admin/budget_groups_spec.rb diff --git a/spec/features/admin/budget_headings_spec.rb b/spec/system/admin/budget_headings_spec.rb similarity index 100% rename from spec/features/admin/budget_headings_spec.rb rename to spec/system/admin/budget_headings_spec.rb diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/system/admin/budget_investments_spec.rb similarity index 100% rename from spec/features/admin/budget_investments_spec.rb rename to spec/system/admin/budget_investments_spec.rb diff --git a/spec/features/admin/budget_phases_spec.rb b/spec/system/admin/budget_phases_spec.rb similarity index 100% rename from spec/features/admin/budget_phases_spec.rb rename to spec/system/admin/budget_phases_spec.rb diff --git a/spec/features/admin/budgets_spec.rb b/spec/system/admin/budgets_spec.rb similarity index 100% rename from spec/features/admin/budgets_spec.rb rename to spec/system/admin/budgets_spec.rb diff --git a/spec/features/admin/comments_spec.rb b/spec/system/admin/comments_spec.rb similarity index 100% rename from spec/features/admin/comments_spec.rb rename to spec/system/admin/comments_spec.rb diff --git a/spec/features/admin/dashboard/actions_spec.rb b/spec/system/admin/dashboard/actions_spec.rb similarity index 100% rename from spec/features/admin/dashboard/actions_spec.rb rename to spec/system/admin/dashboard/actions_spec.rb diff --git a/spec/features/admin/dashboard/administrator_tasks_spec.rb b/spec/system/admin/dashboard/administrator_tasks_spec.rb similarity index 100% rename from spec/features/admin/dashboard/administrator_tasks_spec.rb rename to spec/system/admin/dashboard/administrator_tasks_spec.rb diff --git a/spec/features/admin/debates_spec.rb b/spec/system/admin/debates_spec.rb similarity index 100% rename from spec/features/admin/debates_spec.rb rename to spec/system/admin/debates_spec.rb diff --git a/spec/features/admin/emails/emails_download_spec.rb b/spec/system/admin/emails/emails_download_spec.rb similarity index 100% rename from spec/features/admin/emails/emails_download_spec.rb rename to spec/system/admin/emails/emails_download_spec.rb diff --git a/spec/features/admin/emails/newsletters_spec.rb b/spec/system/admin/emails/newsletters_spec.rb similarity index 100% rename from spec/features/admin/emails/newsletters_spec.rb rename to spec/system/admin/emails/newsletters_spec.rb diff --git a/spec/features/admin/feature_flags_spec.rb b/spec/system/admin/feature_flags_spec.rb similarity index 100% rename from spec/features/admin/feature_flags_spec.rb rename to spec/system/admin/feature_flags_spec.rb diff --git a/spec/features/admin/geozones_spec.rb b/spec/system/admin/geozones_spec.rb similarity index 100% rename from spec/features/admin/geozones_spec.rb rename to spec/system/admin/geozones_spec.rb diff --git a/spec/features/admin/hidden_budget_investments_spec.rb b/spec/system/admin/hidden_budget_investments_spec.rb similarity index 100% rename from spec/features/admin/hidden_budget_investments_spec.rb rename to spec/system/admin/hidden_budget_investments_spec.rb diff --git a/spec/features/admin/hidden_comments_spec.rb b/spec/system/admin/hidden_comments_spec.rb similarity index 100% rename from spec/features/admin/hidden_comments_spec.rb rename to spec/system/admin/hidden_comments_spec.rb diff --git a/spec/features/admin/hidden_debates_spec.rb b/spec/system/admin/hidden_debates_spec.rb similarity index 100% rename from spec/features/admin/hidden_debates_spec.rb rename to spec/system/admin/hidden_debates_spec.rb diff --git a/spec/features/admin/hidden_proposals_spec.rb b/spec/system/admin/hidden_proposals_spec.rb similarity index 100% rename from spec/features/admin/hidden_proposals_spec.rb rename to spec/system/admin/hidden_proposals_spec.rb diff --git a/spec/features/admin/hidden_users_spec.rb b/spec/system/admin/hidden_users_spec.rb similarity index 100% rename from spec/features/admin/hidden_users_spec.rb rename to spec/system/admin/hidden_users_spec.rb diff --git a/spec/features/admin/homepage/homepage_spec.rb b/spec/system/admin/homepage/homepage_spec.rb similarity index 100% rename from spec/features/admin/homepage/homepage_spec.rb rename to spec/system/admin/homepage/homepage_spec.rb diff --git a/spec/features/admin/legislation/draft_versions_spec.rb b/spec/system/admin/legislation/draft_versions_spec.rb similarity index 100% rename from spec/features/admin/legislation/draft_versions_spec.rb rename to spec/system/admin/legislation/draft_versions_spec.rb diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/system/admin/legislation/processes_spec.rb similarity index 100% rename from spec/features/admin/legislation/processes_spec.rb rename to spec/system/admin/legislation/processes_spec.rb diff --git a/spec/features/admin/legislation/proposals_spec.rb b/spec/system/admin/legislation/proposals_spec.rb similarity index 100% rename from spec/features/admin/legislation/proposals_spec.rb rename to spec/system/admin/legislation/proposals_spec.rb diff --git a/spec/features/admin/legislation/questions_spec.rb b/spec/system/admin/legislation/questions_spec.rb similarity index 100% rename from spec/features/admin/legislation/questions_spec.rb rename to spec/system/admin/legislation/questions_spec.rb diff --git a/spec/features/admin/local_census_records/imports_spec.rb b/spec/system/admin/local_census_records/imports_spec.rb similarity index 100% rename from spec/features/admin/local_census_records/imports_spec.rb rename to spec/system/admin/local_census_records/imports_spec.rb diff --git a/spec/features/admin/local_census_records_spec.rb b/spec/system/admin/local_census_records_spec.rb similarity index 100% rename from spec/features/admin/local_census_records_spec.rb rename to spec/system/admin/local_census_records_spec.rb diff --git a/spec/features/admin/managers_spec.rb b/spec/system/admin/managers_spec.rb similarity index 100% rename from spec/features/admin/managers_spec.rb rename to spec/system/admin/managers_spec.rb diff --git a/spec/features/admin/milestone_statuses_spec.rb b/spec/system/admin/milestone_statuses_spec.rb similarity index 100% rename from spec/features/admin/milestone_statuses_spec.rb rename to spec/system/admin/milestone_statuses_spec.rb diff --git a/spec/features/admin/moderators_spec.rb b/spec/system/admin/moderators_spec.rb similarity index 100% rename from spec/features/admin/moderators_spec.rb rename to spec/system/admin/moderators_spec.rb diff --git a/spec/features/admin/officials_spec.rb b/spec/system/admin/officials_spec.rb similarity index 100% rename from spec/features/admin/officials_spec.rb rename to spec/system/admin/officials_spec.rb diff --git a/spec/features/admin/organizations_spec.rb b/spec/system/admin/organizations_spec.rb similarity index 100% rename from spec/features/admin/organizations_spec.rb rename to spec/system/admin/organizations_spec.rb diff --git a/spec/features/admin/poll/active_polls_spec.rb b/spec/system/admin/poll/active_polls_spec.rb similarity index 100% rename from spec/features/admin/poll/active_polls_spec.rb rename to spec/system/admin/poll/active_polls_spec.rb diff --git a/spec/features/admin/poll/booth_assigments_spec.rb b/spec/system/admin/poll/booth_assigments_spec.rb similarity index 100% rename from spec/features/admin/poll/booth_assigments_spec.rb rename to spec/system/admin/poll/booth_assigments_spec.rb diff --git a/spec/features/admin/poll/booths_spec.rb b/spec/system/admin/poll/booths_spec.rb similarity index 100% rename from spec/features/admin/poll/booths_spec.rb rename to spec/system/admin/poll/booths_spec.rb diff --git a/spec/features/admin/poll/officer_assignments_spec.rb b/spec/system/admin/poll/officer_assignments_spec.rb similarity index 100% rename from spec/features/admin/poll/officer_assignments_spec.rb rename to spec/system/admin/poll/officer_assignments_spec.rb diff --git a/spec/features/admin/poll/officers_spec.rb b/spec/system/admin/poll/officers_spec.rb similarity index 100% rename from spec/features/admin/poll/officers_spec.rb rename to spec/system/admin/poll/officers_spec.rb diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb similarity index 100% rename from spec/features/admin/poll/polls_spec.rb rename to spec/system/admin/poll/polls_spec.rb diff --git a/spec/features/admin/poll/questions/answers/answers_spec.rb b/spec/system/admin/poll/questions/answers/answers_spec.rb similarity index 100% rename from spec/features/admin/poll/questions/answers/answers_spec.rb rename to spec/system/admin/poll/questions/answers/answers_spec.rb diff --git a/spec/features/admin/poll/questions/answers/documents/documents_spec.rb b/spec/system/admin/poll/questions/answers/documents/documents_spec.rb similarity index 100% rename from spec/features/admin/poll/questions/answers/documents/documents_spec.rb rename to spec/system/admin/poll/questions/answers/documents/documents_spec.rb diff --git a/spec/features/admin/poll/questions/answers/images/images_spec.rb b/spec/system/admin/poll/questions/answers/images/images_spec.rb similarity index 100% rename from spec/features/admin/poll/questions/answers/images/images_spec.rb rename to spec/system/admin/poll/questions/answers/images/images_spec.rb diff --git a/spec/features/admin/poll/questions/answers/videos/videos_spec.rb b/spec/system/admin/poll/questions/answers/videos/videos_spec.rb similarity index 100% rename from spec/features/admin/poll/questions/answers/videos/videos_spec.rb rename to spec/system/admin/poll/questions/answers/videos/videos_spec.rb diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/system/admin/poll/questions_spec.rb similarity index 100% rename from spec/features/admin/poll/questions_spec.rb rename to spec/system/admin/poll/questions_spec.rb diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/system/admin/poll/shifts_spec.rb similarity index 100% rename from spec/features/admin/poll/shifts_spec.rb rename to spec/system/admin/poll/shifts_spec.rb diff --git a/spec/features/admin/proposal_notifications_spec.rb b/spec/system/admin/proposal_notifications_spec.rb similarity index 100% rename from spec/features/admin/proposal_notifications_spec.rb rename to spec/system/admin/proposal_notifications_spec.rb diff --git a/spec/features/admin/proposals_spec.rb b/spec/system/admin/proposals_spec.rb similarity index 100% rename from spec/features/admin/proposals_spec.rb rename to spec/system/admin/proposals_spec.rb diff --git a/spec/features/admin/settings_spec.rb b/spec/system/admin/settings_spec.rb similarity index 100% rename from spec/features/admin/settings_spec.rb rename to spec/system/admin/settings_spec.rb diff --git a/spec/features/admin/signature_sheets_spec.rb b/spec/system/admin/signature_sheets_spec.rb similarity index 100% rename from spec/features/admin/signature_sheets_spec.rb rename to spec/system/admin/signature_sheets_spec.rb diff --git a/spec/features/admin/site_customization/content_blocks_spec.rb b/spec/system/admin/site_customization/content_blocks_spec.rb similarity index 100% rename from spec/features/admin/site_customization/content_blocks_spec.rb rename to spec/system/admin/site_customization/content_blocks_spec.rb diff --git a/spec/features/admin/site_customization/documents_spec.rb b/spec/system/admin/site_customization/documents_spec.rb similarity index 100% rename from spec/features/admin/site_customization/documents_spec.rb rename to spec/system/admin/site_customization/documents_spec.rb diff --git a/spec/features/admin/site_customization/images_spec.rb b/spec/system/admin/site_customization/images_spec.rb similarity index 100% rename from spec/features/admin/site_customization/images_spec.rb rename to spec/system/admin/site_customization/images_spec.rb diff --git a/spec/features/admin/site_customization/information_texts_spec.rb b/spec/system/admin/site_customization/information_texts_spec.rb similarity index 100% rename from spec/features/admin/site_customization/information_texts_spec.rb rename to spec/system/admin/site_customization/information_texts_spec.rb diff --git a/spec/features/admin/site_customization/pages_spec.rb b/spec/system/admin/site_customization/pages_spec.rb similarity index 100% rename from spec/features/admin/site_customization/pages_spec.rb rename to spec/system/admin/site_customization/pages_spec.rb diff --git a/spec/features/admin/stats_spec.rb b/spec/system/admin/stats_spec.rb similarity index 100% rename from spec/features/admin/stats_spec.rb rename to spec/system/admin/stats_spec.rb diff --git a/spec/features/admin/system_emails_spec.rb b/spec/system/admin/system_emails_spec.rb similarity index 100% rename from spec/features/admin/system_emails_spec.rb rename to spec/system/admin/system_emails_spec.rb diff --git a/spec/features/admin/tags_spec.rb b/spec/system/admin/tags_spec.rb similarity index 100% rename from spec/features/admin/tags_spec.rb rename to spec/system/admin/tags_spec.rb diff --git a/spec/features/admin/translatable_spec.rb b/spec/system/admin/translatable_spec.rb similarity index 100% rename from spec/features/admin/translatable_spec.rb rename to spec/system/admin/translatable_spec.rb diff --git a/spec/features/admin/users_spec.rb b/spec/system/admin/users_spec.rb similarity index 100% rename from spec/features/admin/users_spec.rb rename to spec/system/admin/users_spec.rb diff --git a/spec/features/admin/valuator_groups_spec.rb b/spec/system/admin/valuator_groups_spec.rb similarity index 100% rename from spec/features/admin/valuator_groups_spec.rb rename to spec/system/admin/valuator_groups_spec.rb diff --git a/spec/features/admin/valuators_spec.rb b/spec/system/admin/valuators_spec.rb similarity index 100% rename from spec/features/admin/valuators_spec.rb rename to spec/system/admin/valuators_spec.rb diff --git a/spec/features/admin/verifications_spec.rb b/spec/system/admin/verifications_spec.rb similarity index 100% rename from spec/features/admin/verifications_spec.rb rename to spec/system/admin/verifications_spec.rb diff --git a/spec/features/admin/widgets/cards_spec.rb b/spec/system/admin/widgets/cards_spec.rb similarity index 100% rename from spec/features/admin/widgets/cards_spec.rb rename to spec/system/admin/widgets/cards_spec.rb diff --git a/spec/features/admin_spec.rb b/spec/system/admin_spec.rb similarity index 100% rename from spec/features/admin_spec.rb rename to spec/system/admin_spec.rb diff --git a/spec/features/banners_spec.rb b/spec/system/banners_spec.rb similarity index 100% rename from spec/features/banners_spec.rb rename to spec/system/banners_spec.rb diff --git a/spec/features/budget_polls/ballot_sheets_spec.rb b/spec/system/budget_polls/ballot_sheets_spec.rb similarity index 100% rename from spec/features/budget_polls/ballot_sheets_spec.rb rename to spec/system/budget_polls/ballot_sheets_spec.rb diff --git a/spec/features/budget_polls/budgets_spec.rb b/spec/system/budget_polls/budgets_spec.rb similarity index 100% rename from spec/features/budget_polls/budgets_spec.rb rename to spec/system/budget_polls/budgets_spec.rb diff --git a/spec/features/budget_polls/officing_spec.rb b/spec/system/budget_polls/officing_spec.rb similarity index 100% rename from spec/features/budget_polls/officing_spec.rb rename to spec/system/budget_polls/officing_spec.rb diff --git a/spec/features/budget_polls/polls_spec.rb b/spec/system/budget_polls/polls_spec.rb similarity index 100% rename from spec/features/budget_polls/polls_spec.rb rename to spec/system/budget_polls/polls_spec.rb diff --git a/spec/features/budget_polls/questions_spec.rb b/spec/system/budget_polls/questions_spec.rb similarity index 100% rename from spec/features/budget_polls/questions_spec.rb rename to spec/system/budget_polls/questions_spec.rb diff --git a/spec/features/budget_polls/voter_spec.rb b/spec/system/budget_polls/voter_spec.rb similarity index 100% rename from spec/features/budget_polls/voter_spec.rb rename to spec/system/budget_polls/voter_spec.rb diff --git a/spec/features/budgets/ballots_spec.rb b/spec/system/budgets/ballots_spec.rb similarity index 100% rename from spec/features/budgets/ballots_spec.rb rename to spec/system/budgets/ballots_spec.rb diff --git a/spec/features/budgets/budgets_spec.rb b/spec/system/budgets/budgets_spec.rb similarity index 100% rename from spec/features/budgets/budgets_spec.rb rename to spec/system/budgets/budgets_spec.rb diff --git a/spec/features/budgets/executions_spec.rb b/spec/system/budgets/executions_spec.rb similarity index 100% rename from spec/features/budgets/executions_spec.rb rename to spec/system/budgets/executions_spec.rb diff --git a/spec/features/budgets/groups_spec.rb b/spec/system/budgets/groups_spec.rb similarity index 100% rename from spec/features/budgets/groups_spec.rb rename to spec/system/budgets/groups_spec.rb diff --git a/spec/features/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb similarity index 100% rename from spec/features/budgets/investments_spec.rb rename to spec/system/budgets/investments_spec.rb diff --git a/spec/features/budgets/results_spec.rb b/spec/system/budgets/results_spec.rb similarity index 100% rename from spec/features/budgets/results_spec.rb rename to spec/system/budgets/results_spec.rb diff --git a/spec/features/budgets/stats_spec.rb b/spec/system/budgets/stats_spec.rb similarity index 100% rename from spec/features/budgets/stats_spec.rb rename to spec/system/budgets/stats_spec.rb diff --git a/spec/features/budgets/votes_spec.rb b/spec/system/budgets/votes_spec.rb similarity index 100% rename from spec/features/budgets/votes_spec.rb rename to spec/system/budgets/votes_spec.rb diff --git a/spec/features/campaigns_spec.rb b/spec/system/campaigns_spec.rb similarity index 100% rename from spec/features/campaigns_spec.rb rename to spec/system/campaigns_spec.rb diff --git a/spec/features/ckeditor_spec.rb b/spec/system/ckeditor_spec.rb similarity index 100% rename from spec/features/ckeditor_spec.rb rename to spec/system/ckeditor_spec.rb diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb similarity index 100% rename from spec/features/comments/budget_investments_spec.rb rename to spec/system/comments/budget_investments_spec.rb diff --git a/spec/features/comments/budget_investments_valuation_spec.rb b/spec/system/comments/budget_investments_valuation_spec.rb similarity index 100% rename from spec/features/comments/budget_investments_valuation_spec.rb rename to spec/system/comments/budget_investments_valuation_spec.rb diff --git a/spec/features/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb similarity index 100% rename from spec/features/comments/debates_spec.rb rename to spec/system/comments/debates_spec.rb diff --git a/spec/features/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb similarity index 100% rename from spec/features/comments/legislation_annotations_spec.rb rename to spec/system/comments/legislation_annotations_spec.rb diff --git a/spec/features/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb similarity index 100% rename from spec/features/comments/legislation_questions_spec.rb rename to spec/system/comments/legislation_questions_spec.rb diff --git a/spec/features/comments/poll_questions_spec.rb b/spec/system/comments/poll_questions_spec.rb similarity index 100% rename from spec/features/comments/poll_questions_spec.rb rename to spec/system/comments/poll_questions_spec.rb diff --git a/spec/features/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb similarity index 100% rename from spec/features/comments/polls_spec.rb rename to spec/system/comments/polls_spec.rb diff --git a/spec/features/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb similarity index 100% rename from spec/features/comments/proposals_spec.rb rename to spec/system/comments/proposals_spec.rb diff --git a/spec/features/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb similarity index 100% rename from spec/features/comments/topics_spec.rb rename to spec/system/comments/topics_spec.rb diff --git a/spec/features/communities_spec.rb b/spec/system/communities_spec.rb similarity index 100% rename from spec/features/communities_spec.rb rename to spec/system/communities_spec.rb diff --git a/spec/features/dashboard/dashboard_spec.rb b/spec/system/dashboard/dashboard_spec.rb similarity index 100% rename from spec/features/dashboard/dashboard_spec.rb rename to spec/system/dashboard/dashboard_spec.rb diff --git a/spec/features/dashboard/mailing_spec.rb b/spec/system/dashboard/mailing_spec.rb similarity index 100% rename from spec/features/dashboard/mailing_spec.rb rename to spec/system/dashboard/mailing_spec.rb diff --git a/spec/features/dashboard/polls_spec.rb b/spec/system/dashboard/polls_spec.rb similarity index 100% rename from spec/features/dashboard/polls_spec.rb rename to spec/system/dashboard/polls_spec.rb diff --git a/spec/features/dashboard/poster_spec.rb b/spec/system/dashboard/poster_spec.rb similarity index 100% rename from spec/features/dashboard/poster_spec.rb rename to spec/system/dashboard/poster_spec.rb diff --git a/spec/features/debates_spec.rb b/spec/system/debates_spec.rb similarity index 100% rename from spec/features/debates_spec.rb rename to spec/system/debates_spec.rb diff --git a/spec/features/direct_messages_spec.rb b/spec/system/direct_messages_spec.rb similarity index 100% rename from spec/features/direct_messages_spec.rb rename to spec/system/direct_messages_spec.rb diff --git a/spec/features/emails_spec.rb b/spec/system/emails_spec.rb similarity index 100% rename from spec/features/emails_spec.rb rename to spec/system/emails_spec.rb diff --git a/spec/features/help_page_spec.rb b/spec/system/help_page_spec.rb similarity index 100% rename from spec/features/help_page_spec.rb rename to spec/system/help_page_spec.rb diff --git a/spec/features/home_spec.rb b/spec/system/home_spec.rb similarity index 100% rename from spec/features/home_spec.rb rename to spec/system/home_spec.rb diff --git a/spec/features/legislation/draft_versions_spec.rb b/spec/system/legislation/draft_versions_spec.rb similarity index 100% rename from spec/features/legislation/draft_versions_spec.rb rename to spec/system/legislation/draft_versions_spec.rb diff --git a/spec/features/legislation/processes_spec.rb b/spec/system/legislation/processes_spec.rb similarity index 100% rename from spec/features/legislation/processes_spec.rb rename to spec/system/legislation/processes_spec.rb diff --git a/spec/features/legislation/proposals_spec.rb b/spec/system/legislation/proposals_spec.rb similarity index 100% rename from spec/features/legislation/proposals_spec.rb rename to spec/system/legislation/proposals_spec.rb diff --git a/spec/features/legislation/questions_spec.rb b/spec/system/legislation/questions_spec.rb similarity index 100% rename from spec/features/legislation/questions_spec.rb rename to spec/system/legislation/questions_spec.rb diff --git a/spec/features/localization_spec.rb b/spec/system/localization_spec.rb similarity index 100% rename from spec/features/localization_spec.rb rename to spec/system/localization_spec.rb diff --git a/spec/features/management/account_spec.rb b/spec/system/management/account_spec.rb similarity index 100% rename from spec/features/management/account_spec.rb rename to spec/system/management/account_spec.rb diff --git a/spec/features/management/budget_investments_spec.rb b/spec/system/management/budget_investments_spec.rb similarity index 100% rename from spec/features/management/budget_investments_spec.rb rename to spec/system/management/budget_investments_spec.rb diff --git a/spec/features/management/document_verifications_spec.rb b/spec/system/management/document_verifications_spec.rb similarity index 100% rename from spec/features/management/document_verifications_spec.rb rename to spec/system/management/document_verifications_spec.rb diff --git a/spec/features/management/email_verifications_spec.rb b/spec/system/management/email_verifications_spec.rb similarity index 100% rename from spec/features/management/email_verifications_spec.rb rename to spec/system/management/email_verifications_spec.rb diff --git a/spec/features/management/localization_spec.rb b/spec/system/management/localization_spec.rb similarity index 100% rename from spec/features/management/localization_spec.rb rename to spec/system/management/localization_spec.rb diff --git a/spec/features/management/managed_users_spec.rb b/spec/system/management/managed_users_spec.rb similarity index 100% rename from spec/features/management/managed_users_spec.rb rename to spec/system/management/managed_users_spec.rb diff --git a/spec/features/management/proposals_spec.rb b/spec/system/management/proposals_spec.rb similarity index 100% rename from spec/features/management/proposals_spec.rb rename to spec/system/management/proposals_spec.rb diff --git a/spec/features/management/users_spec.rb b/spec/system/management/users_spec.rb similarity index 100% rename from spec/features/management/users_spec.rb rename to spec/system/management/users_spec.rb diff --git a/spec/features/management_spec.rb b/spec/system/management_spec.rb similarity index 100% rename from spec/features/management_spec.rb rename to spec/system/management_spec.rb diff --git a/spec/features/moderation/budget_investments_spec.rb b/spec/system/moderation/budget_investments_spec.rb similarity index 100% rename from spec/features/moderation/budget_investments_spec.rb rename to spec/system/moderation/budget_investments_spec.rb diff --git a/spec/features/moderation/comments_spec.rb b/spec/system/moderation/comments_spec.rb similarity index 100% rename from spec/features/moderation/comments_spec.rb rename to spec/system/moderation/comments_spec.rb diff --git a/spec/features/moderation/debates_spec.rb b/spec/system/moderation/debates_spec.rb similarity index 100% rename from spec/features/moderation/debates_spec.rb rename to spec/system/moderation/debates_spec.rb diff --git a/spec/features/moderation/legislation_proposals_spec.rb b/spec/system/moderation/legislation_proposals_spec.rb similarity index 100% rename from spec/features/moderation/legislation_proposals_spec.rb rename to spec/system/moderation/legislation_proposals_spec.rb diff --git a/spec/features/moderation/proposal_notifications_spec.rb b/spec/system/moderation/proposal_notifications_spec.rb similarity index 100% rename from spec/features/moderation/proposal_notifications_spec.rb rename to spec/system/moderation/proposal_notifications_spec.rb diff --git a/spec/features/moderation/proposals_spec.rb b/spec/system/moderation/proposals_spec.rb similarity index 100% rename from spec/features/moderation/proposals_spec.rb rename to spec/system/moderation/proposals_spec.rb diff --git a/spec/features/moderation/users_spec.rb b/spec/system/moderation/users_spec.rb similarity index 100% rename from spec/features/moderation/users_spec.rb rename to spec/system/moderation/users_spec.rb diff --git a/spec/features/moderation_spec.rb b/spec/system/moderation_spec.rb similarity index 100% rename from spec/features/moderation_spec.rb rename to spec/system/moderation_spec.rb diff --git a/spec/features/notifications_spec.rb b/spec/system/notifications_spec.rb similarity index 100% rename from spec/features/notifications_spec.rb rename to spec/system/notifications_spec.rb diff --git a/spec/features/official_positions_spec.rb b/spec/system/official_positions_spec.rb similarity index 100% rename from spec/features/official_positions_spec.rb rename to spec/system/official_positions_spec.rb diff --git a/spec/features/officing/booth_spec.rb b/spec/system/officing/booth_spec.rb similarity index 100% rename from spec/features/officing/booth_spec.rb rename to spec/system/officing/booth_spec.rb diff --git a/spec/features/officing/residence_spec.rb b/spec/system/officing/residence_spec.rb similarity index 100% rename from spec/features/officing/residence_spec.rb rename to spec/system/officing/residence_spec.rb diff --git a/spec/features/officing/results_spec.rb b/spec/system/officing/results_spec.rb similarity index 100% rename from spec/features/officing/results_spec.rb rename to spec/system/officing/results_spec.rb diff --git a/spec/features/officing/voters_spec.rb b/spec/system/officing/voters_spec.rb similarity index 100% rename from spec/features/officing/voters_spec.rb rename to spec/system/officing/voters_spec.rb diff --git a/spec/features/officing_spec.rb b/spec/system/officing_spec.rb similarity index 100% rename from spec/features/officing_spec.rb rename to spec/system/officing_spec.rb diff --git a/spec/features/organizations_spec.rb b/spec/system/organizations_spec.rb similarity index 100% rename from spec/features/organizations_spec.rb rename to spec/system/organizations_spec.rb diff --git a/spec/features/polls/polls_spec.rb b/spec/system/polls/polls_spec.rb similarity index 100% rename from spec/features/polls/polls_spec.rb rename to spec/system/polls/polls_spec.rb diff --git a/spec/features/polls/questions_spec.rb b/spec/system/polls/questions_spec.rb similarity index 100% rename from spec/features/polls/questions_spec.rb rename to spec/system/polls/questions_spec.rb diff --git a/spec/features/polls/results_spec.rb b/spec/system/polls/results_spec.rb similarity index 100% rename from spec/features/polls/results_spec.rb rename to spec/system/polls/results_spec.rb diff --git a/spec/features/polls/voter_spec.rb b/spec/system/polls/voter_spec.rb similarity index 100% rename from spec/features/polls/voter_spec.rb rename to spec/system/polls/voter_spec.rb diff --git a/spec/features/proposal_ballots_spec.rb b/spec/system/proposal_ballots_spec.rb similarity index 100% rename from spec/features/proposal_ballots_spec.rb rename to spec/system/proposal_ballots_spec.rb diff --git a/spec/features/proposal_notifications_spec.rb b/spec/system/proposal_notifications_spec.rb similarity index 100% rename from spec/features/proposal_notifications_spec.rb rename to spec/system/proposal_notifications_spec.rb diff --git a/spec/features/proposals_spec.rb b/spec/system/proposals_spec.rb similarity index 100% rename from spec/features/proposals_spec.rb rename to spec/system/proposals_spec.rb diff --git a/spec/features/registration_form_spec.rb b/spec/system/registration_form_spec.rb similarity index 100% rename from spec/features/registration_form_spec.rb rename to spec/system/registration_form_spec.rb diff --git a/spec/features/remote_translations_spec.rb b/spec/system/remote_translations_spec.rb similarity index 100% rename from spec/features/remote_translations_spec.rb rename to spec/system/remote_translations_spec.rb diff --git a/spec/features/sessions_spec.rb b/spec/system/sessions_spec.rb similarity index 100% rename from spec/features/sessions_spec.rb rename to spec/system/sessions_spec.rb diff --git a/spec/features/site_customization/content_blocks_spec.rb b/spec/system/site_customization/content_blocks_spec.rb similarity index 100% rename from spec/features/site_customization/content_blocks_spec.rb rename to spec/system/site_customization/content_blocks_spec.rb diff --git a/spec/features/site_customization/custom_pages_spec.rb b/spec/system/site_customization/custom_pages_spec.rb similarity index 100% rename from spec/features/site_customization/custom_pages_spec.rb rename to spec/system/site_customization/custom_pages_spec.rb diff --git a/spec/features/site_customization/information_texts_spec.rb b/spec/system/site_customization/information_texts_spec.rb similarity index 100% rename from spec/features/site_customization/information_texts_spec.rb rename to spec/system/site_customization/information_texts_spec.rb diff --git a/spec/features/social_media_meta_tags_spec.rb b/spec/system/social_media_meta_tags_spec.rb similarity index 100% rename from spec/features/social_media_meta_tags_spec.rb rename to spec/system/social_media_meta_tags_spec.rb diff --git a/spec/features/stats_spec.rb b/spec/system/stats_spec.rb similarity index 100% rename from spec/features/stats_spec.rb rename to spec/system/stats_spec.rb diff --git a/spec/features/tags/budget_investments_spec.rb b/spec/system/tags/budget_investments_spec.rb similarity index 100% rename from spec/features/tags/budget_investments_spec.rb rename to spec/system/tags/budget_investments_spec.rb diff --git a/spec/features/tags/debates_spec.rb b/spec/system/tags/debates_spec.rb similarity index 100% rename from spec/features/tags/debates_spec.rb rename to spec/system/tags/debates_spec.rb diff --git a/spec/features/tags/proposals_spec.rb b/spec/system/tags/proposals_spec.rb similarity index 100% rename from spec/features/tags/proposals_spec.rb rename to spec/system/tags/proposals_spec.rb diff --git a/spec/features/tags_spec.rb b/spec/system/tags_spec.rb similarity index 100% rename from spec/features/tags_spec.rb rename to spec/system/tags_spec.rb diff --git a/spec/features/topics_spec.rb b/spec/system/topics_spec.rb similarity index 100% rename from spec/features/topics_spec.rb rename to spec/system/topics_spec.rb diff --git a/spec/features/tracks_spec.rb b/spec/system/tracks_spec.rb similarity index 100% rename from spec/features/tracks_spec.rb rename to spec/system/tracks_spec.rb diff --git a/spec/features/translatable_spec.rb b/spec/system/translatable_spec.rb similarity index 100% rename from spec/features/translatable_spec.rb rename to spec/system/translatable_spec.rb diff --git a/spec/features/user_invites_spec.rb b/spec/system/user_invites_spec.rb similarity index 100% rename from spec/features/user_invites_spec.rb rename to spec/system/user_invites_spec.rb diff --git a/spec/features/users_auth_spec.rb b/spec/system/users_auth_spec.rb similarity index 100% rename from spec/features/users_auth_spec.rb rename to spec/system/users_auth_spec.rb diff --git a/spec/features/users_spec.rb b/spec/system/users_spec.rb similarity index 100% rename from spec/features/users_spec.rb rename to spec/system/users_spec.rb diff --git a/spec/features/valuation/budget_investments_spec.rb b/spec/system/valuation/budget_investments_spec.rb similarity index 100% rename from spec/features/valuation/budget_investments_spec.rb rename to spec/system/valuation/budget_investments_spec.rb diff --git a/spec/features/valuation/budgets_spec.rb b/spec/system/valuation/budgets_spec.rb similarity index 100% rename from spec/features/valuation/budgets_spec.rb rename to spec/system/valuation/budgets_spec.rb diff --git a/spec/features/valuation_spec.rb b/spec/system/valuation_spec.rb similarity index 100% rename from spec/features/valuation_spec.rb rename to spec/system/valuation_spec.rb diff --git a/spec/features/verification/email_spec.rb b/spec/system/verification/email_spec.rb similarity index 100% rename from spec/features/verification/email_spec.rb rename to spec/system/verification/email_spec.rb diff --git a/spec/features/verification/letter_spec.rb b/spec/system/verification/letter_spec.rb similarity index 100% rename from spec/features/verification/letter_spec.rb rename to spec/system/verification/letter_spec.rb diff --git a/spec/features/verification/level_three_verification_spec.rb b/spec/system/verification/level_three_verification_spec.rb similarity index 100% rename from spec/features/verification/level_three_verification_spec.rb rename to spec/system/verification/level_three_verification_spec.rb diff --git a/spec/features/verification/level_two_verification_spec.rb b/spec/system/verification/level_two_verification_spec.rb similarity index 100% rename from spec/features/verification/level_two_verification_spec.rb rename to spec/system/verification/level_two_verification_spec.rb diff --git a/spec/features/verification/residence_spec.rb b/spec/system/verification/residence_spec.rb similarity index 100% rename from spec/features/verification/residence_spec.rb rename to spec/system/verification/residence_spec.rb diff --git a/spec/features/verification/sms_spec.rb b/spec/system/verification/sms_spec.rb similarity index 100% rename from spec/features/verification/sms_spec.rb rename to spec/system/verification/sms_spec.rb diff --git a/spec/features/verification/verification_path_spec.rb b/spec/system/verification/verification_path_spec.rb similarity index 100% rename from spec/features/verification/verification_path_spec.rb rename to spec/system/verification/verification_path_spec.rb diff --git a/spec/features/verification/verified_user_spec.rb b/spec/system/verification/verified_user_spec.rb similarity index 100% rename from spec/features/verification/verified_user_spec.rb rename to spec/system/verification/verified_user_spec.rb diff --git a/spec/features/votes_spec.rb b/spec/system/votes_spec.rb similarity index 100% rename from spec/features/votes_spec.rb rename to spec/system/votes_spec.rb diff --git a/spec/features/welcome_spec.rb b/spec/system/welcome_spec.rb similarity index 100% rename from spec/features/welcome_spec.rb rename to spec/system/welcome_spec.rb diff --git a/spec/features/xss_spec.rb b/spec/system/xss_spec.rb similarity index 100% rename from spec/features/xss_spec.rb rename to spec/system/xss_spec.rb From 1c8a49615a1047faf317cb2de1164730327c6a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 19 Jun 2019 17:43:33 +0200 Subject: [PATCH 08/16] Fix references to Capybara.app_host We were manually setting `http://www.example.com`. However, Capybara now uses `http://127.0.0.1`. While we could change the code to use `127.0.0.1`, I think directly using `Capybara.app_host` makes it easier to realize what the code is doing. And, particularly, now it's clear the host has nothing to do with our `Setting["url"]`, which by default points to `www.example.com` as well. --- spec/system/social_media_meta_tags_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/system/social_media_meta_tags_spec.rb b/spec/system/social_media_meta_tags_spec.rb index 08470ee7e..f114c204f 100644 --- a/spec/system/social_media_meta_tags_spec.rb +++ b/spec/system/social_media_meta_tags_spec.rb @@ -29,14 +29,14 @@ describe "Social media meta tags" do expect(page).to have_meta "twitter:title", with: meta_title expect(page).to have_meta "twitter:description", with: meta_description expect(page).to have_meta "twitter:image", - with: "http://www.example.com/social_media_icon_twitter.png" + with: "#{Capybara.app_host}/social_media_icon_twitter.png" expect(page).to have_property "og:title", with: meta_title expect(page).to have_property "article:publisher", with: url expect(page).to have_property "article:author", with: "https://www.facebook.com/" + facebook_handle - expect(page).to have_property "og:url", with: "http://www.example.com/" - expect(page).to have_property "og:image", with: "http://www.example.com/social_media_icon.png" + expect(page).to have_property "og:url", with: "#{Capybara.app_host}/" + expect(page).to have_property "og:image", with: "#{Capybara.app_host}/social_media_icon.png" expect(page).to have_property "og:site_name", with: org_name expect(page).to have_property "og:description", with: meta_description end From e6c747c96ce30088f3655ef37e7e31fbe386a906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 10 Jul 2019 01:51:03 +0200 Subject: [PATCH 09/16] Only load seeds once while testing Since we use transactions now for every test, we can seed the database at the beginning, and then it will go back to this state before a test is executed. Running the test suite is now considerably faster. On my machine, we save a quarter of second per system test, meaning we save several minutes for the whole suite. --- spec/spec_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4a1956218..ff616c6e9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,11 +20,14 @@ RSpec.configure do |config| config.include(CommonActions) config.include(ActiveSupport::Testing::TimeHelpers) + config.before(:suite) do + Rails.application.load_seed + end + config.before do |example| I18n.locale = :en Globalize.locale = nil Globalize.set_fallbacks_to_all_available_locales - load Rails.root.join("db", "seeds.rb").to_s Setting["feature.user.skip_verification"] = nil end From e316ad9c96d34012de165654081ce99498dd94ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 26 Mar 2020 14:14:18 +0100 Subject: [PATCH 10/16] Bump byebug to version 11.1.1 Rails 5.1 updated the `method_source` dependency, which is incompatible with pry 0.12.x (which some developers are using), and upgrading pry and pry-byebug requires a more recent version of byebug. --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index c72ff433b..2c2c3e208 100644 --- a/Gemfile +++ b/Gemfile @@ -67,7 +67,7 @@ end group :development, :test do gem "bullet", "~> 5.9.0" - gem "byebug", "~> 10.0.0" + gem "byebug", "~> 11.1.1" gem "factory_bot_rails", "~> 4.8.2" gem "faker", "~> 1.8.7" gem "i18n-tasks", "~> 0.9.29" diff --git a/Gemfile.lock b/Gemfile.lock index 5b2eeb0e2..1d64d39ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,7 +94,7 @@ GEM bullet (5.9.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) - byebug (10.0.0) + byebug (11.1.1) cancancan (2.3.0) capistrano (3.10.1) airbrussh (>= 1.0.0) @@ -609,7 +609,7 @@ DEPENDENCIES audited (~> 4.9.0) autoprefixer-rails (~> 8.2.0) bullet (~> 5.9.0) - byebug (~> 10.0.0) + byebug (~> 11.1.1) cancancan (~> 2.3.0) capistrano (~> 3.10.1) capistrano-bundler (~> 1.2) From 6c0365d0049017155b1a90afbdda4140ab80e4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 13 Apr 2020 15:49:01 +0200 Subject: [PATCH 11/16] Fix moving CKEditor dialog in specs CKEditor repositions the dialog to attach an image after showing it. If its position changes right when Capybara is trying to click the "Upload" link, the click does not work properly. I haven't found a way to check the dialog has stopped moving, so I've chosen to force its position to the top. Without this change, this test failed a lot on my machine when using Rails 5.1, both with an "iframe ckeditor" and an "inline ckeditor". However, it didn't fail when using Rails 5.0. --- spec/system/ckeditor_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/system/ckeditor_spec.rb b/spec/system/ckeditor_spec.rb index 35e9d360a..c1ffcaa91 100644 --- a/spec/system/ckeditor_spec.rb +++ b/spec/system/ckeditor_spec.rb @@ -20,6 +20,14 @@ describe "CKEditor" do visit new_admin_site_customization_page_path find(".cke_button__image").click + + expect(page).to have_css(".cke_dialog") + + execute_script "document.getElementsByClassName('cke_dialog')[0].style.left = '0px'" + execute_script "document.getElementsByClassName('cke_dialog')[0].style.top = '0px'" + + expect(find(".cke_dialog")).to match_style(left: "0px", top: "0px") + click_link "Upload" within_frame(1) do From 37361a6f3d333934336a1ef1ae786196bf82da39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 15 Apr 2020 15:00:32 +0200 Subject: [PATCH 12/16] Replace render :nothing with head :ok Using `render :nothing` was deprecated, but we never noticed it because we didn't have a test for the action using it. In Rails 5.1, it raises an exception. Using `head :ok` and adding a test for this scenario solves the issue. --- .../admin/poll/questions/answers_controller.rb | 2 +- .../admin/poll/questions/answers/answers_spec.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/poll/questions/answers_controller.rb b/app/controllers/admin/poll/questions/answers_controller.rb index 7b56de3c1..c75524a60 100644 --- a/app/controllers/admin/poll/questions/answers_controller.rb +++ b/app/controllers/admin/poll/questions/answers_controller.rb @@ -44,7 +44,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController def order_answers ::Poll::Question::Answer.order_answers(params[:ordered_list]) - render nothing: true + head :ok end private diff --git a/spec/system/admin/poll/questions/answers/answers_spec.rb b/spec/system/admin/poll/questions/answers/answers_spec.rb index fdd1a4863..395a1bed3 100644 --- a/spec/system/admin/poll/questions/answers/answers_spec.rb +++ b/spec/system/admin/poll/questions/answers/answers_spec.rb @@ -58,4 +58,20 @@ describe "Answers" do expect("Another title").to appear_before("New title") end + + scenario "Reorder", :js do + question = create(:poll_question) + create(:poll_question_answer, question: question, title: "First", given_order: 1) + create(:poll_question_answer, question: question, title: "Last", given_order: 2) + + visit admin_question_path(question) + + within("tbody.sortable") do + expect("First").to appear_before("Last") + + find("tr", text: "Last").drag_to(find("tr", text: "First")) + + expect("Last").to appear_before("First") + end + end end From 688aa8836645e25b05310000b492e15d8f2800cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 16 Apr 2020 13:52:26 +0200 Subject: [PATCH 13/16] Make migrations independent of globalize There are two reasons for this change: 1. Past migrations depending on models will not work once a model is removed, and they won't work if we remove Globalize either 2. We were getting a conflict in the schema file; when run under Rails 5.0, these migrations were generating a different schema than in Rails 5.1, due to the way the `create_translation_table!` method handles the `id: :serial` attribute. --- ..._make_investment_milestones_polymorphic.rb | 26 +++--- ...115545_create_i18n_content_translations.rb | 20 +++-- .../20180727140800_add_banner_translations.rb | 22 ++--- ...20800_add_homepage_content_translations.rb | 26 +++--- .../20180730213824_add_poll_translations.rb | 24 +++--- ...800_add_admin_notification_translations.rb | 22 ++--- ...31173147_add_poll_question_translations.rb | 18 +++-- ...9_add_poll_question_answer_translations.rb | 22 ++--- ..._collaborative_legislation_translations.rb | 80 +++++++++++-------- .../20180924071722_add_translate_pages.rb | 27 +++---- ...181129115006_add_proposals_translations.rb | 26 +++--- ...20181130141019_add_debates_translations.rb | 22 ++--- ...0181205102153_add_comments_translations.rb | 20 ++--- ..._add_home_page_to_legislation_processes.rb | 11 +-- ...4002_add_budget_investment_translations.rb | 24 +++--- .../20190103132925_create_progress_bars.rb | 22 ++--- ...104170114_add_active_polls_translations.rb | 20 ++--- .../20190118135741_add_budget_translations.rb | 20 ++--- ...119160418_add_budget_phase_translations.rb | 22 ++--- ...120155819_add_budget_group_translations.rb | 20 ++--- ...1171237_add_budget_heading_translations.rb | 20 ++--- 21 files changed, 257 insertions(+), 257 deletions(-) diff --git a/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb b/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb index 3b9b8d54d..423b76e9f 100644 --- a/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb +++ b/db/migrate/20180713124501_make_investment_milestones_polymorphic.rb @@ -1,27 +1,27 @@ class MakeInvestmentMilestonesPolymorphic < ActiveRecord::Migration[4.2] def change - create_table :milestones do |t| - t.references :milestoneable, polymorphic: true + create_table :milestones, id: :serial do |t| + t.string :milestoneable_type + t.integer :milestoneable_id t.string "title", limit: 80 t.text "description" t.datetime "publication_date" - t.references :status, index: true + t.integer :status_id, index: true t.timestamps null: false end - reversible do |change| - change.up do - Milestone.create_translation_table!({ - title: :string, - description: :text - }) - end + create_table :milestone_translations do |t| + t.integer :milestone_id, null: false + t.string :locale, null: false + t.timestamps null: false - change.down do - Milestone.drop_translation_table! - end + t.string :title + t.text :description + + t.index :locale + t.index :milestone_id end end end diff --git a/db/migrate/20180718115545_create_i18n_content_translations.rb b/db/migrate/20180718115545_create_i18n_content_translations.rb index 478ef6d8e..479b53942 100644 --- a/db/migrate/20180718115545_create_i18n_content_translations.rb +++ b/db/migrate/20180718115545_create_i18n_content_translations.rb @@ -1,20 +1,18 @@ class CreateI18nContentTranslations < ActiveRecord::Migration[4.2] def change - create_table :i18n_contents do |t| + create_table :i18n_contents, id: :serial do |t| t.string :key end - reversible do |dir| - dir.up do - I18nContent.create_translation_table!( - { value: :text }, - { migrate_data: true } - ) - end + create_table :i18n_content_translations do |t| + t.integer :i18n_content_id, null: false + t.string :locale, null: false + t.timestamps null: false - dir.down do - I18nContent.drop_translation_table! - end + t.text :value + + t.index :i18n_content_id + t.index :locale end end end diff --git a/db/migrate/20180727140800_add_banner_translations.rb b/db/migrate/20180727140800_add_banner_translations.rb index 710dc8237..36bbb541d 100644 --- a/db/migrate/20180727140800_add_banner_translations.rb +++ b/db/migrate/20180727140800_add_banner_translations.rb @@ -1,15 +1,15 @@ class AddBannerTranslations < ActiveRecord::Migration[4.2] - def self.up - Banner.create_translation_table!( - { - title: :string, - description: :text - }, - { migrate_data: true } - ) - end + def change + create_table :banner_translations do |t| + t.integer :banner_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Banner.drop_translation_table! + t.string :title + t.text :description + + t.index :banner_id + t.index :locale + end end end diff --git a/db/migrate/20180730120800_add_homepage_content_translations.rb b/db/migrate/20180730120800_add_homepage_content_translations.rb index b8c8a8e74..0d0c95c65 100644 --- a/db/migrate/20180730120800_add_homepage_content_translations.rb +++ b/db/migrate/20180730120800_add_homepage_content_translations.rb @@ -1,17 +1,17 @@ class AddHomepageContentTranslations < ActiveRecord::Migration[4.2] - def self.up - Widget::Card.create_translation_table!( - { - label: :string, - title: :string, - description: :text, - link_text: :string - }, - { migrate_data: true } - ) - end + def change + create_table :widget_card_translations do |t| + t.integer :widget_card_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Widget::Card.drop_translation_table! + t.string :label + t.string :title + t.text :description + t.string :link_text + + t.index :locale + t.index :widget_card_id + end end end diff --git a/db/migrate/20180730213824_add_poll_translations.rb b/db/migrate/20180730213824_add_poll_translations.rb index c4c9b4bbc..9acd6d2f6 100644 --- a/db/migrate/20180730213824_add_poll_translations.rb +++ b/db/migrate/20180730213824_add_poll_translations.rb @@ -1,16 +1,16 @@ class AddPollTranslations < ActiveRecord::Migration[4.2] - def self.up - Poll.create_translation_table!( - { - name: :string, - summary: :text, - description: :text - }, - { migrate_data: true } - ) - end + def change + create_table :poll_translations do |t| + t.integer :poll_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Poll.drop_translation_table! + t.string :name + t.text :summary + t.text :description + + t.index :locale + t.index :poll_id + end end end diff --git a/db/migrate/20180731150800_add_admin_notification_translations.rb b/db/migrate/20180731150800_add_admin_notification_translations.rb index daff4bc5d..5d5713d2a 100644 --- a/db/migrate/20180731150800_add_admin_notification_translations.rb +++ b/db/migrate/20180731150800_add_admin_notification_translations.rb @@ -1,15 +1,15 @@ class AddAdminNotificationTranslations < ActiveRecord::Migration[4.2] - def self.up - AdminNotification.create_translation_table!( - { - title: :string, - body: :text - }, - { migrate_data: true } - ) - end + def change + create_table :admin_notification_translations do |t| + t.integer :admin_notification_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - AdminNotification.drop_translation_table! + t.string :title + t.text :body + + t.index :admin_notification_id + t.index :locale + end end end diff --git a/db/migrate/20180731173147_add_poll_question_translations.rb b/db/migrate/20180731173147_add_poll_question_translations.rb index 6d5676c40..55955ae43 100644 --- a/db/migrate/20180731173147_add_poll_question_translations.rb +++ b/db/migrate/20180731173147_add_poll_question_translations.rb @@ -1,12 +1,14 @@ class AddPollQuestionTranslations < ActiveRecord::Migration[4.2] - def self.up - Poll::Question.create_translation_table!( - { title: :string }, - { migrate_data: true } - ) - end + def change + create_table :poll_question_translations do |t| + t.integer :poll_question_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Poll::Question.drop_translation_table! + t.string :title + + t.index :locale + t.index :poll_question_id + end end end diff --git a/db/migrate/20180801114529_add_poll_question_answer_translations.rb b/db/migrate/20180801114529_add_poll_question_answer_translations.rb index f9ef730d5..33cff66f3 100644 --- a/db/migrate/20180801114529_add_poll_question_answer_translations.rb +++ b/db/migrate/20180801114529_add_poll_question_answer_translations.rb @@ -1,15 +1,15 @@ class AddPollQuestionAnswerTranslations < ActiveRecord::Migration[4.2] - def self.up - Poll::Question::Answer.create_translation_table!( - { - title: :string, - description: :text - }, - { migrate_data: true } - ) - end + def change + create_table :poll_question_answer_translations do |t| + t.integer :poll_question_answer_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Poll::Question::Answer.drop_translation_table! + t.string :title + t.text :description + + t.index :locale + t.index :poll_question_answer_id, name: "index_85270fa85f62081a3a227186b4c95fe4f7fa94b9" + end end end diff --git a/db/migrate/20180801140800_add_collaborative_legislation_translations.rb b/db/migrate/20180801140800_add_collaborative_legislation_translations.rb index 7dc385f77..9a30618f1 100644 --- a/db/migrate/20180801140800_add_collaborative_legislation_translations.rb +++ b/db/migrate/20180801140800_add_collaborative_legislation_translations.rb @@ -1,42 +1,54 @@ class AddCollaborativeLegislationTranslations < ActiveRecord::Migration[4.2] - def self.up - Legislation::Process.create_translation_table!( - { - title: :string, - summary: :text, - description: :text, - additional_info: :text - }, - { migrate_data: true } - ) + def change + create_table :legislation_process_translations do |t| + t.integer :legislation_process_id, null: false + t.string :locale, null: false + t.timestamps null: false - Legislation::Question.create_translation_table!( - { title: :text }, - { migrate_data: true } - ) + t.string :title + t.text :summary + t.text :description + t.text :additional_info - Legislation::DraftVersion.create_translation_table!( - { - title: :string, - changelog: :text, - body: :text - }, - { migrate_data: true } - ) + t.index :legislation_process_id, name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55" + t.index :locale + end - add_column :legislation_draft_version_translations, :body_html, :text - add_column :legislation_draft_version_translations, :toc_html, :text + create_table :legislation_question_translations do |t| + t.integer :legislation_question_id, null: false + t.string :locale, null: false + t.timestamps null: false - Legislation::QuestionOption.create_translation_table!( - { value: :string }, - { migrate_data: true } - ) - end + t.text :title - def self.down - Legislation::Process.drop_translation_table! - Legislation::DraftVersion.drop_translation_table! - Legislation::Question.drop_translation_table! - Legislation::QuestionOption.drop_translation_table! + t.index :legislation_question_id, name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3" + t.index :locale + end + + create_table :legislation_draft_version_translations do |t| + t.integer :legislation_draft_version_id, null: false + t.string :locale, null: false + t.timestamps null: false + + t.string :title + t.text :changelog + t.text :body + t.text :body_html + t.text :toc_html + + t.index :legislation_draft_version_id, name: "index_900e5ba94457606e69e89193db426e8ddff809bc" + t.index :locale + end + + create_table :legislation_question_option_translations do |t| + t.integer :legislation_question_option_id, null: false + t.string :locale, null: false + t.timestamps null: false + + t.string :value + + t.index :legislation_question_option_id, name: "index_61bcec8729110b7f8e1e9e5ce08780878597a209" + t.index :locale + end end end diff --git a/db/migrate/20180924071722_add_translate_pages.rb b/db/migrate/20180924071722_add_translate_pages.rb index 987da6eb8..a5f5cfdce 100644 --- a/db/migrate/20180924071722_add_translate_pages.rb +++ b/db/migrate/20180924071722_add_translate_pages.rb @@ -1,19 +1,18 @@ class AddTranslatePages < ActiveRecord::Migration[4.2] - def self.up - SiteCustomization::Page.create_translation_table!( - { - title: :string, - subtitle: :string, - content: :text - }, - { migrate_data: true } - ) + def change + create_table :site_customization_page_translations do |t| + t.integer :site_customization_page_id, null: false + t.string :locale, null: false + t.timestamps null: false - change_column :site_customization_pages, :title, :string, null: true - end + t.string :title + t.string :subtitle + t.text :content - def self.down - SiteCustomization::Page.drop_translation_table! - change_column :site_customization_pages, :title, :string, null: false + t.index :locale + t.index :site_customization_page_id, name: "index_7fa0f9505738cb31a31f11fb2f4c4531fed7178b" + end + + change_column_null :site_customization_pages, :title, from: false, to: true end end diff --git a/db/migrate/20181129115006_add_proposals_translations.rb b/db/migrate/20181129115006_add_proposals_translations.rb index 8f05fbffd..4348cdbc8 100644 --- a/db/migrate/20181129115006_add_proposals_translations.rb +++ b/db/migrate/20181129115006_add_proposals_translations.rb @@ -1,17 +1,17 @@ class AddProposalsTranslations < ActiveRecord::Migration[4.2] - def self.up - Proposal.create_translation_table!( - { - title: :string, - description: :text, - summary: :text, - retired_explanation: :text - }, - { migrate_data: true } - ) - end + def change + create_table :proposal_translations do |t| + t.integer :proposal_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Proposal.drop_translation_table! + t.string :title + t.text :description + t.text :summary + t.text :retired_explanation + + t.index :locale + t.index :proposal_id + end end end diff --git a/db/migrate/20181130141019_add_debates_translations.rb b/db/migrate/20181130141019_add_debates_translations.rb index 2cd1ad432..607abe3d3 100644 --- a/db/migrate/20181130141019_add_debates_translations.rb +++ b/db/migrate/20181130141019_add_debates_translations.rb @@ -1,15 +1,15 @@ class AddDebatesTranslations < ActiveRecord::Migration[4.2] - def self.up - Debate.create_translation_table!( - { - title: :string, - description: :text - }, - { migrate_data: true } - ) - end + def change + create_table :debate_translations do |t| + t.integer :debate_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Debate.drop_translation_table! + t.string :title + t.text :description + + t.index :debate_id + t.index :locale + end end end diff --git a/db/migrate/20181205102153_add_comments_translations.rb b/db/migrate/20181205102153_add_comments_translations.rb index a7ea1b64c..c834a4bff 100644 --- a/db/migrate/20181205102153_add_comments_translations.rb +++ b/db/migrate/20181205102153_add_comments_translations.rb @@ -1,14 +1,14 @@ class AddCommentsTranslations < ActiveRecord::Migration[4.2] - def self.up - Comment.create_translation_table!( - { - body: :text - }, - { migrate_data: true } - ) - end + def change + create_table :comment_translations do |t| + t.integer :comment_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Comment.drop_translation_table! + t.text :body + + t.index :comment_id + t.index :locale + end end 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 101aedbfe..741f8b424 100644 --- a/db/migrate/20181206153510_add_home_page_to_legislation_processes.rb +++ b/db/migrate/20181206153510_add_home_page_to_legislation_processes.rb @@ -1,15 +1,6 @@ class AddHomePageToLegislationProcesses < ActiveRecord::Migration[4.2] def change add_column :legislation_processes, :homepage_enabled, :boolean, default: false - - reversible do |dir| - dir.up do - Legislation::Process.add_translation_fields! homepage: :text - end - - dir.down do - remove_column :legislation_process_translations, :homepage - end - end + add_column :legislation_process_translations, :homepage, :text end end diff --git a/db/migrate/20181214094002_add_budget_investment_translations.rb b/db/migrate/20181214094002_add_budget_investment_translations.rb index 51b9fd048..53d7f9831 100644 --- a/db/migrate/20181214094002_add_budget_investment_translations.rb +++ b/db/migrate/20181214094002_add_budget_investment_translations.rb @@ -1,17 +1,15 @@ class AddBudgetInvestmentTranslations < ActiveRecord::Migration[4.2] - def self.up - Budget::Investment::Translation.without_auditing do - Budget::Investment.create_translation_table!( - { - title: :string, - description: :text - }, - { migrate_data: true } - ) + def change + create_table :budget_investment_translations do |t| + t.integer :budget_investment_id, null: false + t.string :locale, null: false + t.timestamps null: false + + t.string :title + t.text :description + + t.index :budget_investment_id + t.index :locale end end - - def self.down - Budget::Investment.drop_translation_table! - end end diff --git a/db/migrate/20190103132925_create_progress_bars.rb b/db/migrate/20190103132925_create_progress_bars.rb index 3ada28004..d7e026e35 100644 --- a/db/migrate/20190103132925_create_progress_bars.rb +++ b/db/migrate/20190103132925_create_progress_bars.rb @@ -1,23 +1,23 @@ class CreateProgressBars < ActiveRecord::Migration[4.2] def change - create_table :progress_bars do |t| + create_table :progress_bars, id: :serial do |t| t.integer :kind t.integer :percentage - t.references :progressable, polymorphic: true + t.string :progressable_type + t.integer :progressable_id t.timestamps null: false end - reversible do |change| - change.up do - ProgressBar.create_translation_table!({ - title: :string - }) - end + create_table :progress_bar_translations do |t| + t.integer :progress_bar_id, null: false + t.string :locale, null: false + t.timestamps null: false - change.down do - ProgressBar.drop_translation_table! - end + t.string :title + + t.index :locale + t.index :progress_bar_id end end end diff --git a/db/migrate/20190104170114_add_active_polls_translations.rb b/db/migrate/20190104170114_add_active_polls_translations.rb index 51f99a0e8..ef3ff02b2 100644 --- a/db/migrate/20190104170114_add_active_polls_translations.rb +++ b/db/migrate/20190104170114_add_active_polls_translations.rb @@ -1,14 +1,14 @@ class AddActivePollsTranslations < ActiveRecord::Migration[4.2] - def self.up - ActivePoll.create_translation_table!( - { - description: :text - }, - { migrate_data: true } - ) - end + def change + create_table :active_poll_translations do |t| + t.integer :active_poll_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - ActivePollPoll.drop_translation_table! + t.text "description" + + t.index :active_poll_id + t.index :locale + end end end diff --git a/db/migrate/20190118135741_add_budget_translations.rb b/db/migrate/20190118135741_add_budget_translations.rb index a561ebb47..41d04db86 100644 --- a/db/migrate/20190118135741_add_budget_translations.rb +++ b/db/migrate/20190118135741_add_budget_translations.rb @@ -1,14 +1,14 @@ class AddBudgetTranslations < ActiveRecord::Migration[4.2] - def self.up - Budget.create_translation_table!( - { - name: :string - }, - { migrate_data: true } - ) - end + def change + create_table :budget_translations do |t| + t.integer :budget_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Budget.drop_translation_table! + t.string :name + + t.index :budget_id + t.index :locale + end end end diff --git a/db/migrate/20190119160418_add_budget_phase_translations.rb b/db/migrate/20190119160418_add_budget_phase_translations.rb index 07bbf3c84..e3f10a8a9 100644 --- a/db/migrate/20190119160418_add_budget_phase_translations.rb +++ b/db/migrate/20190119160418_add_budget_phase_translations.rb @@ -1,15 +1,15 @@ class AddBudgetPhaseTranslations < ActiveRecord::Migration[4.2] - def self.up - Budget::Phase.create_translation_table!( - { - description: :text, - summary: :text - }, - { migrate_data: true } - ) - end + def change + create_table :budget_phase_translations do |t| + t.integer :budget_phase_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Budget::Phase.drop_translation_table! + t.text :description + t.text :summary + + t.index :budget_phase_id + t.index :locale + end end end diff --git a/db/migrate/20190120155819_add_budget_group_translations.rb b/db/migrate/20190120155819_add_budget_group_translations.rb index b7c2e841f..d45795192 100644 --- a/db/migrate/20190120155819_add_budget_group_translations.rb +++ b/db/migrate/20190120155819_add_budget_group_translations.rb @@ -1,14 +1,14 @@ class AddBudgetGroupTranslations < ActiveRecord::Migration[4.2] - def self.up - Budget::Group.create_translation_table!( - { - name: :string - }, - { migrate_data: true } - ) - end + def change + create_table :budget_group_translations do |t| + t.integer :budget_group_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Budget::Group.drop_translation_table! + t.string :name + + t.index :budget_group_id + t.index :locale + end end end diff --git a/db/migrate/20190121171237_add_budget_heading_translations.rb b/db/migrate/20190121171237_add_budget_heading_translations.rb index f6889422e..c8cf50e09 100644 --- a/db/migrate/20190121171237_add_budget_heading_translations.rb +++ b/db/migrate/20190121171237_add_budget_heading_translations.rb @@ -1,14 +1,14 @@ class AddBudgetHeadingTranslations < ActiveRecord::Migration[4.2] - def self.up - Budget::Heading.create_translation_table!( - { - name: :string - }, - { migrate_data: true } - ) - end + def change + create_table :budget_heading_translations do |t| + t.integer :budget_heading_id, null: false + t.string :locale, null: false + t.timestamps null: false - def self.down - Budget::Heading.drop_translation_table! + t.string :name + + t.index :budget_heading_id + t.index :locale + end end end From 5b97b20f9605b90f5af48224d4b2677db3d01d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 17 Apr 2020 16:06:29 +0200 Subject: [PATCH 14/16] Wait for CKEditor to load in specs Some specs involving CKEditor were failing sometimes in the Rails 5.1 branch. The reason why these specs pass with Rails 5.0 but fail with Rails 5.1 are unknown. On my machine the tests pass when precompiling the assets, which makes me think it's related to the way Rails handles them, but it might have nothing to do with it. The only (apparently) 100% reliable solution I've found is to wait for CKEditor to load before trying to fill it in. After running the tests on my machine hundreds of time, I didn't get a single failure. --- spec/support/common_actions/verifications.rb | 4 ++++ spec/system/ckeditor_spec.rb | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/support/common_actions/verifications.rb b/spec/support/common_actions/verifications.rb index 1023a69b4..72723dcfa 100644 --- a/spec/support/common_actions/verifications.rb +++ b/spec/support/common_actions/verifications.rb @@ -47,6 +47,10 @@ module Verifications def fill_in_ckeditor(text, params = {}) locator = find("label", text: text)[:for] + until page.execute_script("return CKEDITOR.instances.#{locator}.status === 'ready';") do + sleep 0.01 + end + # Fill the editor content page.execute_script <<-SCRIPT var ckeditor = CKEDITOR.instances.#{locator} diff --git a/spec/system/ckeditor_spec.rb b/spec/system/ckeditor_spec.rb index c1ffcaa91..ea72ca4ca 100644 --- a/spec/system/ckeditor_spec.rb +++ b/spec/system/ckeditor_spec.rb @@ -19,6 +19,7 @@ describe "CKEditor" do login_as(create(:administrator).user) visit new_admin_site_customization_page_path + fill_in_ckeditor "Content", with: "Filling in to make sure CKEditor is loaded" find(".cke_button__image").click expect(page).to have_css(".cke_dialog") @@ -41,8 +42,9 @@ describe "CKEditor" do scenario "cannot upload attachments through link tab", :js do login_as(create(:administrator).user) - visit new_admin_site_customization_page_path + visit new_admin_site_customization_page_path + fill_in_ckeditor "Content", with: "Filling in to make sure CKEditor is loaded" find(".cke_button__link").click expect(page).to have_css(".cke_dialog") From a103b5392ef291e52cda76313eb435e04eaf2bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 17 Apr 2020 16:15:33 +0200 Subject: [PATCH 15/16] Use more consistent parameter names I incorrectly used "text" as variable name in commit 2cdc6a1b. In similar places, we use `label`. We also use named parameters when only `with:` is provided. --- spec/support/common_actions/verifications.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/support/common_actions/verifications.rb b/spec/support/common_actions/verifications.rb index 72723dcfa..92ef462e0 100644 --- a/spec/support/common_actions/verifications.rb +++ b/spec/support/common_actions/verifications.rb @@ -44,8 +44,8 @@ module Verifications end end - def fill_in_ckeditor(text, params = {}) - locator = find("label", text: text)[:for] + def fill_in_ckeditor(label, with:) + locator = find("label", text: label)[:for] until page.execute_script("return CKEDITOR.instances.#{locator}.status === 'ready';") do sleep 0.01 @@ -54,11 +54,11 @@ module Verifications # Fill the editor content page.execute_script <<-SCRIPT var ckeditor = CKEDITOR.instances.#{locator} - ckeditor.setData("#{params[:with]}") + ckeditor.setData("#{with}") ckeditor.focus() ckeditor.updateElement() SCRIPT - expect(page).to have_ckeditor text, with: params[:with] + expect(page).to have_ckeditor label, with: with end end From 7e702fc7ed6fe67b0cda814fe511c8524310fdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 20 Apr 2020 16:33:33 +0200 Subject: [PATCH 16/16] Fix DB corruption in system tests after exceptions This is a known bug in Rails, fixed in the Rails 5.2 and Rails 6.x branches: https://github.com/rails/rails/pull/32293/commits/5c4e1338 --- spec/rails_helper.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index c4756dd02..3de8fd85d 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -19,6 +19,18 @@ Warden.test_mode! ActiveRecord::Migration.maintain_test_schema! +# Monkey patch from https://github.com/rails/rails/pull/32293 +# Remove when we upgrade to Rails 5.2 +require "action_dispatch/system_testing/test_helpers/setup_and_teardown" +module ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown + def after_teardown + take_failed_screenshot + Capybara.reset_sessions! + ensure + super + end +end + RSpec.configure do |config| config.infer_spec_type_from_file_location! config.after do