From 075c90cbad2c3f9646ab11dfa729f0aad9a66652 Mon Sep 17 00:00:00 2001 From: Rob Orton Date: Sat, 26 Sep 2015 17:31:23 -0600 Subject: [PATCH] expand external_feed_entries urls to text fixes CNVS-23676 refs CNVS-17774 test plan - db:migrate should work Change-Id: I13633c077e2f1c0b9b9df521dc8942c9c87d0aa3 Reviewed-on: https://gerrit.instructure.com/64091 Product-Review: Rob Orton QA-Review: Rob Orton Tested-by: Jenkins Reviewed-by: Jacob Fugal --- app/models/external_feed_entry.rb | 9 +++++++-- ...0926232040_expand_external_feed_url_columns.rb | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20150926232040_expand_external_feed_url_columns.rb diff --git a/app/models/external_feed_entry.rb b/app/models/external_feed_entry.rb index a6cc2c337b5..046119b8ead 100644 --- a/app/models/external_feed_entry.rb +++ b/app/models/external_feed_entry.rb @@ -26,8 +26,13 @@ class ExternalFeedEntry < ActiveRecord::Base before_save :infer_defaults validates_presence_of :external_feed_id, :workflow_state - validates_length_of :title, :maximum => maximum_text_length, :allow_nil => true, :allow_blank => true - validates_length_of :message, :maximum => maximum_text_length, :allow_nil => true, :allow_blank => true + validates :title, length: {maximum: maximum_text_length, allow_nil: true, allow_blank: true} + validates :message, length: {maximum: maximum_text_length, allow_nil: true, allow_blank: true} + validates :source_url, length: {maximum: maximum_text_length, allow_nil: true, allow_blank: true} + validates :url, length: {maximum: maximum_text_length, allow_nil: true, allow_blank: true} + validates :author_name, length: {maximum: maximum_string_length, allow_nil: true, allow_blank: false} + validates :author_url, length: {maximum: maximum_text_length, allow_nil: true, allow_blank: false} + validates :author_email, length: {maximum: maximum_string_length, allow_nil: true, allow_blank: false} sanitize_field :message, CanvasSanitize::SANITIZE attr_accessible :title, :message, :source_name, :source_url, :posted_at, :start_at, :end_at, :user, :url, :uuid, :author_name, :author_url, :author_email, :asset diff --git a/db/migrate/20150926232040_expand_external_feed_url_columns.rb b/db/migrate/20150926232040_expand_external_feed_url_columns.rb new file mode 100644 index 00000000000..999a6387ded --- /dev/null +++ b/db/migrate/20150926232040_expand_external_feed_url_columns.rb @@ -0,0 +1,15 @@ +class ExpandExternalFeedUrlColumns < ActiveRecord::Migration + tag :postdeploy + + def self.up + change_column :external_feed_entries, :url, :text + change_column :external_feed_entries, :source_url, :text + change_column :external_feed_entries, :author_url, :text + end + + def self.down + change_column :external_feed_entries, :url, :string + change_column :external_feed_entries, :source_url, :string + change_column :external_feed_entries, :author_url, :string + end +end