2024-11-12 15:35:20 -05:00
|
|
|
# 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
|
2024-12-05 18:10:32 -05:00
|
|
|
|
|
|
|
# The author of the moved post
|
|
|
|
belongs_to :posting_user, class_name: "User", foreign_key: :post_user_id
|
|
|
|
|
|
|
|
# The user who moved the post
|
|
|
|
belongs_to :user
|
2024-11-12 15:35:20 -05:00
|
|
|
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
|
2024-12-05 18:10:32 -05:00
|
|
|
# old_topic_title :string
|
|
|
|
# post_user_id :integer
|
|
|
|
# user_id :integer
|
2024-12-12 12:47:14 -05:00
|
|
|
# full_move :boolean
|
2024-11-12 15:35:20 -05:00
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
2024-12-05 18:10:32 -05:00
|
|
|
# index_moved_posts_on_new_post_id (new_post_id)
|
|
|
|
# index_moved_posts_on_new_topic_id (new_topic_id)
|
|
|
|
# index_moved_posts_on_new_topic_id_and_post_user_id (new_topic_id,post_user_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)
|
2024-11-12 15:35:20 -05:00
|
|
|
#
|