BigW Consortium Gitlab

Unverified Commit 63c7801e by Douwe Maan Committed by Luke "Jared" Bennett

Remove and ignore notes.original_discussion_id column

parent c319f211
# Module that can be included into a model to make it easier to ignore database
# columns.
#
# Example:
#
# class User < ActiveRecord::Base
# include IgnorableColumn
#
# ignore_column :updated_at
# end
#
module IgnorableColumn
extend ActiveSupport::Concern
module ClassMethods
def columns
super.reject { |column| ignored_columns.include?(column.name) }
end
def ignored_columns
@ignored_columns ||= Set.new
end
def ignore_column(name)
ignored_columns << name.to_s
end
end
end
......@@ -9,6 +9,9 @@ class Note < ActiveRecord::Base
include CacheMarkdownField
include AfterCommitQueue
include ResolvableNote
include IgnorableColumn
ignore_column :original_discussion_id
cache_markdown_field :note, pipeline: :note
......
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class RemoveNotesOriginalDiscussionId < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def change
remove_column :notes, :original_discussion_id, :string
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170402231018) do
ActiveRecord::Schema.define(version: 20170404170532) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -724,7 +724,6 @@ ActiveRecord::Schema.define(version: 20170402231018) do
t.datetime "resolved_at"
t.integer "resolved_by_id"
t.string "discussion_id"
t.string "original_discussion_id"
t.text "note_html"
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment