mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
9b8af0ea9f
This is a very simple change, which creates a permanent table in the DB, rather than generating a temporary table when moving posts. This change is about capturing data and any usage will appear in a follow-up. I did include a new column created_new_topic in the new table, so that it can be easily audited without having to compare destination topic created_at with moved_post records.
35 lines
1.2 KiB
Ruby
35 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class MovedPost < ActiveRecord::Base
|
|
belongs_to :old_topic, class_name: "Topic", foreign_key: :old_topic_id
|
|
belongs_to :old_post, class_name: "Post", foreign_key: :old_post_id
|
|
|
|
belongs_to :new_topic, class_name: "Topic", foreign_key: :new_topic_id
|
|
belongs_to :new_post, class_name: "Post", foreign_key: :new_post_id
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: moved_posts
|
|
#
|
|
# id :bigint not null, primary key
|
|
# old_topic_id :bigint not null
|
|
# old_post_id :bigint not null
|
|
# old_post_number :bigint not null
|
|
# new_topic_id :bigint not null
|
|
# new_topic_title :string not null
|
|
# new_post_id :bigint not null
|
|
# new_post_number :bigint not null
|
|
# created_new_topic :boolean default(FALSE), not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_moved_posts_on_new_post_id (new_post_id)
|
|
# index_moved_posts_on_new_topic_id (new_topic_id)
|
|
# index_moved_posts_on_old_post_id (old_post_id)
|
|
# index_moved_posts_on_old_post_number (old_post_number)
|
|
# index_moved_posts_on_old_topic_id (old_topic_id)
|
|
#
|