From b493b0f885c83120b2bf861c30e3258df0d51015 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 2 Jun 2023 17:45:25 +0530 Subject: [PATCH] feat: add model --- app/models/conversation_with_label.rb | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 app/models/conversation_with_label.rb diff --git a/app/models/conversation_with_label.rb b/app/models/conversation_with_label.rb new file mode 100644 index 000000000..3ae1858c2 --- /dev/null +++ b/app/models/conversation_with_label.rb @@ -0,0 +1,39 @@ +# == Schema Information +# +# Table name: conversation_with_labels +# +# id :integer +# additional_attributes :jsonb +# agent_last_seen_at :datetime +# assignee_last_seen_at :datetime +# contact_last_seen_at :datetime +# custom_attributes :jsonb +# first_reply_created_at :datetime +# identifier :string +# labels_array :string is an Array +# last_activity_at :datetime +# priority :integer +# snoozed_until :datetime +# status :integer +# uuid :uuid +# created_at :datetime +# updated_at :datetime +# account_id :integer +# assignee_id :integer +# campaign_id :bigint +# contact_id :bigint +# contact_inbox_id :bigint +# display_id :integer +# inbox_id :integer +# team_id :bigint +# +class ConversationWithLabel < ApplicationRecord + def self.refresh + # https://github.com/scenic-views/scenic#what-about-materialized-views + Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false) + end + + def readonly? + true + end +end