diff --git a/db/migrate/20210825152739_remove_link_from_dashboard_actions.rb b/db/migrate/20210825152739_remove_link_from_dashboard_actions.rb new file mode 100644 index 000000000..650414b24 --- /dev/null +++ b/db/migrate/20210825152739_remove_link_from_dashboard_actions.rb @@ -0,0 +1,5 @@ +class RemoveLinkFromDashboardActions < ActiveRecord::Migration[5.2] + def change + remove_column :dashboard_actions, :link, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 0537d3c8f..755e3b417 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_08_11_195800) do +ActiveRecord::Schema.define(version: 2021_08_25_152739) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -466,7 +466,6 @@ ActiveRecord::Schema.define(version: 2021_08_11_195800) do 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 diff --git a/lib/tasks/proposal_actions.rake b/lib/tasks/proposal_actions.rake deleted file mode 100644 index c7aabab85..000000000 --- a/lib/tasks/proposal_actions.rake +++ /dev/null @@ -1,10 +0,0 @@ -namespace :proposal_actions do - desc "Move link attribute to links collection" - task migrate_links: :environment do - ProposalDashboardAction.where.not(link: nil).each do |action| - next if action.link.blank? - - Link.create!(label: action.title, url: action.link, linkable: action) - end - end -end diff --git a/spec/factories/proposals.rb b/spec/factories/proposals.rb index 1398bea22..925849b8d 100644 --- a/spec/factories/proposals.rb +++ b/spec/factories/proposals.rb @@ -137,7 +137,6 @@ FactoryBot.define do factory :dashboard_action, class: "Dashboard::Action" do title { Faker::Lorem.sentence[0..79].strip } description { Faker::Lorem.sentence } - link { nil } request_to_administrators { true } day_offset { 0 } required_supports { 0 } @@ -150,10 +149,6 @@ FactoryBot.define do request_to_administrators { true } end - trait :external_link do - link { Faker::Internet.url } - end - trait :inactive do active { false } end diff --git a/spec/models/dashboard/executed_action_spec.rb b/spec/models/dashboard/executed_action_spec.rb index dd6181a78..268cc6054 100644 --- a/spec/models/dashboard/executed_action_spec.rb +++ b/spec/models/dashboard/executed_action_spec.rb @@ -2,9 +2,7 @@ require "rails_helper" describe Dashboard::ExecutedAction do let(:proposal) { create :proposal } - let(:action) do - create :dashboard_action, request_to_administrators: true, link: Faker::Internet.url - end + let(:action) { create :dashboard_action, request_to_administrators: true } it "is invalid when proposal is nil" do action = build(:dashboard_executed_action, proposal: nil)