chore: remove unused telegram bot model (#12417)
## Summary - remove unused TelegramBot model and its association - drop obsolete telegram_bots table
This commit is contained in:
@@ -89,7 +89,6 @@ class Account < ApplicationRecord
|
||||
has_many :portals, dependent: :destroy_async, class_name: '::Portal'
|
||||
has_many :sms_channels, dependent: :destroy_async, class_name: '::Channel::Sms'
|
||||
has_many :teams, dependent: :destroy_async
|
||||
has_many :telegram_bots, dependent: :destroy_async
|
||||
has_many :telegram_channels, dependent: :destroy_async, class_name: '::Channel::Telegram'
|
||||
has_many :twilio_sms, dependent: :destroy_async, class_name: '::Channel::TwilioSms'
|
||||
has_many :twitter_profiles, dependent: :destroy_async, class_name: '::Channel::TwitterProfile'
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: telegram_bots
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# auth_key :string
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
#
|
||||
|
||||
class TelegramBot < ApplicationRecord
|
||||
belongs_to :account
|
||||
has_one :inbox, as: :channel, dependent: :destroy_async
|
||||
validates :auth_key, uniqueness: { scope: :account_id }
|
||||
end
|
||||
10
db/migrate/20250826000000_drop_telegram_bots.rb
Normal file
10
db/migrate/20250826000000_drop_telegram_bots.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class DropTelegramBots < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
drop_table :telegram_bots do |t|
|
||||
t.string :name
|
||||
t.string :auth_key
|
||||
t.integer :account_id
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
10
db/schema.rb
10
db/schema.rb
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2025_08_25_070005) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2025_08_26_000000) do
|
||||
# These extensions should be enabled to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "pg_trgm"
|
||||
@@ -1146,14 +1146,6 @@ ActiveRecord::Schema[7.1].define(version: 2025_08_25_070005) do
|
||||
t.index ["name", "account_id"], name: "index_teams_on_name_and_account_id", unique: true
|
||||
end
|
||||
|
||||
create_table "telegram_bots", id: :serial, force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "auth_key"
|
||||
t.integer "account_id"
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
end
|
||||
|
||||
create_table "users", id: :serial, force: :cascade do |t|
|
||||
t.string "provider", default: "email", null: false
|
||||
t.string "uid", default: "", null: false
|
||||
|
||||
@@ -8,7 +8,6 @@ RSpec.describe Account do
|
||||
it { is_expected.to have_many(:inboxes).dependent(:destroy_async) }
|
||||
it { is_expected.to have_many(:conversations).dependent(:destroy_async) }
|
||||
it { is_expected.to have_many(:contacts).dependent(:destroy_async) }
|
||||
it { is_expected.to have_many(:telegram_bots).dependent(:destroy_async) }
|
||||
it { is_expected.to have_many(:canned_responses).dependent(:destroy_async) }
|
||||
it { is_expected.to have_many(:facebook_pages).class_name('::Channel::FacebookPage').dependent(:destroy_async) }
|
||||
it { is_expected.to have_many(:web_widgets).class_name('::Channel::WebWidget').dependent(:destroy_async) }
|
||||
|
||||
Reference in New Issue
Block a user