From a197f64d2cbf161d64823b3cd75eb5b8d92a06d6 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 25 Aug 2025 13:09:20 +0530 Subject: [PATCH] feat: run migration --- db/schema.rb | 29 +++++++++++++++++-- .../app/models/account_saml_settings.rb | 20 +++++++++++++ enterprise/app/models/saml_role_mapping.rb | 17 +++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 798111be7..39a2de610 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.1].define(version: 2025_08_22_061042) do +ActiveRecord::Schema[7.1].define(version: 2025_08_25_070824) do # These extensions should be enabled to support this database enable_extension "pg_stat_statements" enable_extension "pg_trgm" @@ -28,6 +28,20 @@ ActiveRecord::Schema[7.1].define(version: 2025_08_22_061042) do t.index ["token"], name: "index_access_tokens_on_token", unique: true end + create_table "account_saml_settings", force: :cascade do |t| + t.bigint "account_id", null: false + t.boolean "enabled", default: false, null: false + t.string "sso_url" + t.string "certificate_fingerprint" + t.text "certificate" + t.string "sp_entity_id" + t.boolean "enforced_sso", default: false, null: false + t.json "attribute_mappings", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id"], name: "index_account_saml_settings_on_account_id" + end + create_table "account_users", force: :cascade do |t| t.bigint "account_id" t.bigint "user_id" @@ -265,7 +279,7 @@ ActiveRecord::Schema[7.1].define(version: 2025_08_22_061042) do t.jsonb "audience", default: [] t.datetime "scheduled_at", precision: nil t.boolean "trigger_only_during_business_hours", default: false - t.jsonb "template_params" + t.jsonb "template_params", default: {}, null: false t.index ["account_id"], name: "index_campaigns_on_account_id" t.index ["campaign_status"], name: "index_campaigns_on_campaign_status" t.index ["campaign_type"], name: "index_campaigns_on_campaign_type" @@ -1056,6 +1070,17 @@ ActiveRecord::Schema[7.1].define(version: 2025_08_22_061042) do t.index ["user_id"], name: "index_reporting_events_on_user_id" end + create_table "saml_role_mappings", force: :cascade do |t| + t.bigint "account_saml_settings_id", null: false + t.string "saml_group_name", null: false + t.integer "role", default: 0, null: false + t.bigint "custom_role_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_saml_settings_id"], name: "index_saml_role_mappings_on_account_saml_settings_id" + t.index ["custom_role_id"], name: "index_saml_role_mappings_on_custom_role_id" + end + create_table "sla_events", force: :cascade do |t| t.bigint "applied_sla_id", null: false t.bigint "conversation_id", null: false diff --git a/enterprise/app/models/account_saml_settings.rb b/enterprise/app/models/account_saml_settings.rb index d352cc7f8..f674cd814 100644 --- a/enterprise/app/models/account_saml_settings.rb +++ b/enterprise/app/models/account_saml_settings.rb @@ -1,3 +1,23 @@ +# == Schema Information +# +# Table name: account_saml_settings +# +# id :bigint not null, primary key +# attribute_mappings :json +# certificate :text +# certificate_fingerprint :string +# enabled :boolean default(FALSE), not null +# enforced_sso :boolean default(FALSE), not null +# sso_url :string +# created_at :datetime not null +# updated_at :datetime not null +# account_id :bigint not null +# sp_entity_id :string +# +# Indexes +# +# index_account_saml_settings_on_account_id (account_id) +# class AccountSamlSettings < ApplicationRecord belongs_to :account has_many :saml_role_mappings, dependent: :destroy diff --git a/enterprise/app/models/saml_role_mapping.rb b/enterprise/app/models/saml_role_mapping.rb index e643ad435..4c3460dc2 100644 --- a/enterprise/app/models/saml_role_mapping.rb +++ b/enterprise/app/models/saml_role_mapping.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: saml_role_mappings +# +# id :bigint not null, primary key +# role :integer default("agent"), not null +# saml_group_name :string not null +# created_at :datetime not null +# updated_at :datetime not null +# account_saml_settings_id :bigint not null +# custom_role_id :bigint +# +# Indexes +# +# index_saml_role_mappings_on_account_saml_settings_id (account_saml_settings_id) +# index_saml_role_mappings_on_custom_role_id (custom_role_id) +# class SamlRoleMapping < ApplicationRecord belongs_to :account_saml_settings belongs_to :custom_role, optional: true