Remove deprecated Organization's columns (#19396)

Co-authored-by: Lawrence <lawrence@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
This commit is contained in:
Dhanujha R 2023-06-26 20:06:33 +05:30 committed by GitHub
parent 3bc04bdcc2
commit c9902fce6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View file

@ -1,6 +1,6 @@
module Search
class OrganizationSerializer < ApplicationSerializer
attribute :class_name, -> { "Organization" }
attributes :id, :name, :summary, :profile_image, :twitter_username, :nav_image, :slug
attributes :id, :name, :summary, :profile_image, :twitter_username, :slug
end
end

View file

@ -0,0 +1,6 @@
class RemoveNavImageFromOrganizations < ActiveRecord::Migration[7.0]
def change
safety_assured { remove_column :organizations, :nav_image, :string }
safety_assured { remove_column :organizations, :dark_nav_image, :string }
end
end

View file

@ -704,14 +704,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_22_151553) do
t.string "cta_button_text"
t.string "cta_button_url"
t.text "cta_processed_html"
t.string "dark_nav_image"
t.string "email"
t.string "github_username"
t.datetime "last_article_at", precision: nil, default: "2017-01-01 05:00:00"
t.datetime "latest_article_updated_at", precision: nil
t.string "location"
t.string "name"
t.string "nav_image"
t.string "old_old_slug"
t.string "old_slug"
t.string "profile_image"

View file

@ -5,7 +5,7 @@ RSpec.describe Search::OrganizationSerializer do
it "serializes a organization" do
data_hash = described_class.new(organization).serializable_hash.dig(:data, :attributes)
expect(data_hash.keys).to include(:id, :name, :summary, :profile_image, :twitter_username, :nav_image, :slug)
expect(data_hash.keys).to include(:id, :name, :summary, :profile_image, :twitter_username, :slug)
expect(data_hash[:id]).to eq(organization.id)
expect(data_hash[:name]).to eq(organization.name)
expect(data_hash[:profile_image]).to eq(organization.profile_image)