feat: Enable Slack Integration in all channels (#1175)

This commit is contained in:
Sojan Jose
2020-08-29 01:39:41 +05:30
committed by GitHub
parent 45cd949c40
commit 85ae6d92b9
6 changed files with 48 additions and 21 deletions

View File

@@ -0,0 +1,16 @@
class AddExternalSourceIdsToMessages < ActiveRecord::Migration[6.0]
def change
add_column :messages, :external_source_ids, :jsonb, default: {}
migrate_slack_external_source_ids
end
def migrate_slack_external_source_ids
Message.where('source_id LIKE ?', 'slack_%').find_in_batches do |message_batch|
message_batch.each do |message|
message.external_source_id_slack = message.source_id.split('slack_')[1]
message.source_id = nil
message.save!
end
end
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_08_19_190629) do
ActiveRecord::Schema.define(version: 2020_08_28_175931) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@@ -328,6 +328,7 @@ ActiveRecord::Schema.define(version: 2020_08_19_190629) do
t.json "content_attributes", default: {}
t.string "sender_type"
t.bigint "sender_id"
t.jsonb "external_source_ids", default: {}
t.index ["account_id"], name: "index_messages_on_account_id"
t.index ["conversation_id"], name: "index_messages_on_conversation_id"
t.index ["inbox_id"], name: "index_messages_on_inbox_id"