Remove link column in dashboard actions
This column wasn't used in any released Consul version since it was only used during development. For the same reason, the task to migrate the information in the `link` column to the `links` table isn't needed either.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class RemoveLinkFromDashboardActions < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_column :dashboard_actions, :link, :string
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user