diff --git a/app/models/integrations/hook.rb b/app/models/integrations/hook.rb index 57d052584..9d80b245b 100644 --- a/app/models/integrations/hook.rb +++ b/app/models/integrations/hook.rb @@ -6,7 +6,7 @@ # access_token :string # hook_type :integer default("account") # settings :jsonb -# status :integer default("disabled") +# status :integer default("enabled") # created_at :datetime not null # updated_at :datetime not null # account_id :integer diff --git a/db/migrate/20230801180936_update_default_status_in_hooks.rb b/db/migrate/20230801180936_update_default_status_in_hooks.rb new file mode 100644 index 000000000..c6388a34c --- /dev/null +++ b/db/migrate/20230801180936_update_default_status_in_hooks.rb @@ -0,0 +1,17 @@ +class UpdateDefaultStatusInHooks < ActiveRecord::Migration[7.0] + def up + change_column_default :integrations_hooks, :status, 1 + + update_default_status + end + + def down + change_column_default :integrations_hooks, :status, 0 + end + + private + + def update_default_status + Integrations::Hook.all.update(status: 'enabled') + end +end diff --git a/db/schema.rb b/db/schema.rb index 13d5e6925..759c0d325 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_07_27_065605) do +ActiveRecord::Schema[7.0].define(version: 2023_08_01_180936) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "pg_trgm" @@ -604,7 +604,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_27_065605) do end create_table "integrations_hooks", force: :cascade do |t| - t.integer "status", default: 0 + t.integer "status", default: 1 t.integer "inbox_id" t.integer "account_id" t.string "app_id"