Untitled

mail@pastecode.io avatar
unknown
plain_text
12 days ago
352 kB
2
Indexable
Never
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("MYSQL_DATABASE_URL")
}

model account_verification_channels {
  id              BigInt        @id @default(autoincrement())
  feature         String        @db.VarChar(255)
  channel         String        @db.VarChar(255)
  is_primary      Boolean       @default(true)
  organization_id BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_a0561bc982")

  @@unique([organization_id, feature, channel], map: "index_on_organizations_feature_channel")
  @@index([organization_id], map: "index_account_verification_channels_on_organization_id")
}

model action_queues {
  id              BigInt        @id @default(autoincrement())
  item_type       String        @db.VarChar(255)
  item_id         Int
  action          String        @db.VarChar(255)
  status          String        @default("QUEUED") @db.VarChar(255)
  organization_id BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  user_id         BigInt?
  message         String?       @db.Text
  additional_info String?       @db.Text
  started_at      DateTime?     @db.DateTime(0)
  completed_at    DateTime?     @db.DateTime(0)
  is_system       Boolean       @default(false)
  response        String?       @db.Text
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_8f303c3c07")
  operations      operations[]

  @@index([action, status], map: "index_action_queues_on_action_and_status")
  @@index([item_id, item_type], map: "index_action_queues_on_item_id_and_item_type")
  @@index([organization_id], map: "index_action_queues_on_organization_id")
  @@index([user_id], map: "index_action_queues_on_user_id")
}

model addresses {
  id                       BigInt  @id @default(autoincrement())
  source_id                BigInt
  source_type              String  @db.VarChar(255)
  name                     String  @db.VarChar(255)
  address_type             String  @db.VarChar(255)
  first_name               String? @db.VarChar(255)
  last_name                String? @db.VarChar(255)
  contact_number           String? @db.VarChar(255)
  alternate_contact_number String? @db.VarChar(255)
  address_1                String? @db.Text
  address_2                String? @db.Text
  city                     String? @db.VarChar(255)
  state_name               String? @db.Text
  state_id                 String? @db.VarChar(255)
  country_name             String? @db.Text
  country_id               String? @db.VarChar(255)
  zipcode                  String? @db.VarChar(255)
  additional_info          String? @db.Text

  @@index([source_id, source_type], map: "index_addresses_on_source_id_and_source_type")
}

model ahoy_events {
  id              BigInt         @id @default(autoincrement())
  visit_id        BigInt?
  user_id         BigInt?
  name            String?        @db.VarChar(255)
  properties      String?        @db.MediumText
  time            DateTime?      @db.Timestamp(0)
  organization_id BigInt?
  source_type     String?        @db.VarChar(255)
  source_id       BigInt?
  organizations   organizations? @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_03688bf3f8")
  users           users?         @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_f1ed9fc4a0")

  @@index([name, time], map: "index_ahoy_events_on_name_and_time")
  @@index([organization_id], map: "index_ahoy_events_on_organization_id")
  @@index([source_type, source_id], map: "index_ahoy_events_on_source_type_and_source_id")
  @@index([user_id], map: "index_ahoy_events_on_user_id")
  @@index([visit_id], map: "index_ahoy_events_on_visit_id")
}

model ahoy_visits {
  id               BigInt             @id @default(autoincrement())
  visit_token      String?            @db.VarChar(255)
  visitor_token    String?            @db.VarChar(255)
  user_id          BigInt?
  ip               String?            @db.VarChar(255)
  user_agent       String?            @db.MediumText
  referrer         String?            @db.MediumText
  referring_domain String?            @db.VarChar(255)
  landing_page     String?            @db.MediumText
  browser          String?            @db.VarChar(255)
  os               String?            @db.VarChar(255)
  device_type      String?            @db.VarChar(255)
  country          String?            @db.VarChar(255)
  region           String?            @db.VarChar(255)
  city             String?            @db.VarChar(255)
  utm_source       String?            @db.VarChar(255)
  utm_medium       String?            @db.VarChar(255)
  utm_term         String?            @db.VarChar(255)
  utm_content      String?            @db.VarChar(255)
  utm_campaign     String?            @db.VarChar(255)
  started_at       DateTime?          @db.Timestamp(0)
  completed_at     DateTime?          @db.Timestamp(0)
  organization_id  BigInt?
  organizations    organizations?     @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_e29c4b1cd4")
  time_access_logs time_access_logs[]

  @@unique([visit_token, user_id], map: "index_ahoy_visits_on_user_id_visit_token")
  @@index([organization_id], map: "index_ahoy_visits_on_organization_id")
  @@index([user_id], map: "index_ahoy_visits_on_user_id")
}

model announcement_readers {
  id              BigInt        @id @default(autoincrement())
  announcement_id BigInt
  user_id         BigInt
  read_at         DateTime      @db.DateTime(0)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  announcements   announcements @relation(fields: [announcement_id], references: [id], onDelete: Cascade, map: "fk_rails_8c827b2598")
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_99ec803aef")

  @@index([announcement_id], map: "index_announcement_readers_on_announcement_id")
  @@index([user_id], map: "index_announcement_readers_on_user_id")
}

model announcements {
  id                                      BigInt                 @id @default(autoincrement())
  title                                   String                 @db.Text
  description                             String                 @db.MediumText
  long_description                        String                 @db.MediumText
  status                                  String                 @default("DRAFT") @db.VarChar(255)
  organization_id                         BigInt
  published_by                            BigInt?
  created_by                              BigInt?
  updated_by                              BigInt?
  is_edited                               Boolean                @default(false)
  published_at                            DateTime?              @db.DateTime(0)
  created_at                              DateTime               @db.DateTime(0)
  updated_at                              DateTime               @db.DateTime(0)
  announcement_readers                    announcement_readers[]
  organizations                           organizations          @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_092f822a9d")
  users_announcements_updated_byTousers   users?                 @relation("announcements_updated_byTousers", fields: [updated_by], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_471a8fb6e9")
  users_announcements_published_byTousers users?                 @relation("announcements_published_byTousers", fields: [published_by], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_8bdd0722f4")
  users_announcements_created_byTousers   users?                 @relation("announcements_created_byTousers", fields: [created_by], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_e7b335adf0")

  @@index([updated_by], map: "fk_rails_471a8fb6e9")
  @@index([published_by], map: "fk_rails_8bdd0722f4")
  @@index([created_by], map: "fk_rails_e7b335adf0")
  @@index([organization_id], map: "index_announcements_on_organization_id")
}

model answers {
  id                      BigInt                    @id @default(autoincrement())
  answer                  String                    @db.Text
  correct                 Boolean                   @default(false)
  sequence                Int?
  question_id             BigInt
  created_at              DateTime                  @db.DateTime(0)
  updated_at              DateTime                  @db.DateTime(0)
  case_sensitive          Boolean                   @default(false)
  sub_sequence            String?                   @db.VarChar(1)
  questions               questions                 @relation(fields: [question_id], references: [id], onDelete: Cascade, map: "fk_rails_3d5ed4418f")
  user_assessment_answers user_assessment_answers[]

  @@index([question_id], map: "index_answers_on_question_id")
}

model api_keys {
  id              BigInt        @id @default(autoincrement())
  api_key         String        @db.VarChar(255)
  scope           String?       @db.VarChar(255)
  active          Boolean       @default(true)
  source_id       BigInt
  organization_id BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  name            String        @db.VarChar(255)
  source_type     String        @default("User") @db.VarChar(255)
  api_secret      String?       @db.VarChar(255)
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_7aab96f30e")

  @@index([api_key], map: "index_api_keys_on_api_key")
  @@index([organization_id], map: "index_api_keys_on_organization_id")
  @@index([source_id], map: "index_api_keys_on_source_id")
}

model app_accessibility {
  id              BigInt        @id @default(autoincrement())
  app_id          BigInt
  organization_id BigInt
  source_id       BigInt
  source_type     String        @db.VarChar(255)
  is_active       Boolean       @default(false)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  apps            apps          @relation(fields: [app_id], references: [id], onDelete: Cascade, map: "fk_rails_5300734e0e")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_dd7c92edcb")

  @@unique([app_id, source_id, source_type], map: "index_on_app_accessibility_app_source_unique")
  @@index([app_id], map: "index_app_accessibility_on_app_id")
  @@index([organization_id], map: "index_app_accessibility_on_organization_id")
  @@index([source_id, source_type], map: "index_on_app_accessibility_source")
}

model app_user_activity {
  id              BigInt         @id @default(autoincrement())
  app_id          BigInt
  user_id         BigInt?
  user_account_id BigInt?
  organization_id BigInt
  launch_count    Int            @default(0)
  created_at      DateTime       @db.DateTime(0)
  updated_at      DateTime       @db.DateTime(0)
  apps            apps           @relation(fields: [app_id], references: [id], onDelete: Cascade, map: "fk_rails_0a24e8b704")
  organizations   organizations  @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_7eaa1d0e46")
  user_accounts   user_accounts? @relation(fields: [user_account_id], references: [id], onUpdate: SetNull, map: "fk_rails_ac34988c31")
  users           users?         @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_f4b6f8ed7f")

  @@unique([app_id, user_account_id], map: "index_on_app_user_activity_app_user_account")
  @@index([app_id], map: "index_app_user_activity_on_app_id")
  @@index([organization_id], map: "index_app_user_activity_on_organization_id")
  @@index([user_account_id], map: "index_app_user_activity_on_user_account_id")
  @@index([user_id], map: "index_app_user_activity_on_user_id")
  @@index([launch_count], map: "index_on_app_user_activity_launch_count")
}

model app_versions {
  id            BigInt    @id @default(autoincrement())
  version_id    String    @db.VarChar(255)
  released_at   DateTime  @db.DateTime(0)
  expires_at    DateTime? @db.DateTime(0)
  build_number  String?   @db.VarChar(255)
  platform      String    @db.VarChar(255)
  release_notes String    @db.Text
  created_at    DateTime  @db.DateTime(0)
  updated_at    DateTime  @db.DateTime(0)

  @@unique([version_id, build_number, platform], map: "index_on_app_version_build_and_platform")
}

model apps {
  id                           BigInt              @id @default(autoincrement())
  url                          String              @db.VarChar(255)
  name                         String              @db.VarChar(255)
  description                  String?             @db.MediumText
  image_url                    String?             @db.VarChar(255)
  is_featured                  Boolean             @default(false)
  is_deleted                   Boolean             @default(false)
  organization_id              BigInt
  created_by                   BigInt?
  updated_by                   BigInt?
  created_at                   DateTime            @db.DateTime(0)
  updated_at                   DateTime            @db.DateTime(0)
  app_accessibility            app_accessibility[]
  app_user_activity            app_user_activity[]
  organizations                organizations       @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_94c05940c2")
  users_apps_updated_byTousers users?              @relation("apps_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_9a3a5e8233")
  users_apps_created_byTousers users?              @relation("apps_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_f9e67b3254")

  @@index([updated_by], map: "fk_rails_9a3a5e8233")
  @@index([created_by], map: "fk_rails_f9e67b3254")
  @@index([organization_id], map: "index_apps_on_organization_id")
}

model ar_internal_metadata {
  key        String   @id @db.VarChar(255)
  value      String?  @db.VarChar(255)
  created_at DateTime @db.DateTime(0)
  updated_at DateTime @db.DateTime(0)
}

model assessment_trackers {
  id                 BigInt       @id @default(autoincrement())
  enrollment_id      BigInt?
  correct_answers    Int          @default(0)
  wrong_answers      Int          @default(0)
  attempts_consumed  Int          @default(0)
  attempts_left      Int?
  created_at         DateTime     @db.DateTime(0)
  updated_at         DateTime     @db.DateTime(0)
  attempts_succeeded Int          @default(0)
  attempts_failed    Int          @default(0)
  reviewed_by        BigInt?
  reviewed_at        DateTime?    @db.DateTime(0)
  users              users?       @relation(fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_7ccf80d0ad")
  enrollments        enrollments? @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_b666df3e8d")

  @@index([reviewed_by], map: "fk_rails_7ccf80d0ad")
  @@index([enrollment_id], map: "index_assessment_trackers_on_enrollment_id")
}

model assessments {
  id                                  BigInt                     @id @default(autoincrement())
  title                               String                     @db.MediumText
  description                         String?                    @db.VarChar(255)
  source_id                           BigInt
  created_at                          DateTime                   @db.DateTime(0)
  updated_at                          DateTime                   @db.DateTime(0)
  source_type                         String                     @default("Course") @db.VarChar(255)
  organization_id                     BigInt?
  questions_count                     Int                        @default(0)
  created_by                          BigInt?
  updated_by                          BigInt?
  skip_assessment                     Boolean                    @default(false)
  assessment_attempts                 Int?                       @default(3)
  pass_percentage                     Int?                       @default(70)
  active                              Boolean                    @default(false)
  complete_by_order                   Boolean                    @default(true)
  users_assessments_updated_byTousers users?                     @relation("assessments_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_434b1bcfd6")
  users_assessments_created_byTousers users?                     @relation("assessments_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_6ae6630474")
  organizations                       organizations?             @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_e5d0052085")
  questions                           questions[]
  user_assessment_versions            user_assessment_versions[]
  user_assessments                    user_assessments[]

  @@unique([source_id, source_type, title(length: 255)], map: "index_assessments_on_source_id_and_source_type_and_title")
  @@index([updated_by], map: "fk_rails_434b1bcfd6")
  @@index([created_by], map: "fk_rails_6ae6630474")
  @@index([organization_id], map: "index_assessments_on_organization_id")
  @@index([source_id, source_type], map: "index_assessments_on_source_id_and_source_type")
}

model attachments {
  id              BigInt   @id @default(autoincrement())
  url             String?  @db.VarChar(255)
  content_type    String?  @db.VarChar(128)
  filename        String   @db.VarChar(255)
  user_id         BigInt
  created_at      DateTime @db.DateTime(0)
  updated_at      DateTime @db.DateTime(0)
  preview_url     String?  @db.MediumText
  source_type     String?  @db.VarChar(255)
  source_id       Int?
  organization_id BigInt?
  size            BigInt?
  title           String?  @db.VarChar(255)
  users           users    @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_5650a5e7db")

  @@index([source_id], map: "index_attachments_on_source_id")
  @@index([source_type], map: "index_attachments_on_source_id_and_source_type")
  @@index([user_id], map: "index_attachments_on_user_id")
}

model audits {
  id              BigInt    @id @default(autoincrement())
  auditable_id    Int?
  auditable_type  String?   @db.VarChar(255)
  associated_id   Int?
  associated_type String?   @db.VarChar(255)
  user_id         Int?
  user_type       String?   @db.VarChar(255)
  username        String?   @db.VarChar(255)
  action          String?   @db.VarChar(255)
  audited_changes String?   @db.MediumText
  version         Int?      @default(0)
  comment         String?   @db.VarChar(255)
  remote_address  String?   @db.VarChar(255)
  request_uuid    String?   @db.VarChar(255)
  created_at      DateTime? @db.DateTime(0)

  @@index([associated_type, associated_id], map: "associated_index")
  @@index([auditable_type, auditable_id, version], map: "auditable_index")
  @@index([created_at], map: "index_audits_on_created_at")
  @@index([request_uuid], map: "index_audits_on_request_uuid")
  @@index([user_id, user_type], map: "user_index")
}

model authentication_attempts {
  id              BigInt         @id @default(autoincrement())
  action          String         @db.VarChar(255)
  success         Boolean        @default(false)
  user_id         BigInt
  user_account_id BigInt?
  organization_id BigInt?
  session_id      String         @db.VarChar(255)
  created_at      DateTime       @db.DateTime(0)
  users           users          @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_5bcd7e3f0a")
  user_accounts   user_accounts? @relation(fields: [user_account_id], references: [id], onUpdate: SetNull, map: "fk_rails_88217ff4ba")
  organizations   organizations? @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_ce496c6b59")

  @@index([user_account_id, session_id, action], map: "index_authentication_attempts_account_session_action")
  @@index([organization_id], map: "index_authentication_attempts_on_organization_id")
  @@index([session_id], map: "index_authentication_attempts_on_session_id")
  @@index([user_account_id], map: "index_authentication_attempts_on_user_account_id")
  @@index([user_id], map: "index_authentication_attempts_on_user_id")
  @@index([user_id, session_id, action], map: "index_authentication_attempts_user_session_action")
}

model banners {
  id                              BigInt        @id @default(autoincrement())
  title                           String        @db.VarChar(255)
  image_url                       String        @db.VarChar(255)
  source_type                     String?       @db.VarChar(255)
  source_id                       BigInt?
  organization_id                 BigInt
  active                          Boolean       @default(true)
  display_location                String?       @db.VarChar(255)
  sequence                        Int           @default(0)
  x_coordinate                    Int           @default(0)
  y_coordinate                    Int           @default(0)
  created_by                      BigInt?
  updated_by                      BigInt?
  views_count                     Int           @default(0)
  clicks_count                    Int           @default(0)
  created_at                      DateTime      @db.DateTime(0)
  updated_at                      DateTime      @db.DateTime(0)
  organizations                   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_1bcb69e848")
  users_banners_created_byTousers users?        @relation("banners_created_byTousers", fields: [created_by], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_54a7be846c")
  users_banners_updated_byTousers users?        @relation("banners_updated_byTousers", fields: [updated_by], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_b59f9b04a1")

  @@index([created_by], map: "fk_rails_54a7be846c")
  @@index([updated_by], map: "fk_rails_b59f9b04a1")
  @@index([organization_id], map: "index_banners_on_organization_id")
  @@index([source_type, source_id], map: "index_banners_on_source_type_and_source_id")
}

model basic_fields {
  id           BigInt @id @default(autoincrement())
  name         String @db.VarChar(255)
  display_name String @db.VarChar(255)
  field_type   String @db.VarChar(255)
  source       String @db.VarChar(255)

  @@unique([name, source], map: "index_basic_fields_on_name_and_source")
}

model booked_slots {
  id              BigInt        @id @default(autoincrement())
  user_id         BigInt
  organization_id BigInt
  slot_id         BigInt
  meeting_id      BigInt
  start_date      DateTime      @db.DateTime(0)
  end_date        DateTime      @db.DateTime(0)
  status          String?       @default("PENDING") @db.VarChar(255)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  slots           slots         @relation(fields: [slot_id], references: [id], onDelete: Cascade, map: "fk_rails_015c36d9a4")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_06f9450fa1")
  meetings        meetings      @relation(fields: [meeting_id], references: [id], onDelete: Cascade, map: "fk_rails_24f7dbc66d")
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_c3df1e7b05")

  @@index([meeting_id], map: "index_booked_slots_on_meeting_id")
  @@index([organization_id], map: "index_booked_slots_on_organization_id")
  @@index([slot_id], map: "index_booked_slots_on_slot_id")
  @@index([user_id], map: "index_booked_slots_on_user_id")
}

model bookmarked_sources {
  id              BigInt        @id @default(autoincrement())
  source_id       BigInt
  source_type     String        @db.VarChar(64)
  user_id         BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_bookmarked_sources_organization_id")
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_2fad9bf4f6")

  @@unique([source_id, source_type, user_id], map: "source_user_unique")
  @@index([source_id, source_type], map: "index_bookmarked_sources_on_source_id_and_source_type")
  @@index([user_id], map: "index_bookmarked_sources_on_user_id")
  @@index([organization_id], map: "index_bookmarked_sources_organization")
  @@index([user_id, source_id, source_type], map: "index_bookmarked_sources_source_user")
}

model cart_item_adjustments {
  id           BigInt      @id @default(autoincrement())
  coupon_id    BigInt?
  cart_item_id BigInt?
  created_at   DateTime    @db.DateTime(0)
  updated_at   DateTime    @db.DateTime(0)
  amount       Decimal     @default(0.00) @db.Decimal(10, 2)
  coupons      coupons?    @relation(fields: [coupon_id], references: [id], onDelete: Cascade, map: "fk_rails_cdd763857b")
  cart_items   cart_items? @relation(fields: [cart_item_id], references: [id], onDelete: Cascade, map: "fk_rails_f82ae122c3")

  @@index([cart_item_id], map: "index_cart_item_adjustments_on_cart_item_id")
  @@index([coupon_id], map: "index_cart_item_adjustments_on_coupon_id")
}

model cart_items {
  id                    BigInt                  @id @default(autoincrement())
  item_id               BigInt
  item_type             String                  @db.VarChar(255)
  quantity              Int                     @default(1)
  can_purchase          Boolean                 @default(true)
  original_price        Decimal                 @db.Decimal(10, 2)
  discount              Decimal?                @db.Decimal(10, 2)
  purchase_price        Decimal                 @db.Decimal(10, 2)
  user_id               BigInt
  organization_id       BigInt
  created_at            DateTime                @db.DateTime(0)
  updated_at            DateTime                @db.DateTime(0)
  currency              String                  @db.VarChar(3)
  cart_item_adjustments cart_item_adjustments[]
  organizations         organizations           @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_abae4744d1")
  users                 users                   @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_fcb2cbf0bc")

  @@unique([item_id, item_type, user_id, organization_id], map: "index_cart_items_on_item_user_organization")
  @@index([item_id, item_type], map: "index_cart_items_on_item_id_and_item_type")
  @@index([item_id, item_type, user_id], map: "index_cart_items_on_item_id_and_item_type_and_user_id")
  @@index([organization_id], map: "index_cart_items_on_organization_id")
  @@index([user_id], map: "index_cart_items_on_user_id")
}

model categories {
  id               BigInt             @id @default(autoincrement())
  title            String             @db.VarChar(255)
  parent_id        BigInt?
  created_at       DateTime           @db.DateTime(0)
  updated_at       DateTime           @db.DateTime(0)
  organization_id  BigInt
  external_id      String?            @db.VarChar(255)
  categories       categories?        @relation("categoriesTocategories", fields: [parent_id], references: [id], onUpdate: SetNull, map: "fk_rails_82f48f7407")
  other_categories categories[]       @relation("categoriesTocategories")
  organizations    organizations      @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_8fa20c9b22")
  category_sources category_sources[]

  @@unique([title, organization_id], map: "index_categories_on_title_and_organization_id")
  @@index([organization_id], map: "index_categories_on_organization_id")
  @@index([parent_id], map: "index_categories_on_parent_id")
}

model category_sources {
  id          BigInt     @id @default(autoincrement())
  source_id   BigInt
  category_id BigInt
  created_at  DateTime   @db.DateTime(0)
  updated_at  DateTime   @db.DateTime(0)
  source_type String     @db.VarChar(255)
  is_system   Boolean    @default(false)
  categories  categories @relation(fields: [category_id], references: [id], onDelete: Cascade, map: "fk_rails_249ee72d9a")

  @@unique([source_id, source_type, category_id], map: "index_on_category_libraries_source_categories")
  @@index([category_id], map: "index_category_sources_on_category_id")
  @@index([source_id, source_type], map: "index_on_category_libraries_source_id_source_type")
}

model certificate_templates {
  id                            BigInt         @id @default(autoincrement())
  name                          String?        @db.VarChar(255)
  theme_id                      Int
  has_source_description        Boolean        @default(false)
  has_completion_date           Boolean        @default(false)
  has_validity_period_in_months Boolean        @default(false)
  has_logo_url                  Boolean        @default(false)
  has_signature                 Boolean        @default(false)
  has_background_color          Boolean        @default(false)
  has_text_color                Boolean        @default(false)
  has_time_spent_on_training    Boolean        @default(false)
  has_organization_name         Boolean        @default(false)
  has_certificate_id            Boolean        @default(false)
  is_visible                    Boolean        @default(false)
  organization_id               BigInt
  created_at                    DateTime       @db.DateTime(0)
  updated_at                    DateTime       @db.DateTime(0)
  background_color              String         @default("#FFFFFF") @db.VarChar(255)
  text_color                    String         @default("#000000") @db.VarChar(255)
  description                   String?        @db.VarChar(255)
  validity_period_in_months     Int?
  logo_url                      String?        @db.Text
  signature                     String?        @db.VarChar(255)
  authority_name                String         @db.VarChar(255)
  authority_title               String?        @db.VarChar(255)
  heading                       String         @db.VarChar(255)
  line1                         String?        @db.VarChar(255)
  line2                         String?        @db.VarChar(255)
  organization_name             String?        @db.VarChar(255)
  category                      String         @default("COURSE") @db.VarChar(255)
  organizations                 organizations  @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_e07008466e")
  certificates                  certificates[]

  @@index([organization_id], map: "index_certificate_templates_on_organization_id")
}

model certificates {
  id                        BigInt                 @id @default(autoincrement())
  source_title              String                 @db.Text
  description               String?                @db.VarChar(255)
  validity_period_in_months Int?
  logo_url                  String?                @db.MediumText
  signature                 String?                @db.VarChar(255)
  background_color          String?                @db.VarChar(255)
  text_color                String?                @db.VarChar(255)
  authority_name            String                 @db.VarChar(255)
  authority_title           String?                @db.VarChar(255)
  heading                   String                 @db.VarChar(255)
  line1                     String?                @db.VarChar(255)
  line2                     String?                @db.VarChar(255)
  certificate_template_id   BigInt?
  created_at                DateTime               @db.DateTime(0)
  updated_at                DateTime               @db.DateTime(0)
  organization_name         String?                @db.VarChar(255)
  source_id                 BigInt?
  source_type               String                 @default("Course") @db.VarChar(255)
  certificate_templates     certificate_templates? @relation(fields: [certificate_template_id], references: [id], onUpdate: SetNull, map: "fk_rails_301a89d734")
  user_certificates         user_certificates[]

  @@index([certificate_template_id], map: "index_certificates_on_certificate_template_id")
  @@index([source_id, source_type], map: "index_certificates_on_source_id_and_source_type")
}

model channel_join_requests {
  id                                              BigInt    @id @default(autoincrement())
  user_id                                         BigInt
  channel_id                                      BigInt
  status                                          String    @default("PENDING") @db.VarChar(255)
  rejection_reason                                String?   @db.MediumText
  responded_by                                    BigInt?
  responded_at                                    DateTime? @db.DateTime(0)
  created_at                                      DateTime  @db.DateTime(0)
  updated_at                                      DateTime  @db.DateTime(0)
  channels                                        channels  @relation(fields: [channel_id], references: [id], onDelete: Cascade, map: "fk_rails_613ce4cfb6")
  users_channel_join_requests_user_idTousers      users     @relation("channel_join_requests_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_85a0d9f325")
  users_channel_join_requests_responded_byTousers users?    @relation("channel_join_requests_responded_byTousers", fields: [responded_by], references: [id], onUpdate: SetNull, map: "fk_rails_aa25e2e282")

  @@index([responded_by], map: "fk_rails_aa25e2e282")
  @@index([channel_id], map: "index_channel_join_requests_on_channel_id")
  @@index([user_id], map: "index_channel_join_requests_on_user_id")
}

model channel_notification_settings {
  id                                    BigInt        @id @default(autoincrement())
  channel_user_id                       BigInt        @unique(map: "index_channel_notification_settings_on_channel_user_id")
  notification_on_my_post_reshare       Boolean       @default(true)
  email_notification_on_my_post_reshare Boolean       @default(true)
  notification_on_new_post              Boolean       @default(true)
  email_notification_on_new_post        Boolean       @default(true)
  notification_on_new_comment           Boolean       @default(true)
  email_notification_on_joining_request Boolean       @default(true)
  email_notification_on_my_mention      Boolean       @default(true)
  channel_users                         channel_users @relation(fields: [channel_user_id], references: [id], onDelete: Cascade, map: "fk_rails_0ad7c13393")
}

model channel_settings {
  id                  BigInt   @id @default(autoincrement())
  channel_id          BigInt   @unique(map: "index_channel_settings_on_channel_id")
  allow_posts         Boolean  @default(true)
  allow_comments      Boolean  @default(true)
  allow_announcements Boolean  @default(true)
  channels            channels @relation(fields: [channel_id], references: [id], onDelete: Cascade, map: "fk_rails_ed502fcecd")
}

model channel_users {
  id                                    BigInt                         @id @default(autoincrement())
  channel_id                            BigInt
  user_id                               BigInt
  user_account_id                       BigInt
  role                                  String                         @default("MEMBER") @db.VarChar(255)
  is_bookmarked                         Boolean                        @default(false)
  is_deleted                            Boolean                        @default(false)
  invited_by                            BigInt?
  created_at                            DateTime                       @db.DateTime(0)
  updated_at                            DateTime                       @db.DateTime(0)
  channel_notification_settings         channel_notification_settings?
  channels                              channels                       @relation(fields: [channel_id], references: [id], onDelete: Cascade, map: "fk_rails_2669d126e9")
  users_channel_users_user_idTousers    users                          @relation("channel_users_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_89c7ea45bc")
  user_accounts                         user_accounts                  @relation(fields: [user_account_id], references: [id], onDelete: Cascade, map: "fk_rails_8a417d78c9")
  users_channel_users_invited_byTousers users?                         @relation("channel_users_invited_byTousers", fields: [invited_by], references: [id], onUpdate: SetNull, map: "fk_rails_985456f524")

  @@unique([channel_id, user_id], map: "index_channel_users_on_channel_id_and_user_id")
  @@index([invited_by], map: "fk_rails_985456f524")
  @@index([channel_id], map: "index_channel_users_on_channel_id")
  @@index([user_account_id], map: "index_channel_users_on_user_account_id")
  @@index([user_id], map: "index_channel_users_on_user_id")
}

model channels {
  id                               BigInt                  @id @default(autoincrement())
  name                             String                  @db.VarChar(255)
  description                      String?                 @db.MediumText
  long_description                 String?                 @db.MediumText
  image_url                        String?                 @db.VarChar(255)
  logo                             String?                 @db.VarChar(255)
  status                           String                  @default("ACTIVE") @db.VarChar(255)
  accessibility                    String                  @default("PRIVATE") @db.VarChar(255)
  users_count                      Int                     @default(0)
  is_deleted                       Boolean                 @default(false)
  organization_id                  BigInt
  created_by                       BigInt?
  updated_by                       BigInt?
  created_at                       DateTime                @db.DateTime(0)
  updated_at                       DateTime                @db.DateTime(0)
  channel_join_requests            channel_join_requests[]
  channel_settings                 channel_settings?
  channel_users                    channel_users[]
  users_channels_created_byTousers users?                  @relation("channels_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_041489e79b")
  organizations                    organizations           @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_bfcfceb5ef")
  users_channels_updated_byTousers users?                  @relation("channels_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_fd163089f0")

  @@index([created_by], map: "fk_rails_041489e79b")
  @@index([updated_by], map: "fk_rails_fd163089f0")
  @@index([organization_id], map: "index_channels_on_organization_id")
}

model chapters {
  id           BigInt    @id @default(autoincrement())
  sequence     Int?
  chapter_type String?   @db.VarChar(32)
  url          String?   @db.Text
  title        String    @db.VarChar(255)
  description  String?   @db.MediumText
  course_id    BigInt
  created_at   DateTime  @db.DateTime(0)
  updated_at   DateTime  @db.DateTime(0)
  duration     BigInt?   @default(0)
  skip_time    BigInt?
  auto_play    Boolean?
  libraries    libraries @relation(fields: [course_id], references: [id], onDelete: Cascade, map: "fk_rails_11d0c270dd")

  @@unique([course_id, title], map: "index_chapters_on_course_id_and_title")
  @@index([course_id], map: "index_chapters_on_course_id")
}

model checklist_assignee_accessibility {
  id                                                       BigInt                   @id @default(autoincrement())
  checklist_assignee_rule_id                               BigInt
  source_id                                                BigInt
  source_type                                              String                   @db.VarChar(255)
  created_by                                               BigInt?
  updated_by                                               BigInt?
  created_at                                               DateTime                 @db.DateTime(0)
  updated_at                                               DateTime                 @db.DateTime(0)
  users_checklist_assignee_accessibility_created_byTousers users?                   @relation("checklist_assignee_accessibility_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_07f69ffd50")
  checklist_assignee_rules                                 checklist_assignee_rules @relation(fields: [checklist_assignee_rule_id], references: [id], onDelete: Cascade, map: "fk_rails_30ff4dadd1")
  users_checklist_assignee_accessibility_updated_byTousers users?                   @relation("checklist_assignee_accessibility_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_db46b4d2d3")

  @@index([created_by], map: "fk_rails_07f69ffd50")
  @@index([updated_by], map: "fk_rails_db46b4d2d3")
  @@index([checklist_assignee_rule_id, source_id, source_type], map: "index_checklist_assignee_accessibility_checklists_source")
  @@index([checklist_assignee_rule_id], map: "index_checklist_assignee_accessibility_rule")
  @@index([source_id, source_type], map: "index_checklist_assignee_accessibility_source")
}

model checklist_assignee_rules {
  id                                               BigInt                             @id @default(autoincrement())
  checklist_id                                     BigInt
  type                                             String                             @db.VarChar(255)
  preferences                                      String?                            @db.Text
  created_by                                       BigInt?
  updated_by                                       BigInt?
  created_at                                       DateTime                           @db.DateTime(0)
  updated_at                                       DateTime                           @db.DateTime(0)
  checklist_assignee_accessibility                 checklist_assignee_accessibility[]
  users_checklist_assignee_rules_created_byTousers users?                             @relation("checklist_assignee_rules_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_2baec4f0e8")
  users_checklist_assignee_rules_updated_byTousers users?                             @relation("checklist_assignee_rules_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_369ea6600f")
  checklists                                       checklists                         @relation(fields: [checklist_id], references: [id], onDelete: Cascade, map: "fk_rails_e205d28d20")

  @@index([created_by], map: "fk_rails_2baec4f0e8")
  @@index([updated_by], map: "fk_rails_369ea6600f")
  @@index([checklist_id], map: "index_checklist_assignee_rules_on_checklist_id")
}

model checklist_comments {
  id                                         BigInt          @id @default(autoincrement())
  source_id                                  BigInt
  source_type                                String          @db.VarChar(255)
  checklist_user_id                          BigInt
  message                                    String          @db.MediumText
  full_message                               String          @db.MediumText
  is_edited                                  Boolean         @default(false)
  created_by                                 BigInt?
  updated_by                                 BigInt?
  created_at                                 DateTime        @db.DateTime(0)
  updated_at                                 DateTime        @db.DateTime(0)
  users_checklist_comments_updated_byTousers users?          @relation("checklist_comments_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_023a0d36fa")
  checklist_users                            checklist_users @relation(fields: [checklist_user_id], references: [id], onDelete: Cascade, map: "fk_rails_9396ac46b1")
  users_checklist_comments_created_byTousers users?          @relation("checklist_comments_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_a327d412fe")

  @@index([updated_by], map: "fk_rails_023a0d36fa")
  @@index([created_by, source_id, source_type], map: "index_checklist_comments_creator_source")
  @@index([checklist_user_id], map: "index_checklist_comments_on_checklist_user_id")
  @@index([source_id, source_type], map: "index_checklist_comments_on_source_id_and_source_type")
}

model checklist_item_responses {
  id                                               BigInt                          @id @default(autoincrement())
  checklist_item_id                                BigInt
  checklist_id                                     BigInt
  title                                            String                          @db.VarChar(255)
  sequence                                         Int                             @default(0)
  created_by                                       BigInt?
  updated_by                                       BigInt?
  created_at                                       DateTime                        @db.DateTime(0)
  updated_at                                       DateTime                        @db.DateTime(0)
  users_checklist_item_responses_created_byTousers users?                          @relation("checklist_item_responses_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_6234093679")
  checklist_items                                  checklist_items                 @relation(fields: [checklist_item_id], references: [id], onDelete: Cascade, map: "fk_rails_8a5221f2e7")
  checklists                                       checklists                      @relation(fields: [checklist_id], references: [id], onDelete: Cascade, map: "fk_rails_d5a530a201")
  users_checklist_item_responses_updated_byTousers users?                          @relation("checklist_item_responses_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_f6dea9d718")
  checklist_item_user_responses                    checklist_item_user_responses[]
  checklist_user_responses                         checklist_user_responses[]

  @@index([created_by], map: "fk_rails_6234093679")
  @@index([updated_by], map: "fk_rails_f6dea9d718")
  @@index([checklist_id], map: "index_checklist_item_responses_on_checklist_id")
  @@index([checklist_item_id], map: "index_checklist_item_responses_on_checklist_item_id")
}

model checklist_item_user_responses {
  id                         BigInt                    @id @default(autoincrement())
  response_text              String                    @db.Text
  user_response_text         String?                   @db.Text
  checklist_item_id          BigInt?
  checklist_user_attempt_id  BigInt
  checklist_item_response_id BigInt?
  checklist_user_response_id BigInt?
  created_at                 DateTime                  @db.DateTime(0)
  updated_at                 DateTime                  @db.DateTime(0)
  checklist_user_attempts    checklist_user_attempts   @relation(fields: [checklist_user_attempt_id], references: [id], onDelete: Cascade, map: "fk_rails_73b7f5a4c2")
  checklist_item_responses   checklist_item_responses? @relation(fields: [checklist_item_response_id], references: [id], onUpdate: SetNull, map: "fk_rails_790e30ef7d")
  checklist_user_responses   checklist_user_responses? @relation(fields: [checklist_user_response_id], references: [id], onDelete: Cascade, map: "fk_rails_cbb73b5521")
  checklist_items            checklist_items?          @relation(fields: [checklist_item_id], references: [id], onUpdate: SetNull, map: "fk_rails_cdba6b1936")

  @@index([checklist_user_attempt_id], map: "index_checklist_item_user_responses_attempt")
  @@index([checklist_item_response_id], map: "index_checklist_item_user_responses_checklist_item_responses")
  @@index([checklist_user_response_id], map: "index_checklist_item_user_responses_metadata")
  @@index([checklist_item_id], map: "index_checklist_item_user_responses_on_checklist_item_id")
}

model checklist_items {
  id                                      BigInt                          @id @default(autoincrement())
  title                                   String                          @db.VarChar(255)
  description                             String?                         @db.Text
  long_description                        String?                         @db.Text
  checklist_id                            BigInt
  validity                                Int?
  due_date                                DateTime?                       @db.Date
  scope                                   String                          @default("GLOBAL") @db.VarChar(255)
  sequence                                Int                             @default(0)
  response_type                           String                          @default("FREE_TEXT") @db.VarChar(255)
  completion_rate                         Int                             @default(0)
  pending_submissions_count               Int                             @default(0)
  created_by                              BigInt?
  updated_by                              BigInt?
  created_at                              DateTime                        @db.DateTime(0)
  updated_at                              DateTime                        @db.DateTime(0)
  is_score_configured                     Boolean                         @default(false)
  score_type                              String?                         @db.VarChar(255)
  min_score_value                         Int?
  max_score_value                         Int?
  checklist_item_responses                checklist_item_responses[]
  checklist_item_user_responses           checklist_item_user_responses[]
  checklists                              checklists                      @relation(fields: [checklist_id], references: [id], onDelete: Cascade, map: "fk_rails_3605ca8e4d")
  users_checklist_items_created_byTousers users?                          @relation("checklist_items_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_71ecbae7e2")
  users_checklist_items_updated_byTousers users?                          @relation("checklist_items_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_f99affceec")
  checklist_user_responses                checklist_user_responses[]

  @@index([created_by], map: "fk_rails_71ecbae7e2")
  @@index([updated_by], map: "fk_rails_f99affceec")
  @@index([checklist_id], map: "index_checklist_items_on_checklist_id")
}

model checklist_reviewer_accessibility {
  id                                                       BigInt                   @id @default(autoincrement())
  checklist_reviewer_rule_id                               BigInt
  source_id                                                BigInt
  source_type                                              String                   @db.VarChar(255)
  created_by                                               BigInt?
  updated_by                                               BigInt?
  created_at                                               DateTime                 @db.DateTime(0)
  updated_at                                               DateTime                 @db.DateTime(0)
  users_checklist_reviewer_accessibility_created_byTousers users?                   @relation("checklist_reviewer_accessibility_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_3b591218c4")
  users_checklist_reviewer_accessibility_updated_byTousers users?                   @relation("checklist_reviewer_accessibility_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_595ce4291b")
  checklist_reviewer_rules                                 checklist_reviewer_rules @relation(fields: [checklist_reviewer_rule_id], references: [id], onDelete: Cascade, map: "fk_rails_e0d2f0e36e")

  @@index([created_by], map: "fk_rails_3b591218c4")
  @@index([updated_by], map: "fk_rails_595ce4291b")
  @@index([checklist_reviewer_rule_id, source_id, source_type], map: "index_checklist_reviewer_accessibility_checklists_source")
  @@index([checklist_reviewer_rule_id], map: "index_checklist_reviewer_accessibility_rule")
  @@index([source_id, source_type], map: "index_checklist_reviewer_accessibility_source")
}

model checklist_reviewer_rules {
  id                                               BigInt                             @id @default(autoincrement())
  checklist_id                                     BigInt
  type                                             String                             @db.VarChar(255)
  preferences                                      String?                            @db.Text
  level                                            Int                                @default(1)
  created_by                                       BigInt?
  updated_by                                       BigInt?
  created_at                                       DateTime                           @db.DateTime(0)
  updated_at                                       DateTime                           @db.DateTime(0)
  checklist_reviewer_accessibility                 checklist_reviewer_accessibility[]
  checklists                                       checklists                         @relation(fields: [checklist_id], references: [id], onDelete: Cascade, map: "fk_rails_4aed82a6be")
  users_checklist_reviewer_rules_updated_byTousers users?                             @relation("checklist_reviewer_rules_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_726ab09f09")
  users_checklist_reviewer_rules_created_byTousers users?                             @relation("checklist_reviewer_rules_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_e33b950d95")

  @@index([updated_by], map: "fk_rails_726ab09f09")
  @@index([created_by], map: "fk_rails_e33b950d95")
  @@index([checklist_id], map: "index_checklist_reviewer_rules_on_checklist_id")
}

model checklist_settings {
  id                                        BigInt        @id @default(autoincrement())
  allow_managers_to_create_checklists       Boolean       @default(true)
  allow_learners_to_create_checklists       Boolean       @default(true)
  allow_assignees_to_create_checklist_items Boolean       @default(true)
  organization_id                           BigInt
  organizations                             organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_78eaeda3d7")

  @@index([organization_id], map: "index_checklist_settings_on_organization_id")
}

model checklist_user_activities {
  id                BigInt          @id @default(autoincrement())
  checklist_user_id BigInt
  organization_id   BigInt
  user_id           BigInt?
  user_role         String          @db.VarChar(255)
  message           String          @db.MediumText
  full_message      String?         @db.MediumText
  is_edited         Boolean         @default(false)
  is_system         Boolean         @default(false)
  created_at        DateTime        @db.DateTime(0)
  updated_at        DateTime        @db.DateTime(0)
  organizations     organizations   @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_b9fce1c25f")
  users             users?          @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_e1a3238e27")
  checklist_users   checklist_users @relation(fields: [checklist_user_id], references: [id], onDelete: Cascade, map: "fk_rails_e4eb098b10")

  @@index([checklist_user_id], map: "index_checklist_user_activities_on_checklist_user_id")
  @@index([organization_id], map: "index_checklist_user_activities_on_organization_id")
  @@index([user_id], map: "index_checklist_user_activities_on_user_id")
}

model checklist_user_attempts {
  id                                                       BigInt                          @id @default(autoincrement())
  attempt                                                  Int                             @default(1)
  status                                                   String                          @default("IN_PROGRESS") @db.VarChar(255)
  started                                                  Boolean                         @default(false)
  started_at                                               DateTime                        @db.DateTime(0)
  review_completed_at                                      DateTime?                       @db.DateTime(0)
  completed                                                Boolean                         @default(false)
  completed_at                                             DateTime?                       @db.DateTime(0)
  reworked                                                 Boolean                         @default(false)
  rework_requested_by                                      BigInt?
  rework_requested_at                                      DateTime?                       @db.DateTime(0)
  score                                                    Int?
  user_response_text                                       String?                         @db.Text
  feedback                                                 String?                         @db.Text
  user_id                                                  BigInt
  checklist_user_id                                        BigInt
  created_at                                               DateTime                        @db.DateTime(0)
  updated_at                                               DateTime                        @db.DateTime(0)
  checklist_item_user_responses                            checklist_item_user_responses[]
  checklist_users                                          checklist_users                 @relation(fields: [checklist_user_id], references: [id], onDelete: Cascade, map: "fk_rails_643288fa7f")
  users_checklist_user_attempts_user_idTousers             users                           @relation("checklist_user_attempts_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_f18d4d9499")
  users_checklist_user_attempts_rework_requested_byTousers users?                          @relation("checklist_user_attempts_rework_requested_byTousers", fields: [rework_requested_by], references: [id], onUpdate: SetNull, map: "fk_rails_f43e23b206")

  @@index([rework_requested_by], map: "fk_rails_f43e23b206")
  @@index([checklist_user_id], map: "index_checklist_user_attempts_on_checklist_user_id")
  @@index([user_id], map: "index_checklist_user_attempts_on_user_id")
}

model checklist_user_responses {
  id                            BigInt                          @id @default(autoincrement())
  checklist_item_id             BigInt?
  checklist_user_id             BigInt
  checklist_item_response_id    BigInt?
  title                         String                          @db.VarChar(255)
  sequence                      Int                             @default(0)
  created_at                    DateTime                        @db.DateTime(0)
  updated_at                    DateTime                        @db.DateTime(0)
  checklist_item_user_responses checklist_item_user_responses[]
  checklist_items               checklist_items?                @relation(fields: [checklist_item_id], references: [id], onUpdate: SetNull, map: "fk_rails_1b609ebc0c")
  checklist_item_responses      checklist_item_responses?       @relation(fields: [checklist_item_response_id], references: [id], onUpdate: SetNull, map: "fk_rails_b2e568f018")
  checklist_users               checklist_users                 @relation(fields: [checklist_user_id], references: [id], onDelete: Cascade, map: "fk_rails_cb8b5ee747")

  @@index([checklist_item_id], map: "index_checklist_user_responses_on_checklist_item_id")
  @@index([checklist_user_id], map: "index_checklist_user_responses_on_checklist_user_id")
  @@index([checklist_item_response_id], map: "index_on_checklist_user_respones_response_metadata")
  @@index([checklist_user_id, checklist_item_response_id], map: "index_on_checklist_user_responses_checklist_user_item_response")
}

model checklist_user_rework_history {
  id                                                     BigInt          @id @default(autoincrement())
  reviewed_by                                            BigInt?
  user_id                                                BigInt
  checklist_user_id                                      BigInt
  reviewer_feedback                                      String?         @db.Text
  created_at                                             DateTime        @db.DateTime(0)
  updated_at                                             DateTime        @db.DateTime(0)
  users_checklist_user_rework_history_reviewed_byTousers users?          @relation("checklist_user_rework_history_reviewed_byTousers", fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_0d9aefb3a7")
  users_checklist_user_rework_history_user_idTousers     users           @relation("checklist_user_rework_history_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_2fa5624b23")
  checklist_users                                        checklist_users @relation(fields: [checklist_user_id], references: [id], onDelete: Cascade, map: "fk_rails_b250b8bd44")

  @@index([reviewed_by], map: "fk_rails_0d9aefb3a7")
  @@index([checklist_user_id], map: "index_checklist_user_rework_history_checklist_user")
  @@index([user_id], map: "index_checklist_user_rework_history_on_user_id")
}

model checklist_user_submissions {
  id                BigInt          @id @default(autoincrement())
  checklist_user_id BigInt
  level             Int             @default(1) @db.TinyInt
  submission_id     BigInt?
  status            String          @default("PENDING") @db.VarChar(255)
  created_at        DateTime        @db.DateTime(0)
  updated_at        DateTime        @db.DateTime(0)
  submissions       submissions?    @relation(fields: [submission_id], references: [id], onUpdate: SetNull, map: "fk_rails_539b6d3ea1")
  checklist_users   checklist_users @relation(fields: [checklist_user_id], references: [id], onDelete: Cascade, map: "fk_rails_c1943aaea9")

  @@index([checklist_user_id], map: "index_checklist_user_submissions_on_checklist_user_id")
  @@index([submission_id], map: "index_checklist_user_submissions_on_submission_id")
}

model checklist_users {
  id                                               BigInt                          @id @default(autoincrement())
  title                                            String                          @db.VarChar(255)
  description                                      String?                         @db.Text
  long_description                                 String?                         @db.Text
  source_id                                        BigInt?
  source_type                                      String?                         @db.VarChar(255)
  user_id                                          BigInt
  organization_id                                  BigInt
  category                                         String                          @db.VarChar(255)
  start_date                                       DateTime?                       @db.Date
  due_date                                         DateTime?                       @db.Date
  is_review_sequential                             Boolean                         @default(false)
  scope                                            String                          @default("GLOBAL") @db.VarChar(255)
  sequence                                         Int?                            @default(0)
  response_type                                    String?                         @db.VarChar(255)
  checklist_items_count                            Int?
  reviewers_count                                  Int?
  viewers_count                                    Int?
  status                                           String                          @default("TO_DO") @db.VarChar(255)
  assigned_at                                      DateTime                        @db.DateTime(0)
  self_assigned                                    Boolean                         @default(false)
  started                                          Boolean                         @default(false)
  started_at                                       DateTime?                       @db.DateTime(0)
  in_review                                        Boolean                         @default(false)
  review_submission_date                           DateTime?                       @db.DateTime(0)
  completed                                        Boolean                         @default(false)
  completed_at                                     DateTime?                       @db.DateTime(0)
  completion_percentage                            Int                             @default(0)
  reworked                                         Boolean                         @default(false)
  rework_requested_by                              BigInt?
  rework_requested_at                              DateTime?                       @db.DateTime(0)
  score                                            Int?
  assigned_by                                      BigInt?
  parent_id                                        BigInt?
  last_content_updated_at                          DateTime                        @db.DateTime(0)
  created_at                                       DateTime                        @db.DateTime(0)
  updated_at                                       DateTime                        @db.DateTime(0)
  checklist_comments                               checklist_comments[]
  checklist_user_activities                        checklist_user_activities[]
  checklist_user_attempts                          checklist_user_attempts[]
  checklist_user_responses                         checklist_user_responses[]
  checklist_user_rework_history                    checklist_user_rework_history[]
  checklist_user_submissions                       checklist_user_submissions[]
  checklist_users                                  checklist_users?                @relation("checklist_usersTochecklist_users", fields: [parent_id], references: [id], onDelete: Cascade, map: "fk_rails_052d9f6ca6")
  other_checklist_users                            checklist_users[]               @relation("checklist_usersTochecklist_users")
  users_checklist_users_user_idTousers             users                           @relation("checklist_users_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_54ce8c50da")
  organizations                                    organizations                   @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_5ee87ee2d4")
  users_checklist_users_assigned_byTousers         users?                          @relation("checklist_users_assigned_byTousers", fields: [assigned_by], references: [id], onUpdate: SetNull, map: "fk_rails_761c736d78")
  users_checklist_users_rework_requested_byTousers users?                          @relation("checklist_users_rework_requested_byTousers", fields: [rework_requested_by], references: [id], onUpdate: SetNull, map: "fk_rails_e9117b82a9")

  @@unique([user_id, source_id, source_type], map: "index_on_checklist_users_user_source")
  @@index([parent_id], map: "fk_rails_052d9f6ca6")
  @@index([assigned_by], map: "fk_rails_761c736d78")
  @@index([rework_requested_by], map: "fk_rails_e9117b82a9")
  @@index([organization_id], map: "index_checklist_users_on_organization_id")
  @@index([source_id, source_type], map: "index_checklist_users_on_source_id_and_source_type")
  @@index([user_id], map: "index_checklist_users_on_user_id")
}

model checklist_viewer_accessibility {
  id                                                     BigInt                 @id @default(autoincrement())
  checklist_viewer_rule_id                               BigInt
  source_id                                              BigInt
  source_type                                            String                 @db.VarChar(255)
  created_by                                             BigInt?
  updated_by                                             BigInt?
  created_at                                             DateTime               @db.DateTime(0)
  updated_at                                             DateTime               @db.DateTime(0)
  checklist_viewer_rules                                 checklist_viewer_rules @relation(fields: [checklist_viewer_rule_id], references: [id], onDelete: Cascade, map: "fk_rails_69f70a3fcf")
  users_checklist_viewer_accessibility_updated_byTousers users?                 @relation("checklist_viewer_accessibility_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_776ce4b114")
  users_checklist_viewer_accessibility_created_byTousers users?                 @relation("checklist_viewer_accessibility_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_c035614095")

  @@index([updated_by], map: "fk_rails_776ce4b114")
  @@index([created_by], map: "fk_rails_c035614095")
  @@index([checklist_viewer_rule_id, source_id, source_type], map: "index_checklist_viewer_accessibility_checklists_source")
  @@index([checklist_viewer_rule_id], map: "index_checklist_viewer_accessibility_rule")
  @@index([source_id, source_type], map: "index_checklist_viewer_accessibility_source")
}

model checklist_viewer_rules {
  id                                             BigInt                           @id @default(autoincrement())
  checklist_id                                   BigInt
  type                                           String                           @db.VarChar(255)
  preferences                                    String?                          @db.Text
  created_by                                     BigInt?
  updated_by                                     BigInt?
  created_at                                     DateTime                         @db.DateTime(0)
  updated_at                                     DateTime                         @db.DateTime(0)
  checklist_viewer_accessibility                 checklist_viewer_accessibility[]
  checklists                                     checklists                       @relation(fields: [checklist_id], references: [id], onDelete: Cascade, map: "fk_rails_0ac805e5aa")
  users_checklist_viewer_rules_created_byTousers users?                           @relation("checklist_viewer_rules_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_f3351d3106")
  users_checklist_viewer_rules_updated_byTousers users?                           @relation("checklist_viewer_rules_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_f74cb52d32")

  @@index([created_by], map: "fk_rails_f3351d3106")
  @@index([updated_by], map: "fk_rails_f74cb52d32")
  @@index([checklist_id], map: "index_checklist_viewer_rules_on_checklist_id")
}

model checklists {
  id                                 BigInt                     @id @default(autoincrement())
  title                              String                     @db.VarChar(255)
  description                        String?                    @db.Text
  long_description                   String?                    @db.Text
  organization_id                    BigInt
  start_date                         DateTime?                  @db.Date
  validity                           Int?
  due_date                           DateTime?                  @db.Date
  is_review_sequential               Boolean                    @default(false)
  scope                              String                     @default("GLOBAL") @db.VarChar(255)
  checklist_items_count              Int?
  reviewers_count                    Int?
  viewers_count                      Int?
  assignees_count                    Int                        @default(0)
  pending_submissions_count          Int                        @default(0)
  completion_rate                    Int                        @default(0)
  created_by                         BigInt?
  updated_by                         BigInt?
  last_content_updated_at            DateTime                   @db.DateTime(0)
  last_assigned_at                   DateTime                   @db.DateTime(0)
  created_at                         DateTime                   @db.DateTime(0)
  updated_at                         DateTime                   @db.DateTime(0)
  is_score_configured                Boolean                    @default(false)
  score_type                         String?                    @db.VarChar(255)
  min_score_value                    Int?
  max_score_value                    Int?
  checklist_assignee_rules           checklist_assignee_rules[]
  checklist_item_responses           checklist_item_responses[]
  checklist_items                    checklist_items[]
  checklist_reviewer_rules           checklist_reviewer_rules[]
  checklist_viewer_rules             checklist_viewer_rules[]
  users_checklists_updated_byTousers users?                     @relation("checklists_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_01c4852879")
  organizations                      organizations              @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4c5d7e0912")
  users_checklists_created_byTousers users?                     @relation("checklists_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_4d00a36b2b")

  @@index([updated_by], map: "fk_rails_01c4852879")
  @@index([created_by], map: "fk_rails_4d00a36b2b")
  @@index([organization_id], map: "index_checklists_on_organization_id")
}

model conferences {
  id                       BigInt                 @id @default(autoincrement())
  name                     String                 @db.Text
  start_url                String?                @db.Text
  join_url                 String?                @db.VarChar(255)
  start_time               DateTime?              @db.DateTime(0)
  end_time                 DateTime?              @db.DateTime(0)
  password                 String?                @db.VarChar(255)
  source_type              String?                @db.VarChar(255)
  source_id                BigInt?
  organization_provider_id BigInt
  created_at               DateTime               @db.DateTime(0)
  updated_at               DateTime               @db.DateTime(0)
  conference_type          String?                @default("Webinar") @db.VarChar(32)
  schedule_type            String?                @db.VarChar(255)
  description              String?                @db.Text
  time_zone                String?                @db.VarChar(255)
  external_id              String?                @db.VarChar(255)
  external_end_date        DateTime?              @db.DateTime(0)
  organization_providers   organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_2323673528")
  meeting_properties       meeting_properties[]

  @@index([organization_provider_id], map: "index_conferences_on_organization_provider_id")
}

model configured_channels {
  id              BigInt        @id @default(autoincrement())
  user_account_id BigInt
  channel         String        @db.VarChar(255)
  user_accounts   user_accounts @relation(fields: [user_account_id], references: [id], onDelete: Cascade, map: "fk_rails_8c68e43baf")

  @@unique([user_account_id, channel], map: "index_configured_channels_on_user_account_id_and_channel")
  @@index([user_account_id], map: "index_configured_channels_on_user_account_id")
}

model content_categories {
  id                           BigInt                         @id @default(autoincrement())
  title                        String                         @unique(map: "index_content_categories_on_title") @db.VarChar(255)
  created_at                   DateTime                       @db.DateTime(0)
  updated_at                   DateTime                       @db.DateTime(0)
  learning_resource_categories learning_resource_categories[]
}

model content_partners {
  id                            BigInt                          @id @default(autoincrement())
  name                          String                          @unique(map: "index_content_partners_on_name") @db.VarChar(255)
  partner_id                    String?                         @db.VarChar(255)
  partner_key                   String?                         @db.MediumText
  partner_secret                String?                         @db.MediumText
  created_at                    DateTime                        @db.DateTime(0)
  updated_at                    DateTime                        @db.DateTime(0)
  organization_content_partners organization_content_partners[]
  organization_partner_features organization_partner_features[]
  sync_requests                 sync_requests[]
}

model content_publishers {
  id                 BigInt               @id @default(autoincrement())
  name               String               @unique(map: "index_content_publishers_on_name") @db.VarChar(255)
  learning_resources learning_resources[]
}

model contents {
  id              BigInt        @id @default(autoincrement())
  duration        BigInt?       @default(0)
  item_id         Int?
  item_type       String?       @db.VarChar(64)
  url             String        @db.Text
  content_type    String?       @db.VarChar(32)
  provider        String?       @db.VarChar(32)
  embed_url       String?       @db.VarChar(255)
  thumb_url       String?       @db.VarChar(255)
  filename        String?       @db.VarChar(255)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  preview_url     String?       @db.MediumText
  description     String?       @db.MediumText
  user_id         BigInt?
  passcode        String?       @db.VarChar(255)
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_6c17583b01")
  users           users?        @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_854287fee7")

  @@index([item_id, item_type], map: "index_contents_on_item_id_and_item_type")
  @@index([organization_id], map: "index_contents_on_organization_id")
  @@index([user_id], map: "index_contents_on_user_id")
}

model coupon_audits {
  id              BigInt        @id @default(autoincrement())
  coupon_id       BigInt
  organization_id BigInt
  actor_id        BigInt?
  actor_info      String?       @db.Text
  audited_changes String        @db.MediumText
  created_at      DateTime      @db.DateTime(0)
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4117daa113")
  users           users?        @relation(fields: [actor_id], references: [id], onUpdate: SetNull, map: "fk_rails_a95a2a0cab")
  coupons         coupons       @relation(fields: [coupon_id], references: [id], onDelete: Cascade, map: "fk_rails_fc1eff33f5")

  @@index([actor_id], map: "index_coupon_audits_on_actor_id")
  @@index([coupon_id, actor_id, organization_id], map: "index_coupon_audits_on_coupon_actor_organization")
  @@index([coupon_id], map: "index_coupon_audits_on_coupon_id")
  @@index([organization_id], map: "index_coupon_audits_on_organization_id")
}

model coupon_offers {
  id          BigInt   @id @default(autoincrement())
  coupon_id   BigInt
  type        String?  @db.VarChar(64)
  preferences String?  @db.Text
  created_at  DateTime @db.DateTime(0)
  updated_at  DateTime @db.DateTime(0)
  coupons     coupons  @relation(fields: [coupon_id], references: [id], onDelete: Cascade, map: "fk_rails_42da53d623")

  @@unique([coupon_id, type], map: "index_coupon_offers_on_coupon_id_and_type")
  @@index([coupon_id], map: "index_coupon_offers_on_coupon_id")
}

model coupon_rules {
  id                         BigInt                       @id @default(autoincrement())
  coupon_id                  BigInt
  type                       String?                      @db.VarChar(64)
  preferences                String?                      @db.Text
  created_at                 DateTime                     @db.DateTime(0)
  updated_at                 DateTime                     @db.DateTime(0)
  organization_id            BigInt
  organizations              organizations                @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_035d6fdb1f")
  coupons                    coupons                      @relation(fields: [coupon_id], references: [id], onDelete: Cascade, map: "fk_rails_9f593087d9")
  coupon_rules_accessibility coupon_rules_accessibility[]

  @@unique([coupon_id, type, organization_id], map: "index_coupon_rules_on_coupon_id_and_type_and_organization_id")
  @@index([organization_id], map: "fk_rails_035d6fdb1f")
  @@index([coupon_id], map: "index_coupon_rules_on_coupon_id")
}

model coupon_rules_accessibility {
  id              BigInt        @id @default(autoincrement())
  coupon_rule_id  BigInt
  source_id       BigInt
  source_type     String        @db.VarChar(255)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_6b961da7d5")
  coupon_rules    coupon_rules  @relation(fields: [coupon_rule_id], references: [id], onDelete: Cascade, map: "fk_rails_af7f7a99ff")

  @@unique([coupon_rule_id, source_id, source_type, organization_id], map: "index_on_coupon_rules_accessibility_rule_source_organization")
  @@index([organization_id], map: "fk_rails_6b961da7d5")
  @@index([coupon_rule_id], map: "index_coupon_rules_accessibility_on_coupon_rule_id")
}

model coupons {
  id                                       BigInt                   @id @default(autoincrement())
  code                                     String                   @db.VarChar(64)
  description                              String?                  @db.Text
  long_description                         String?                  @db.Text
  status                                   String                   @default("DRAFT") @db.VarChar(32)
  accessibility                            String                   @default("PUBLIC") @db.VarChar(8)
  terms_and_conditions                     String?                  @db.Text
  per_user_usage_limit                     Int?
  redemption_limit                         Int?
  redemptions_consumed                     Int                      @default(0)
  start_date                               DateTime?                @db.DateTime(0)
  end_date                                 DateTime?                @db.DateTime(0)
  published_at                             DateTime?                @db.DateTime(0)
  organization_id                          BigInt
  created_by                               BigInt?
  updated_by                               BigInt?
  created_at                               DateTime                 @db.DateTime(0)
  updated_at                               DateTime                 @db.DateTime(0)
  rules_match_policy                       String                   @default("ANY") @db.VarChar(4)
  is_terms_and_conditions_system_generated Boolean                  @default(true)
  first_published_at                       DateTime?                @db.DateTime(0)
  currency                                 String                   @db.VarChar(3)
  cart_item_adjustments                    cart_item_adjustments[]
  coupon_audits                            coupon_audits[]
  coupon_offers                            coupon_offers[]
  coupon_rules                             coupon_rules[]
  users_coupons_created_byTousers          users?                   @relation("coupons_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_657731e8e7")
  organizations                            organizations            @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_d312f1f8f5")
  users_coupons_updated_byTousers          users?                   @relation("coupons_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_d97d0a161f")
  order_item_adjustments                   order_item_adjustments[]
  orders                                   orders[]

  @@index([created_by], map: "fk_rails_657731e8e7")
  @@index([updated_by], map: "fk_rails_d97d0a161f")
  @@index([code, organization_id], map: "index_coupons_on_code_and_organization_id")
  @@index([organization_id], map: "index_coupons_on_organization_id")
}

model custom_field_values {
  id              BigInt        @id @default(autoincrement())
  custom_field_id BigInt
  field_value     String?       @db.MediumText
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  custom_fields   custom_fields @relation(fields: [custom_field_id], references: [id], onDelete: Cascade, map: "fk_rails_e73dfaa201")

  @@index([custom_field_id], map: "index_custom_field_values_on_custom_field_id")
}

model custom_fields {
  id                  BigInt                @id @default(autoincrement())
  organization_id     BigInt
  category            String                @db.VarChar(32)
  name                String                @db.VarChar(255)
  field_type          String                @db.VarChar(16)
  required            Boolean               @default(false)
  enable_sort         Boolean               @default(false)
  enable_reports      Boolean               @default(false)
  is_multiple         Boolean               @default(false)
  created_at          DateTime              @db.DateTime(0)
  updated_at          DateTime              @db.DateTime(0)
  visible_to_user     Boolean               @default(true)
  parent_id           BigInt?
  sequence            Int                   @default(0)
  custom_field_values custom_field_values[]
  custom_fields       custom_fields?        @relation("custom_fieldsTocustom_fields", fields: [parent_id], references: [id], onDelete: Cascade, map: "fk_rails_cb1e3419f1")
  other_custom_fields custom_fields[]       @relation("custom_fieldsTocustom_fields")
  organizations       organizations         @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_e6e49694ee")
  form_field_values   form_field_values[]

  @@unique([name, field_type, category, organization_id], map: "custom_field_name_unique")
  @@index([organization_id], map: "index_custom_fields_on_organization_id")
  @@index([parent_id], map: "index_custom_fields_on_parent_id")
}

model device_access_tokens {
  id                   BigInt              @id @default(autoincrement())
  device_id            BigInt
  user_access_token_id BigInt?
  created_at           DateTime            @db.DateTime(0)
  updated_at           DateTime            @db.DateTime(0)
  user_access_tokens   user_access_tokens? @relation(fields: [user_access_token_id], references: [id], onUpdate: SetNull, map: "fk_rails_2bf99536b3")
  devices              devices             @relation(fields: [device_id], references: [id], onDelete: Cascade, map: "fk_rails_ac6c1fe84b")

  @@index([device_id], map: "index_device_access_tokens_on_device_id")
  @@index([user_access_token_id], map: "index_device_access_tokens_on_user_access_token_id")
}

model devices {
  id                      BigInt                 @id @default(autoincrement())
  platform                String                 @db.VarChar(32)
  platform_version        String                 @db.VarChar(255)
  app_id                  String                 @default("com.auzmor.learnlms") @db.VarChar(32)
  app_version             String                 @db.VarChar(32)
  device_uuid             String                 @db.VarChar(255)
  device_name             String                 @db.VarChar(255)
  device_model            String                 @db.MediumText
  imei                    String?                @db.VarChar(32)
  badge_count             Int                    @default(0)
  active                  Boolean                @default(true)
  user_id                 BigInt
  organization_id         BigInt
  created_at              DateTime               @db.DateTime(0)
  updated_at              DateTime               @db.DateTime(0)
  device_token            String?                @db.VarChar(255)
  device_token_updated_at DateTime?              @db.DateTime(0)
  device_access_tokens    device_access_tokens[]
  users                   users                  @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_410b63ef65")
  organizations           organizations          @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_f102621b29")

  @@unique([user_id, app_id, device_uuid], map: "index_devices_on_user_id_and_app_id_and_device_uuid")
  @@index([organization_id], map: "index_devices_on_organization_id")
  @@index([user_id], map: "index_devices_on_user_id")
}

model enrolled_user_assessments {
  id                         BigInt                    @id @default(autoincrement())
  enrollment_id              BigInt?
  user_assessment_version_id BigInt?
  enrollments                enrollments?              @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_0a0cbf625f")
  user_assessment_versions   user_assessment_versions? @relation(fields: [user_assessment_version_id], references: [id], onDelete: Cascade, map: "fk_rails_ab2de54e53")

  @@unique([enrollment_id, user_assessment_version_id], map: "index_on_enrolled_user_assessments_enrollment_assessment_version")
  @@index([enrollment_id], map: "index_enrolled_user_assessments_on_enrollment_id")
  @@index([user_assessment_version_id], map: "index_enrolled_user_assessments_on_user_assessment_version_id")
}

model enrolled_user_surveys {
  id                     BigInt                @id @default(autoincrement())
  enrollment_id          BigInt?
  user_survey_version_id BigInt?
  enrollments            enrollments?          @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_827b1875ca")
  user_survey_versions   user_survey_versions? @relation(fields: [user_survey_version_id], references: [id], onDelete: Cascade, map: "fk_rails_e51c3bd971")

  @@index([enrollment_id], map: "index_enrolled_user_surveys_on_enrollment_id")
  @@index([user_survey_version_id], map: "index_enrolled_user_surveys_on_user_survey_version_id")
}

model enrollment_properties {
  id            BigInt      @id @default(autoincrement())
  prop_name     String?     @db.VarChar(255)
  prop_value    String?     @db.MediumText
  enrollment_id BigInt
  created_at    DateTime    @db.DateTime(0)
  updated_at    DateTime    @db.DateTime(0)
  enrollments   enrollments @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_10742c4a39")

  @@unique([prop_name, enrollment_id], map: "index_enrollment_properties_on_prop_name_and_enrollment_id")
  @@index([enrollment_id], map: "index_enrollment_properties_on_enrollment_id")
}

model enrollment_trackers {
  id                                           BigInt        @id @default(autoincrement())
  status                                       String        @default("invited") @db.VarChar(16)
  source_type                                  String        @db.VarChar(255)
  source_id                                    BigInt
  enrollment_id                                BigInt
  user_id                                      BigInt
  to_complete_at                               DateTime?     @db.DateTime(0)
  created_at                                   DateTime      @db.DateTime(0)
  updated_at                                   DateTime      @db.DateTime(0)
  assigned_by                                  BigInt?
  parent_id                                    BigInt?
  organization_id                              BigInt
  enrollments                                  enrollments   @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_5a65b23a29")
  users_enrollment_trackers_assigned_byTousers users?        @relation("enrollment_trackers_assigned_byTousers", fields: [assigned_by], references: [id], onUpdate: SetNull, map: "fk_rails_9a2b54730f")
  users_enrollment_trackers_user_idTousers     users         @relation("enrollment_trackers_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_d650dd575e")
  organizations                                organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "index_enrollment_trackers_on_organization_id")

  @@index([parent_id], map: "fk_rails_34582e7602")
  @@index([assigned_by], map: "fk_rails_9a2b54730f")
  @@index([enrollment_id], map: "index_enrollment_trackers_on_enrollment_id")
  @@index([organization_id], map: "index_enrollment_trackers_on_organization_id")
  @@index([user_id], map: "index_enrollment_trackers_on_user_id")
  @@index([enrollment_id, organization_id], map: "index_on_enrollment_trackers_enrollment_organization")
  @@index([source_id, source_type], map: "index_on_enrollment_trackers_source_id_source_type")
}

model enrollment_versions {
  id                                           BigInt        @id @default(autoincrement())
  invited                                      Boolean       @default(false)
  enrolled                                     Boolean       @default(false)
  completed                                    Boolean       @default(false)
  invited_at                                   DateTime?     @db.DateTime(0)
  enrolled_at                                  DateTime?     @db.DateTime(0)
  completed_at                                 DateTime?     @db.DateTime(0)
  to_complete_at                               DateTime?     @db.DateTime(0)
  started                                      Boolean       @default(false)
  started_at                                   DateTime?     @db.DateTime(0)
  version_id                                   Int?
  source_id                                    BigInt
  user_id                                      BigInt
  enrollment_id                                BigInt
  created_at                                   DateTime      @db.DateTime(0)
  updated_at                                   DateTime      @db.DateTime(0)
  assessment_status                            String?       @db.VarChar(255)
  total_time_spent                             BigInt        @default(0)
  assigned_by                                  BigInt?
  score                                        Int?
  compliance_completed                         Boolean       @default(false)
  compliance_completed_at                      DateTime?     @db.DateTime(0)
  completed_percentage                         Int           @default(0) @db.MediumInt
  status                                       String        @default("invited") @db.VarChar(16)
  source_type                                  String        @default("Course") @db.VarChar(255)
  certified                                    Boolean       @default(false)
  certificate_issue_date                       DateTime?     @db.DateTime(0)
  certificate_expiration_date                  DateTime?     @db.DateTime(0)
  organization_id                              BigInt
  failed                                       Boolean       @default(false)
  failed_at                                    DateTime?     @db.DateTime(0)
  failed_reason                                Int?
  attendance_status                            String?       @db.VarChar(255)
  esigned                                      Boolean       @default(false)
  esigned_at                                   DateTime?     @db.DateTime(0)
  esign_pending                                Boolean       @default(false)
  feedback_submitted                           Boolean       @default(false)
  feedback_submitted_at                        DateTime?     @db.DateTime(0)
  feedback_pending                             Boolean       @default(false)
  survey_pending                               Boolean       @default(false)
  survey_completed                             Boolean       @default(false)
  survey_completed_at                          DateTime?     @db.DateTime(0)
  survey_started_at                            DateTime?     @db.DateTime(0)
  users_enrollment_versions_assigned_byTousers users?        @relation("enrollment_versions_assigned_byTousers", fields: [assigned_by], references: [id], onUpdate: SetNull, map: "fk_rails_650959505b")
  enrollments                                  enrollments   @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_bb1be2cf84")
  users_enrollment_versions_user_idTousers     users         @relation("enrollment_versions_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_e92f7d8b5e")
  organizations                                organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "index_enrollment_versions_on_organization_id")

  @@unique([source_id, enrollment_id, version_id], map: "version_id_unique")
  @@index([assigned_by], map: "fk_rails_0bcaf8902c")
  @@index([enrollment_id], map: "index_enrollment_versions_on_enrollment_id")
  @@index([organization_id], map: "index_enrollment_versions_on_organization_id")
  @@index([source_id, source_type], map: "index_enrollment_versions_on_source_id_and_source_type")
  @@index([user_id], map: "index_enrollment_versions_on_user_id")
}

model enrollments {
  id                                   BigInt                           @id @default(autoincrement())
  invited                              Boolean                          @default(false)
  enrolled                             Boolean                          @default(false)
  completed                            Boolean                          @default(false)
  invited_at                           DateTime?                        @db.DateTime(0)
  enrolled_at                          DateTime?                        @db.DateTime(0)
  completed_at                         DateTime?                        @db.DateTime(0)
  to_complete_at                       DateTime?                        @db.DateTime(0)
  started                              Boolean                          @default(false)
  started_at                           DateTime?                        @db.DateTime(0)
  user_id                              BigInt
  source_id                            BigInt
  version_id                           Int?                             @default(1)
  enrollment_expires_at                DateTime?                        @db.DateTime(0)
  last_invited_at                      DateTime?                        @db.DateTime(0)
  total_time_spent                     BigInt                           @default(0)
  score                                Int?
  compliance_completed                 Boolean                          @default(false)
  compliance_completed_at              DateTime?                        @db.DateTime(0)
  assigned_by                          BigInt?
  assessment_status                    String?                          @db.VarChar(255)
  completed_percentage                 Int                              @default(0) @db.MediumInt
  status                               String                           @default("INVITED") @db.VarChar(16)
  source_type                          String                           @default("Course") @db.VarChar(255)
  join_url                             String?                          @db.Text
  created_at                           DateTime                         @db.DateTime(0)
  updated_at                           DateTime                         @db.DateTime(0)
  certified                            Boolean                          @default(false)
  certificate_issue_date               DateTime?                        @db.DateTime(0)
  certificate_expiration_date          DateTime?                        @db.DateTime(0)
  is_available                         Boolean                          @default(true)
  failed                               Boolean                          @default(false)
  failed_at                            DateTime?                        @db.DateTime(0)
  failed_reason                        Int?
  attendance_status                    String?                          @db.VarChar(255)
  esigned                              Boolean                          @default(false)
  esigned_at                           DateTime?                        @db.DateTime(0)
  esign_pending                        Boolean                          @default(false)
  feedback_submitted                   Boolean                          @default(false)
  feedback_submitted_at                DateTime?                        @db.DateTime(0)
  feedback_pending                     Boolean                          @default(false)
  survey_pending                       Boolean                          @default(false)
  survey_completed                     Boolean                          @default(false)
  survey_started_at                    DateTime?                        @db.DateTime(0)
  survey_completed_at                  DateTime?                        @db.DateTime(0)
  organization_id                      BigInt?
  latest                               Boolean                          @default(true)
  parent_id                            BigInt?
  assessment_trackers                  assessment_trackers[]
  enrolled_user_assessments            enrolled_user_assessments[]
  enrolled_user_surveys                enrolled_user_surveys[]
  enrollment_properties                enrollment_properties[]
  enrollment_trackers                  enrollment_trackers[]
  enrollment_versions                  enrollment_versions[]
  organizations                        organizations?                   @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_enrollments_organization_id")
  enrollments                          enrollments?                     @relation("enrollmentsToenrollments", fields: [parent_id], references: [id], onDelete: Cascade, map: "fk_enrollments_parent_id")
  other_enrollments                    enrollments[]                    @relation("enrollmentsToenrollments")
  users_enrollments_assigned_byTousers users?                           @relation("enrollments_assigned_byTousers", fields: [assigned_by], references: [id], onUpdate: SetNull, map: "fk_rails_2ee076ea45")
  users_enrollments_user_idTousers     users                            @relation("enrollments_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_e860e0e46b")
  event_attendance                     event_attendance[]
  feedback                             feedback[]
  launch_history                       launch_history[]
  learner_progress                     learner_progress[]
  question_trackers                    question_trackers[]
  shared_enrollments                   shared_enrollments[]
  training_reassignments_history       training_reassignments_history[]

  @@unique([user_id, source_id, source_type, version_id], map: "index_enrollments_on_user_id_and_source_and_version_id")
  @@index([assigned_by], map: "fk_rails_a972f19ee7")
  @@index([organization_id], map: "index_enrollments_on_organization_id")
  @@index([parent_id], map: "index_enrollments_on_parent_id")
  @@index([source_id, source_type], map: "index_enrollments_on_source_id_and_source_type")
  @@index([user_id], map: "index_enrollments_on_user_id")
}

model entity_relations {
  id          BigInt   @id @default(autoincrement())
  child_id    BigInt
  child_type  String   @db.VarChar(255)
  parent_id   BigInt
  parent_type String   @db.VarChar(255)
  action      Boolean?
  created_at  DateTime @db.DateTime(0)
  updated_at  DateTime @db.DateTime(0)

  @@unique([child_id, child_type, parent_id, parent_type], map: "entity_relations_unique_child_parent")
  @@index([child_id, child_type], map: "index_entity_relations_on_child_id_and_child_type")
  @@index([parent_id, parent_type], map: "index_entity_relations_on_parent_id_and_parent_type")
}

model event_attendance {
  id               BigInt      @id @default(autoincrement())
  status           String      @db.VarChar(255)
  marked_at        DateTime    @db.DateTime(0)
  enrollment_id    BigInt
  marked_by        BigInt?
  created_at       DateTime    @db.DateTime(0)
  updated_at       DateTime    @db.DateTime(0)
  marked_by_system Boolean     @default(false)
  users            users?      @relation(fields: [marked_by], references: [id], onUpdate: SetNull, map: "fk_rails_13a27de5f4")
  enrollments      enrollments @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_715257ecd8")

  @@index([marked_by], map: "fk_rails_13a27de5f4")
  @@index([enrollment_id], map: "index_event_attendance_on_enrollment_id")
}

model event_sessions {
  id                                     BigInt    @id @default(autoincrement())
  name                                   String    @db.VarChar(255)
  description                            String?   @db.MediumText
  attendance_type                        String?   @db.VarChar(255)
  timezone                               String    @db.VarChar(255)
  start_date                             DateTime  @db.DateTime(0)
  end_date                               DateTime  @db.DateTime(0)
  completion_date                        DateTime? @db.DateTime(0)
  duration                               Int
  capacity                               Int?
  status                                 String    @default("DRAFT") @db.VarChar(255)
  conference_url                         String?   @db.Text
  location                               String?   @db.Text
  session_type                           String    @default("TRAINING") @db.VarChar(255)
  created_by                             BigInt?
  event_id                               BigInt
  created_at                             DateTime  @db.DateTime(0)
  updated_at                             DateTime  @db.DateTime(0)
  updated_by                             BigInt?
  conference_type                        String?   @db.VarChar(255)
  enrollment_subscription                Int?
  rich_text_description                  String?   @db.MediumText
  enrollments_count                      Int       @default(0)
  enable_social_learning                 Boolean   @default(false)
  is_attendance_optional                 Boolean   @default(false)
  cancellation_reason                    String?   @db.VarChar(255)
  cancellation_message                   String?   @db.MediumText
  cancelled_at                           DateTime? @db.DateTime(0)
  users_event_sessions_created_byTousers users?    @relation("event_sessions_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_0947d4abff")
  events                                 events    @relation(fields: [event_id], references: [id], onDelete: Cascade, map: "fk_rails_1c8f5e7d07")
  users_event_sessions_updated_byTousers users?    @relation("event_sessions_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_d1d40305a4")

  @@index([created_by], map: "fk_rails_0947d4abff")
  @@index([updated_by], map: "fk_rails_d1d40305a4")
  @@index([end_date], map: "index_event_sessions_on_end_date")
  @@index([event_id], map: "index_event_sessions_on_event_id")
  @@index([start_date], map: "index_event_sessions_on_start_date")
}

model events {
  id                                      BigInt           @id @default(autoincrement())
  name                                    String           @db.VarChar(255)
  description                             String?          @db.MediumText
  accessibility                           String           @default("PUBLIC") @db.VarChar(255)
  start_date                              DateTime?        @db.DateTime(0)
  end_date                                DateTime?        @db.DateTime(0)
  completion_date                         DateTime?        @db.DateTime(0)
  source_id                               Int?
  source_type                             String?          @db.VarChar(255)
  duration                                Int?
  capacity                                Int?
  created_by                              BigInt?
  status                                  String           @default("DRAFT") @db.VarChar(255)
  organization_id                         BigInt
  created_at                              DateTime         @db.DateTime(0)
  updated_at                              DateTime         @db.DateTime(0)
  image_url                               String?          @db.VarChar(255)
  updated_by                              BigInt?
  skip_assessment                         Boolean          @default(true)
  pass_percentage                         Int?             @default(70)
  assessment_attempts                     Int?             @default(3)
  rich_text_description                   String?          @db.MediumText
  questions_count                         Int              @default(0)
  assessment_recurring_reminder           Boolean          @default(false)
  assessment_recurring_reminder_frequency Int              @default(0)
  complete_assessment_by_order            Boolean          @default(true)
  enable_esign                            Boolean          @default(false)
  esign_terms_and_conditions              String?          @db.MediumText
  enable_ecommerce                        Boolean          @default(false)
  original_price                          Decimal?         @db.Decimal(10, 2)
  discount                                Decimal?         @db.Decimal(10, 2)
  is_discount_configured                  Boolean          @default(false)
  discount_expires_at                     DateTime?        @db.DateTime(0)
  discounted_price                        Decimal?         @db.Decimal(10, 2)
  currency                                String?          @db.VarChar(3)
  average_rating                          Decimal?         @db.Decimal(10, 0)
  feedback_count                          Int              @default(0)
  enable_feedback                         Boolean          @default(false)
  is_feedback_mandatory                   Boolean          @default(false)
  published_at                            DateTime?        @db.DateTime(0)
  can_reporting_manager_evaluate          Boolean          @default(false)
  allow_team_managers_to_view_training    Boolean          @default(true)
  event_sessions                          event_sessions[]
  organizations                           organizations    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_163b5130b5")
  users_events_created_byTousers          users?           @relation("events_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_7773afdbbe")
  users_events_updated_byTousers          users?           @relation("events_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_e85fd9c9ae")

  @@index([created_by], map: "fk_rails_7773afdbbe")
  @@index([updated_by], map: "fk_rails_e85fd9c9ae")
  @@index([end_date], map: "index_events_on_end_date")
  @@index([organization_id], map: "index_events_on_organization_id")
  @@index([source_id, source_type], map: "index_events_on_source_id_and_source_type")
  @@index([start_date], map: "index_events_on_start_date")
}

model external_sources {
  id                       BigInt                 @id @default(autoincrement())
  source_type              String                 @db.VarChar(255)
  source_id                BigInt
  external_type            String                 @db.VarChar(255)
  external_id              String                 @db.VarChar(255)
  organization_provider_id BigInt
  additional_info          String?                @db.Text
  is_system                Boolean                @default(false)
  created_at               DateTime               @db.DateTime(0)
  updated_at               DateTime               @db.DateTime(0)
  organization_providers   organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_197007ec9c")

  @@unique([source_type, source_id, organization_provider_id], map: "index_external_sources_unique_index")
  @@index([external_type, external_id], map: "index_collaborations_on_external_id_and_external_type")
  @@index([source_id, source_type], map: "index_collaborations_on_source_id_and_source_type")
  @@index([organization_provider_id], map: "index_external_sources_on_organization_provider_id")
}

model external_training_accessibility {
  id                           BigInt                     @id @default(autoincrement())
  external_training_setting_id BigInt
  source_id                    BigInt
  source_type                  String                     @db.VarChar(255)
  created_at                   DateTime                   @db.DateTime(0)
  updated_at                   DateTime                   @db.DateTime(0)
  external_training_settings   external_training_settings @relation(fields: [external_training_setting_id], references: [id], onDelete: Cascade, map: "fk_rails_0f174563d0")

  @@unique([source_id, source_type, external_training_setting_id], map: "idx_external_training_accessibility_source")
  @@index([external_training_setting_id], map: "idx_external_accessibility_setting")
}

model external_training_settings {
  id                                             BigInt                            @id @default(autoincrement())
  organization_id                                BigInt
  allow_learners_to_upload_certificate           Boolean                           @default(false)
  approval_type                                  String                            @default("NoApproval") @db.VarChar(255)
  approval_reminder_frequency                    Int?
  allow_learners_to_add_training_data            Boolean                           @default(false)
  preferences                                    String?                           @db.Text
  created_at                                     DateTime                          @db.DateTime(0)
  updated_at                                     DateTime                          @db.DateTime(0)
  include_external_training_time_in_user_metrics Boolean                           @default(false)
  external_training_accessibility                external_training_accessibility[]
  organizations                                  organizations                     @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_9d6a3c1ec8")

  @@index([organization_id], map: "index_external_training_settings_on_organization_id")
}

model external_trainings {
  id                                         BigInt        @id @default(autoincrement())
  title                                      String        @db.VarChar(255)
  authority_name                             String        @db.VarChar(255)
  duration                                   Int
  image_url                                  String?       @db.VarChar(255)
  organization_id                            BigInt
  created_by                                 BigInt?
  updated_by                                 BigInt?
  records_count                              BigInt        @default(0)
  created_at                                 DateTime      @db.DateTime(0)
  updated_at                                 DateTime      @db.DateTime(0)
  fill_type                                  String        @default("cover") @db.VarChar(16)
  users_external_trainings_updated_byTousers users?        @relation("external_trainings_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_3738da7edd")
  users_external_trainings_created_byTousers users?        @relation("external_trainings_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_6bfec5c92c")
  organizations                              organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_751a8e090f")

  @@unique([title, authority_name, organization_id], map: "external_training_title_authority_name")
  @@index([updated_by], map: "fk_rails_3738da7edd")
  @@index([created_by], map: "fk_rails_6bfec5c92c")
  @@index([organization_id], map: "index_external_trainings_on_organization_id")
}

model feedback {
  id                              BigInt        @id @default(autoincrement())
  rating                          Int           @default(0)
  review                          String?       @db.MediumText
  long_review                     String?       @db.MediumText
  is_visible                      Boolean       @default(true)
  hidden_by                       BigInt?
  source_id                       BigInt
  source_type                     String        @db.VarChar(255)
  user_id                         BigInt?
  enrollment_id                   BigInt?
  organization_id                 BigInt
  submitted_at                    DateTime      @db.DateTime(0)
  created_at                      DateTime      @db.DateTime(0)
  updated_at                      DateTime      @db.DateTime(0)
  enrollments                     enrollments?  @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_055b8d9620")
  organizations                   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_2805449fb2")
  users_feedback_user_idTousers   users?        @relation("feedback_user_idTousers", fields: [user_id], references: [id], onUpdate: Restrict, map: "fk_rails_3ffcea2ae3")
  users_feedback_hidden_byTousers users?        @relation("feedback_hidden_byTousers", fields: [hidden_by], references: [id], onUpdate: Restrict, map: "fk_rails_8abc4eefdf")

  @@unique([source_id, source_type, user_id], map: "index_feedback_on_source_id_and_source_type_and_user_id")
  @@index([hidden_by], map: "fk_rails_8abc4eefdf")
  @@index([enrollment_id], map: "index_feedback_on_enrollment_id")
  @@index([organization_id], map: "index_feedback_on_organization_id")
  @@index([source_id, source_type], map: "index_feedback_on_source_id_and_source_type")
  @@index([user_id], map: "index_feedback_on_user_id")
}

model feedback_questions {
  id              BigInt        @id @default(autoincrement())
  locale          Int           @default(0)
  rating_question String        @db.Text
  review_question String?       @db.Text
  organization_id BigInt
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4715eff8f2")

  @@unique([organization_id, locale], map: "index_feedback_questions_on_organization_id_and_locale")
  @@index([organization_id], map: "index_feedback_questions_on_organization_id")
}

model feedback_settings {
  id                              BigInt        @id @default(autoincrement())
  allow_managers_to_view_feedback Boolean       @default(true)
  allow_learners_to_view_feedback Boolean       @default(true)
  allow_trainees_to_view_feedback Boolean       @default(true)
  organization_id                 BigInt
  organizations                   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_ed940494d8")

  @@index([organization_id], map: "index_feedback_settings_on_organization_id")
}

model flagged_sources {
  id              BigInt        @id @default(autoincrement())
  source_id       BigInt
  source_type     String        @db.VarChar(64)
  user_id         BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_flagged_sources_organization_id")
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_1e41f1bbf4")

  @@index([source_id, source_type], map: "index_flagged_sources_on_source_id_and_source_type")
  @@index([user_id], map: "index_flagged_sources_on_user_id")
  @@index([organization_id], map: "index_flagged_sources_organization")
  @@index([user_id, source_id, source_type], map: "index_flagged_sources_source_user")
}

model form_field_values {
  id              BigInt        @id @default(autoincrement())
  custom_field_id BigInt
  source_id       Int?
  source_type     String?       @db.VarChar(64)
  field_value     String?       @db.MediumText
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  custom_fields   custom_fields @relation(fields: [custom_field_id], references: [id], onDelete: Cascade, map: "fk_rails_26fb6a1a01")

  @@index([custom_field_id], map: "index_form_field_values_on_custom_field_id")
  @@index([source_id, source_type], map: "index_form_field_values_on_source_id_and_source_type")
}

model forum_settings {
  id        BigInt @id @default(autoincrement())
  forums_id BigInt
  forums    forums @relation(fields: [forums_id], references: [id], onDelete: Cascade, map: "fk_rails_4bba0ef7b0")

  @@index([forums_id], map: "index_forum_settings_on_forums_id")
}

model forums {
  id                             BigInt           @id @default(autoincrement())
  title                          String           @db.MediumText
  description                    String?          @db.MediumText
  long_description               String?          @db.MediumText
  source_id                      BigInt
  source_type                    String           @db.VarChar(64)
  status                         String           @default("PUBLISHED") @db.VarChar(64)
  image_url                      String?          @db.VarChar(255)
  posts_count                    Int              @default(0)
  organization_id                BigInt
  created_by                     BigInt?
  updated_by                     BigInt?
  created_at                     DateTime         @db.DateTime(0)
  updated_at                     DateTime         @db.DateTime(0)
  fill_type                      String           @default("cover") @db.VarChar(255)
  accessibility                  String           @default("PUBLIC") @db.VarChar(255)
  forum_settings                 forum_settings[]
  organizations                  organizations    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_adda96e4e0")
  users_forums_created_byTousers users?           @relation("forums_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_cd0d186dc3")
  users_forums_updated_byTousers users?           @relation("forums_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_f4354fe6a3")
  posts                          posts[]

  @@index([created_by], map: "fk_rails_cd0d186dc3")
  @@index([updated_by], map: "fk_rails_f4354fe6a3")
  @@index([organization_id], map: "index_forums_on_organization_id")
  @@index([organization_id, source_id, source_type], map: "index_forums_on_organization_id_and_source_id_and_source_type")
  @@index([source_id, source_type], map: "index_forums_on_source_id_and_source_type")
}

model images {
  id             BigInt   @id @default(autoincrement())
  filename       String   @db.VarChar(255)
  url            String   @db.VarChar(255)
  imageable_type String?  @db.VarChar(255)
  imageable_id   BigInt?
  created_at     DateTime @db.DateTime(0)
  updated_at     DateTime @db.DateTime(0)
}

model jwt_blacklist {
  id  BigInt   @id @default(autoincrement())
  jti String   @db.VarChar(255)
  exp DateTime @db.DateTime(0)

  @@index([jti], map: "index_jwt_blacklist_on_jti")
}

model launch_history {
  id            BigInt       @id @default(autoincrement())
  enrollment_id BigInt?
  session_id    String       @unique(map: "index_launch_history_on_session_id") @db.VarChar(255)
  time_spent    BigInt       @default(0)
  started_at    DateTime?    @db.DateTime(0)
  completed     Boolean      @default(false)
  completed_at  DateTime?    @db.DateTime(0)
  created_at    DateTime     @db.DateTime(0)
  updated_at    DateTime     @db.DateTime(0)
  parent_id     BigInt?
  parent_type   String?      @db.VarChar(255)
  enrollments   enrollments? @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_a759cdc410")

  @@index([enrollment_id], map: "index_launch_history_on_enrollment_id")
  @@index([parent_id, parent_type], map: "index_launch_history_on_parent_id_and_parent_type")
}

model learner_progress {
  id               BigInt      @id @default(autoincrement())
  enrollment_id    BigInt
  source_id        BigInt
  created_at       DateTime    @db.DateTime(0)
  updated_at       DateTime    @db.DateTime(0)
  total_time_spent BigInt      @default(0)
  started          Boolean     @default(true)
  started_at       DateTime?   @db.DateTime(0)
  completed        Boolean     @default(false)
  completed_at     DateTime?   @db.DateTime(0)
  source_type      String      @default("Chapter") @db.VarChar(255)
  status           String      @default("IN_PROGRESS") @db.VarChar(16)
  position         Int?
  enrollments      enrollments @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_77b7e15053")

  @@unique([enrollment_id, source_id, source_type], map: "learner_progress_enrollment_source")
  @@index([enrollment_id], map: "index_learner_progress_on_enrollment_id")
  @@index([source_id, source_type], map: "index_learner_progress_on_source_id_and_source_type")
}

model learning_entities {
  id              BigInt         @id @default(autoincrement())
  sequence        Int            @default(1)
  mandatory       Boolean        @default(false)
  source_id       BigInt
  source_type     String         @db.VarChar(255)
  library_id      BigInt?
  user_id         BigInt?
  organization_id BigInt?
  created_at      DateTime       @db.DateTime(0)
  updated_at      DateTime       @db.DateTime(0)
  organizations   organizations? @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_467abcb03a")
  libraries       libraries?     @relation(fields: [library_id], references: [id], onDelete: Cascade, map: "fk_rails_78a7894aeb")
  users           users?         @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_a47f102268")

  @@unique([source_id, source_type, library_id], map: "lp_entities_unique_index")
  @@index([library_id], map: "index_learning_entities_on_library_id")
  @@index([organization_id], map: "index_learning_entities_on_organization_id")
  @@index([source_id, source_type], map: "index_learning_entities_on_source_id_and_source_type")
  @@index([user_id], map: "index_learning_entities_on_user_id")
}

model learning_resource_categories {
  id                   BigInt             @id @default(autoincrement())
  learning_resource_id BigInt
  content_category_id  BigInt
  learning_resources   learning_resources @relation(fields: [learning_resource_id], references: [id], onDelete: Cascade, map: "fk_rails_6f4d7f3bde")
  content_categories   content_categories @relation(fields: [content_category_id], references: [id], onDelete: Cascade, map: "fk_rails_d5d40ad411")

  @@unique([learning_resource_id, content_category_id], map: "index_on_content_learning_resource_categories_resource_category")
  @@index([content_category_id], map: "index_learning_resource_categories_on_content_category_id")
  @@index([learning_resource_id], map: "index_learning_resource_categories_on_learning_resource_id")
}

model learning_resources {
  id                           BigInt                         @id @default(autoincrement())
  title                        String                         @db.VarChar(255)
  description                  String?                        @db.MediumText
  status                       String                         @default("DRAFT") @db.VarChar(255)
  learning_standard            String                         @db.VarChar(255)
  learning_standard_version    String?                        @db.VarChar(255)
  launch_url                   String?                        @db.VarChar(255)
  image_url                    String?                        @db.VarChar(255)
  duration                     Int                            @default(0)
  hosting_completed            Boolean                        @default(false)
  is_hosted                    Boolean                        @default(false)
  external_id                  String?                        @db.VarChar(255)
  content_publisher_id         BigInt?
  expires_at                   DateTime?                      @db.DateTime(0)
  created_at                   DateTime                       @db.DateTime(0)
  updated_at                   DateTime                       @db.DateTime(0)
  learning_resource_categories learning_resource_categories[]
  content_publishers           content_publishers?            @relation(fields: [content_publisher_id], references: [id], onUpdate: SetNull, map: "fk_rails_abed35c781")

  @@index([content_publisher_id], map: "index_learning_resources_on_content_publisher_id")
}

model libraries {
  id                                      BigInt               @id @default(autoincrement())
  title                                   String               @db.MediumText
  description                             String?              @db.MediumText
  long_description                        String?              @db.MediumText
  start_date                              DateTime?            @db.DateTime(0)
  end_date                                DateTime?            @db.DateTime(0)
  validity                                Int?
  active                                  Boolean              @default(true)
  duration                                BigInt               @default(0)
  status                                  String               @default("DRAFT") @db.VarChar(255)
  skip_assessment                         Boolean              @default(false)
  published_at                            DateTime?            @db.DateTime(0)
  assessment_attempts                     Int?                 @default(3)
  pass_percentage                         Int?                 @default(70)
  created_at                              DateTime             @db.DateTime(0)
  updated_at                              DateTime             @db.DateTime(0)
  organization_id                         BigInt
  external_id                             String?              @db.MediumText
  launch_url                              String?              @db.MediumText
  learning_standard                       String?              @db.VarChar(255)
  created_by                              BigInt?
  updated_by                              BigInt?
  auto_assign_interval_in_months          Int?
  image_url                               String?              @db.MediumText
  fill_type                               String               @default("cover") @db.VarChar(255)
  reporting_type                          String?              @db.VarChar(255)
  learning_standard_version               String?              @db.VarChar(255)
  provider                                String               @default("Native") @db.VarChar(255)
  is_hosted                               Boolean              @default(false)
  slug                                    String?              @db.VarChar(255)
  recent                                  Boolean              @default(false)
  hosting_completed                       Boolean              @default(false)
  is_duration_configured                  Boolean              @default(false)
  single_reminder                         Boolean              @default(false)
  single_reminder_frequency               Int                  @default(0)
  recurring_reminder                      Boolean              @default(false)
  recurring_reminder_frequency            Int                  @default(0)
  type                                    String               @default("Course") @db.VarChar(255)
  in_order                                Boolean              @default(true)
  accessibility                           String               @default("PUBLIC") @db.VarChar(255)
  enrollments_count                       Int                  @default(0)
  is_authored                             Boolean              @default(false)
  questions_count                         Int                  @default(0)
  enable_ecommerce                        Boolean              @default(false)
  original_price                          Decimal?             @db.Decimal(10, 2)
  discount                                Decimal?             @db.Decimal(10, 2)
  is_discount_configured                  Boolean              @default(false)
  discount_expires_at                     DateTime?            @db.DateTime(0)
  discounted_price                        Decimal?             @db.Decimal(10, 2)
  enable_social_learning                  Boolean              @default(false)
  complete_assessment_by_order            Boolean              @default(true)
  enable_esign                            Boolean              @default(false)
  esign_terms_and_conditions              String?              @db.MediumText
  currency                                String?              @db.VarChar(3)
  average_rating                          Decimal?             @db.Decimal(10, 0)
  feedback_count                          Int                  @default(0)
  enable_feedback                         Boolean              @default(false)
  is_feedback_mandatory                   Boolean              @default(false)
  enable_survey                           Boolean              @default(false)
  is_survey_mandatory                     Boolean              @default(false)
  can_reporting_manager_evaluate          Boolean              @default(false)
  ignore_unavailable_training             Boolean?
  complete_prerequisite_to_avail_training Boolean?             @default(true)
  overdue_reminder                        Boolean              @default(false)
  overdue_reminder_frequency              Int                  @default(0)
  max_overdue_reminders_type              String?              @default("OCCURRENCES") @db.VarChar(255)
  max_overdue_reminders                   Int                  @default(0)
  allow_team_managers_to_view_training    Boolean              @default(true)
  chapters                                chapters[]
  learning_entities                       learning_entities[]
  organizations                           organizations        @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4eb18dcf99")
  users_libraries_updated_byTousers       users?               @relation("libraries_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_50a93b3b8a")
  users_libraries_created_byTousers       users?               @relation("libraries_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_a59556f4b4")
  library_properties                      library_properties[]

  @@index([created_by], map: "fk_rails_8984e96f9b")
  @@index([updated_by], map: "fk_rails_e6befd6ba5")
  @@index([external_id(length: 255), organization_id], map: "index_libraries_on_external_id_and_organization_id")
  @@index([organization_id], map: "index_libraries_on_organization_id")
  @@index([slug], map: "index_libraries_on_slug")
  @@index([type, organization_id], map: "index_libraries_on_type_and_organization_id")
}

model library_properties {
  id         BigInt    @id @default(autoincrement())
  library_id BigInt
  prop_type  String?   @db.VarChar(255)
  prop_name  String    @db.VarChar(255)
  prop_value String?   @db.VarChar(255)
  created_at DateTime  @db.DateTime(0)
  updated_at DateTime  @db.DateTime(0)
  libraries  libraries @relation(fields: [library_id], references: [id], onDelete: Cascade, map: "fk_rails_593d954c55")

  @@unique([library_id, prop_name, prop_type], map: "index_library_properties_library_id_and_prop_type_and_prop_name")
  @@index([library_id], map: "index_library_properties_on_library_id")
}

model manager_relations {
  id              BigInt        @id @default(autoincrement())
  manager_id      BigInt
  source_id       BigInt
  source_type     String        @db.VarChar(255)
  medium_id       BigInt?
  medium_type     String?       @db.VarChar(255)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  users           users         @relation(fields: [manager_id], references: [id], onDelete: Cascade, map: "fk_rails_1537621875")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "index_manager_relations_on_organization_id")

  @@unique([manager_id, source_id, source_type, medium_id, medium_type], map: "index_manager_relations_unique_index")
  @@index([medium_id, medium_type], map: "index_manager_relations_on_medium_id_and_medium_type")
  @@index([organization_id], map: "index_manager_relations_on_organization_id")
  @@index([source_id, source_type], map: "index_manager_relations_on_source_id_and_source_type")
}

model master_roles {
  id              BigInt         @id @default(autoincrement())
  name            String?        @db.VarChar(255)
  organization_id BigInt?
  created_at      DateTime       @db.DateTime(0)
  updated_at      DateTime       @db.DateTime(0)
  organizations   organizations? @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_a95b4a069f")
  permissions     permissions[]
  user_roles      user_roles[]

  @@unique([name, organization_id], map: "index_master_roles_on_name_and_organization_id")
  @@index([organization_id], map: "index_master_roles_on_organization_id")
}

model master_webhooks {
  id               BigInt             @id @default(autoincrement())
  source           String             @db.VarChar(255)
  event            String             @db.VarChar(255)
  description      String?            @db.Text
  created_at       DateTime           @db.DateTime(0)
  updated_at       DateTime           @db.DateTime(0)
  webhook_events   webhook_events[]
  webhook_triggers webhook_triggers[]

  @@unique([source, event], map: "index_master_webhooks_on_source_and_event")
}

model meeting_notes {
  id                    BigInt             @id @default(autoincrement())
  meeting_recipient_id  BigInt
  description           String?            @db.Text
  rich_text_description String?            @db.Text
  accessibility         String             @default("PRIVATE") @db.VarChar(255)
  created_at            DateTime           @db.DateTime(0)
  updated_at            DateTime           @db.DateTime(0)
  meeting_recipients    meeting_recipients @relation(fields: [meeting_recipient_id], references: [id], onDelete: Cascade, map: "fk_rails_39b921b48a")

  @@index([meeting_recipient_id], map: "index_meeting_notes_on_meeting_recipient_id")
}

model meeting_properties {
  id          BigInt      @id @default(autoincrement())
  prop_name   String      @db.VarChar(255)
  prop_value  String?     @db.Text
  meeting_id  BigInt
  created_at  DateTime    @db.DateTime(0)
  updated_at  DateTime    @db.DateTime(0)
  conferences conferences @relation(fields: [meeting_id], references: [id], onDelete: Cascade, map: "fk_rails_88b1c46766")

  @@index([meeting_id], map: "index_meeting_properties_on_meeting_id")
  @@index([prop_name, meeting_id], map: "index_meeting_properties_on_prop_name_and_meeting_id")
}

model meeting_recipients {
  id            BigInt          @id @default(autoincrement())
  user_id       BigInt
  meeting_id    BigInt
  joinee_role   String          @default("MENTEE") @db.VarChar(255)
  status        String?         @default("PENDING") @db.VarChar(255)
  created_at    DateTime        @db.DateTime(0)
  updated_at    DateTime        @db.DateTime(0)
  join_url      String?         @db.Text
  meeting_notes meeting_notes[]
  users         users           @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_4b6da14b7e")
  meetings      meetings        @relation(fields: [meeting_id], references: [id], onDelete: Cascade, map: "fk_rails_70a2a7ed69")

  @@index([meeting_id], map: "index_meeting_recipients_on_meeting_id")
  @@index([user_id], map: "index_meeting_recipients_on_user_id")
}

model meetings {
  id                 BigInt               @id @default(autoincrement())
  title              String               @db.VarChar(255)
  description        String?              @db.Text
  timezone           String               @db.VarChar(255)
  location           String?              @db.Text
  session_type       String               @default("TRAINING") @db.VarChar(255)
  start_date         DateTime             @db.DateTime(0)
  end_date           DateTime             @db.DateTime(0)
  duration           Int
  completion_date    DateTime?            @db.DateTime(0)
  conference_url     String?              @db.Text
  conference_type    String?              @db.VarChar(255)
  source_id          BigInt?
  source_type        String?              @db.VarChar(255)
  status             String               @default("PENDING") @db.VarChar(255)
  organization_id    BigInt
  created_by         BigInt?
  updated_by         BigInt?
  created_at         DateTime             @db.DateTime(0)
  updated_at         DateTime             @db.DateTime(0)
  rescheduled        Boolean              @default(false)
  rescheduled_at     DateTime?            @db.DateTime(0)
  category           String?              @default("MILESTONE_REGULAR") @db.VarChar(255)
  booked_slots       booked_slots[]
  meeting_recipients meeting_recipients[]
  organizations      organizations        @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_0842ae6524")

  @@index([organization_id], map: "index_meetings_on_organization_id")
  @@index([source_id, source_type], map: "index_meetings_on_source_id_and_source_type")
}

model mentees {
  id                   BigInt        @id @default(autoincrement())
  about                String?       @db.MediumText
  user_id              BigInt
  organization_id      BigInt
  average_rating       Decimal?      @db.Decimal(10, 2)
  desired_skills_count Int           @default(0)
  active_skills_count  Int           @default(0)
  created_at           DateTime      @db.DateTime(0)
  updated_at           DateTime      @db.DateTime(0)
  joined_on            DateTime?     @db.DateTime(0)
  create_profile_later Boolean       @default(false)
  users                users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_76021dafff")
  organizations        organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_7e68e657ed")

  @@unique([user_id, organization_id], map: "index_mentees_on_user_id_and_organization_id")
  @@index([organization_id], map: "index_mentees_on_organization_id")
  @@index([user_id], map: "index_mentees_on_user_id")
}

model mentions {
  id               BigInt        @id @default(autoincrement())
  organization_id  BigInt
  mentioner_id     BigInt
  mentioner_type   String        @db.VarChar(64)
  mentionable_id   BigInt
  mentionable_type String        @db.VarChar(64)
  created_at       DateTime      @db.DateTime(0)
  organizations    organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_466352825b")

  @@unique([mentioner_id, mentioner_type, mentionable_id, mentionable_type], map: "index_on_mentions_mentioner_mentionable")
  @@index([mentionable_id, mentionable_type], map: "index_mentions_on_mentionable_id_and_mentionable_type")
  @@index([mentioner_id, mentioner_type], map: "index_mentions_on_mentioner_id_and_mentioner_type")
  @@index([organization_id], map: "index_mentions_on_organization_id")
}

model mentors {
  id                   BigInt        @id @default(autoincrement())
  about                String?       @db.MediumText
  user_id              BigInt
  organization_id      BigInt
  average_rating       Decimal?      @db.Decimal(10, 2)
  skills_count         Int           @default(0)
  created_at           DateTime      @db.DateTime(0)
  updated_at           DateTime      @db.DateTime(0)
  joined_on            DateTime?     @db.DateTime(0)
  create_profile_later Boolean       @default(false)
  organizations        organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_3f9bb5bb45")
  users                users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_97b600c650")

  @@unique([user_id, organization_id], map: "index_mentors_on_user_id_and_organization_id")
  @@index([organization_id], map: "index_mentors_on_organization_id")
  @@index([user_id], map: "index_mentors_on_user_id")
}

model mentorship_requests {
  id                                            BigInt                @id @default(autoincrement())
  request_type                                  String?               @db.VarChar(255)
  requested_by                                  BigInt?
  request_note                                  String?               @db.VarChar(512)
  status                                        String                @default("PENDING") @db.VarChar(255)
  program_id                                    BigInt
  source_id                                     BigInt?
  source_type                                   String?               @db.VarChar(255)
  source_role                                   String?               @db.VarChar(255)
  responded_by                                  BigInt?
  responded_at                                  DateTime?             @db.DateTime(0)
  response_reason                               String?               @db.VarChar(512)
  parent_id                                     BigInt?
  organization_id                               BigInt
  created_at                                    DateTime              @db.DateTime(0)
  updated_at                                    DateTime              @db.DateTime(0)
  users_mentorship_requests_responded_byTousers users?                @relation("mentorship_requests_responded_byTousers", fields: [responded_by], references: [id], onUpdate: SetNull, map: "fk_rails_195bda78cd")
  programs                                      programs              @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_5d070f9e51")
  users_mentorship_requests_requested_byTousers users?                @relation("mentorship_requests_requested_byTousers", fields: [requested_by], references: [id], onDelete: Cascade, map: "fk_rails_67d763ded3")
  mentorship_requests                           mentorship_requests?  @relation("mentorship_requestsTomentorship_requests", fields: [parent_id], references: [id], onDelete: Cascade, map: "fk_rails_d8a060c0f1")
  other_mentorship_requests                     mentorship_requests[] @relation("mentorship_requestsTomentorship_requests")
  organizations                                 organizations         @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_da80fea3b4")

  @@index([responded_by], map: "fk_rails_195bda78cd")
  @@index([requested_by], map: "fk_rails_67d763ded3")
  @@index([parent_id], map: "fk_rails_d8a060c0f1")
  @@index([organization_id], map: "index_mentorship_requests_on_organization_id")
  @@index([program_id], map: "index_mentorship_requests_on_program_id")
  @@index([source_id, source_type], map: "index_mentorship_requests_on_source_id_and_source_type")
}

model mfa_authenticated_sessions {
  id              BigInt        @id @default(autoincrement())
  session_id      String        @db.VarChar(64)
  user_account_id BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  user_accounts   user_accounts @relation(fields: [user_account_id], references: [id], onDelete: Cascade, map: "fk_rails_27e50ba66d")

  @@index([session_id], map: "index_mfa_authenticated_sessions_on_session_id")
  @@index([user_account_id], map: "index_mfa_authenticated_sessions_on_user_account_id")
  @@index([user_account_id, session_id], map: "index_on_mfa_authenticated_sessions_account_session")
}

model notification_settings {
  id                                                      BigInt    @id @default(autoincrement())
  notification_user_add                                   Boolean   @default(true)
  notification_user_delete                                Boolean   @default(true)
  notification_delete_team                                Boolean   @default(true)
  notification_add_manager_to_team                        Boolean   @default(true)
  notification_remove_manager_to_team                     Boolean   @default(true)
  notification_edit_public_course                         Boolean   @default(true)
  notification_edit_private_course                        Boolean   @default(true)
  notification_assign_course                              Boolean   @default(true)
  notification_course_overdue                             Boolean   @default(true)
  notification_course_complete                            Boolean   @default(false)
  notification_assessment_failed                          Boolean   @default(true)
  notification_course_expire                              Boolean   @default(true)
  email_notification_domain_change                        Boolean   @default(true)
  email_notification_trail_account_expired                Boolean   @default(true)
  email_notification_welcome_mail                         Boolean   @default(true)
  email_notification_assign_course                        Boolean   @default(true)
  email_notification_course_overdue                       Boolean   @default(true)
  email_notification_course_complete                      Boolean   @default(false)
  email_notification_assessment_failed                    Boolean   @default(true)
  email_notification_course_expire                        Boolean   @default(true)
  user_id                                                 BigInt?
  created_at                                              DateTime  @db.DateTime(0)
  updated_at                                              DateTime  @db.DateTime(0)
  email_notification_add_manager_to_team                  Boolean?  @default(false)
  email_notification_remove_manager_to_team               Boolean?  @default(false)
  notification_assign_learning_path                       Boolean   @default(true)
  notification_learning_path_overdue                      Boolean   @default(true)
  notification_learning_path_completed                    Boolean   @default(false)
  notification_learning_path_expire                       Boolean   @default(true)
  email_notification_assign_learning_path                 Boolean   @default(true)
  email_notification_learning_path_overdue                Boolean   @default(true)
  email_notification_learning_path_completed              Boolean   @default(false)
  email_notification_learning_path_expire                 Boolean   @default(true)
  email_notification_update_learning_path                 Boolean   @default(true)
  notification_event_complete                             Boolean   @default(false)
  email_notification_event_complete                       Boolean   @default(false)
  notification_event_summary                              Boolean   @default(false)
  email_notification_event_summary                        Boolean   @default(false)
  notification_on_certificate_expiration                  Boolean   @default(false)
  email_notification_on_certificate_expiration            Boolean   @default(false)
  notification_on_like_post                               Boolean   @default(false)
  email_notification_on_like_post                         Boolean   @default(false)
  notification_on_like_post_reply                         Boolean   @default(false)
  email_notification_on_like_post_reply                   Boolean   @default(false)
  notification_comment_on_post                            Boolean   @default(false)
  email_notification_comment_on_post                      Boolean   @default(false)
  notification_reply_on_comment                           Boolean   @default(false)
  email_notification_reply_on_comment                     Boolean   @default(false)
  notification_reply_on_post                              Boolean   @default(false)
  email_notification_reply_on_post                        Boolean   @default(false)
  notification_on_mention                                 Boolean   @default(false)
  email_notification_on_mention                           Boolean   @default(false)
  notification_feedback_submitted                         Boolean   @default(false)
  email_notification_feedback_submitted                   Boolean   @default(false)
  notification_checklist_assignment                       Boolean   @default(false)
  email_notification_checklist_assignment                 Boolean   @default(false)
  notification_checklist_assignment_as_reviewer           Boolean   @default(false)
  email_notification_checklist_assignment_as_reviewer     Boolean   @default(false)
  notification_checklist_assignment_as_viewer             Boolean   @default(false)
  email_notification_checklist_assignment_as_viewer       Boolean   @default(false)
  notification_on_checklist_overdue_to_assignee           Boolean   @default(false)
  email_notification_on_checklist_overdue_to_assignee     Boolean   @default(false)
  notification_on_checklist_overdue_to_viewer             Boolean   @default(false)
  notification_on_checklist_overdue_to_reviewer           Boolean   @default(false)
  notification_checklist_status_changed_to_viewer         Boolean   @default(false)
  email_notification_checklist_status_changed_to_viewer   Boolean   @default(false)
  notification_checklist_status_changed_to_reviewer       Boolean   @default(false)
  email_notification_checklist_status_changed_to_reviewer Boolean   @default(false)
  notification_comment_on_checklist                       Boolean   @default(false)
  email_notification_comment_on_checklist                 Boolean   @default(false)
  notification_on_mentioned_in_checklist_comment          Boolean   @default(false)
  email_notification_on_mentioned_in_checklist_comment    Boolean   @default(false)
  notification_update_checklist_to_assignee               Boolean   @default(false)
  email_notification_update_checklist_to_assignee         Boolean   @default(false)
  notification_update_checklist_to_viewer                 Boolean   @default(false)
  email_notification_update_checklist_to_viewer           Boolean   @default(false)
  notification_update_checklist_to_reviewer               Boolean   @default(false)
  email_notification_update_checklist_to_reviewer         Boolean   @default(false)
  notification_task_review_to_reviewer                    Boolean   @default(false)
  email_notification_task_review_to_reviewer              Boolean   @default(false)
  notification_task_review_to_viewer                      Boolean   @default(false)
  email_notification_task_review_to_viewer                Boolean   @default(false)
  notification_survey_submitted                           Boolean   @default(true)
  notification_on_reporting_manager_assignment            Boolean   @default(false)
  notification_on_reporting_manager_removal               Boolean   @default(false)
  email_notification_on_reporting_manager_assignment      Boolean   @default(false)
  email_notification_on_reporting_manager_removal         Boolean   @default(false)
  notification_on_reportee_assignment                     Boolean   @default(false)
  notification_on_reportee_removal                        Boolean   @default(false)
  email_notification_on_reportee_assignment               Boolean   @default(false)
  email_notification_on_reportee_removal                  Boolean   @default(false)
  notification_on_program_enrollment                      Boolean   @default(true)
  email_notification_on_mentor_change_request             Boolean?  @default(true)
  notification_on_cancel_mentor_change_request_admin      Boolean   @default(true)
  notification_on_overdue_milestone                       Boolean?  @default(true)
  notification_on_mentor_change_request                   Boolean?  @default(true)
  notification_on_kickoff_meeting_request                 Boolean?  @default(true)
  notification_on_mentor_feedback_reporting_manager       Boolean?  @default(true)
  notification_on_update_mentor_program                   Boolean   @default(true)
  email_notification_on_reportee_program_enrollment       Boolean   @default(true)
  notification_on_team_member_program_enrollment          Boolean?  @default(true)
  email_notification_on_invite_mentee_to_program          Boolean   @default(true)
  notification_on_nomination_request                      Boolean   @default(true)
  notification_on_meeting_scheduled_reporting_manager     Boolean?  @default(true)
  notification_on_create_goal_reporting_manager           Boolean?  @default(true)
  notification_on_mentor_adding_meeting_notes             Boolean   @default(true)
  email_notification_on_kickoff_meeting_request           Boolean   @default(true)
  notification_on_create_goal_mentor                      Boolean   @default(true)
  email_notification_on_create_goal_mentor                Boolean   @default(true)
  notification_on_pre_program_feedback_mentor             Boolean   @default(true)
  notification_on_mentee_adding_meeting_notes             Boolean   @default(true)
  notification_on_mentee_feedback                         Boolean   @default(true)
  notification_on_milestone_completion                    Boolean   @default(true)
  notification_on_program_training_completion             Boolean   @default(false)
  email_notification_on_reportee_program_completion       Boolean?  @default(true)
  notification_on_reportee_adding_meeting_notes           Boolean   @default(true)
  email_notification_on_mentor_feedback_reporting_manager Boolean   @default(true)
  notification_on_pre_program_feedback_reporting_manager  Boolean   @default(true)
  notification_on_nomination_approved_reporting_manager   Boolean   @default(true)
  notification_on_reportee_meeting_request_approval       Boolean   @default(true)
  notification_on_reportee_program_completion             Boolean   @default(true)
  notification_on_mentor_feedback_team_manager            Boolean   @default(true)
  notification_on_program_completion_team_manager         Boolean   @default(true)
  notification_on_reportee_program_enrollment             Boolean   @default(false)
  email_notification_on_program_completion_team_manager   Boolean   @default(false)
  email_notification_on_overdue_reportees                 Boolean   @default(true)
  notification_on_overdue_reportees                       Boolean   @default(true)
  notification_frequency_on_overdue_reportees             String?   @default("WEEKLY") @db.VarChar(255)
  overdue_reportees_notification_configured_at            DateTime? @db.DateTime(0)
  overdue_reportees_notification_run_on_date              DateTime? @db.DateTime(0)
  overdue_reportees_notification_last_run_on_date         DateTime? @db.DateTime(0)
  email_notification_on_overdue_team_members              Boolean   @default(false)
  notification_on_overdue_team_members                    Boolean   @default(false)
  notification_frequency_on_overdue_team_members          String?   @default("WEEKLY") @db.VarChar(255)
  overdue_team_members_notification_configured_at         DateTime? @db.DateTime(0)
  overdue_team_members_notification_run_on_date           DateTime? @db.DateTime(0)
  overdue_team_members_notification_last_run_on_date      DateTime? @db.DateTime(0)
  users                                                   users?    @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_0c95e91db7")

  @@index([user_id], map: "index_notification_settings_on_user_id")
}

model notifications {
  id                                  BigInt         @id @default(autoincrement())
  action_type                         String?        @db.MediumText
  target_id_1                         Int?
  target_id_2                         Int?
  performed_at                        DateTime?      @db.DateTime(0)
  actor_id                            BigInt?
  owner_id                            BigInt?
  target_1_type                       String?        @db.VarChar(255)
  target_2_type                       String?        @db.VarChar(255)
  deleted_target_name                 String?        @db.MediumText
  created_at                          DateTime       @db.DateTime(0)
  updated_at                          DateTime       @db.DateTime(0)
  is_read                             Boolean        @default(false)
  periods                             Int?
  additional_info                     String?        @db.Text
  organization_id                     BigInt?
  users_notifications_actor_idTousers users?         @relation("notifications_actor_idTousers", fields: [actor_id], references: [id], onUpdate: SetNull, map: "fk_rails_06a39bb8cc")
  users_notifications_owner_idTousers users?         @relation("notifications_owner_idTousers", fields: [owner_id], references: [id], onDelete: Cascade, map: "fk_rails_c99e9ae0ea")
  organizations                       organizations? @relation(fields: [organization_id], references: [id], onUpdate: SetNull, map: "index_notifications_on_organization_id")

  @@index([action_type(length: 256)], map: "index_notifications_on_action_type")
  @@index([actor_id], map: "index_notifications_on_actor_id")
  @@index([organization_id], map: "index_notifications_on_organization_id")
  @@index([owner_id], map: "index_notifications_on_owner_id")
  @@index([organization_id, owner_id], map: "index_on_organization_id_owner_id")
  @@index([target_id_1, target_1_type], map: "index_on_target_id_1_target_1_type")
  @@index([target_id_2, target_2_type], map: "index_on_target_id_2_target_2_type")
}

model oauth_access_grants {
  id                 BigInt             @id @default(autoincrement())
  resource_owner_id  BigInt
  application_id     BigInt
  token              String             @unique(map: "index_oauth_access_grants_on_token") @db.VarChar(255)
  expires_in         Int
  redirect_uri       String             @db.Text
  created_at         DateTime           @db.DateTime(0)
  revoked_at         DateTime?          @db.DateTime(0)
  scopes             String?            @db.VarChar(255)
  oauth_applications oauth_applications @relation(fields: [application_id], references: [id], onUpdate: Restrict, map: "fk_rails_b4b53e07b8")

  @@index([application_id], map: "index_oauth_access_grants_on_application_id")
  @@index([resource_owner_id], map: "index_oauth_access_grants_on_resource_owner_id")
}

model oauth_access_tokens {
  id                     BigInt              @id @default(autoincrement())
  resource_owner_id      BigInt?
  application_id         BigInt?
  token                  String              @unique(map: "index_oauth_access_tokens_on_token") @db.VarChar(255)
  refresh_token          String?             @unique(map: "index_oauth_access_tokens_on_refresh_token") @db.VarChar(255)
  expires_in             Int?
  revoked_at             DateTime?           @db.DateTime(0)
  created_at             DateTime            @db.DateTime(0)
  scopes                 String?             @db.VarChar(255)
  previous_refresh_token String              @default("") @db.VarChar(255)
  oauth_applications     oauth_applications? @relation(fields: [application_id], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_732cb83ab7")

  @@index([application_id], map: "index_oauth_access_tokens_on_application_id")
  @@index([resource_owner_id], map: "index_oauth_access_tokens_on_resource_owner_id")
}

model oauth_applications {
  id                  BigInt                @id @default(autoincrement())
  name                String                @db.VarChar(255)
  uid                 String                @unique(map: "index_oauth_applications_on_uid") @db.VarChar(255)
  secret              String                @db.VarChar(255)
  redirect_uri        String?               @db.Text
  scopes              String                @default("") @db.VarChar(255)
  confidential        Boolean               @default(true)
  created_at          DateTime              @db.DateTime(0)
  updated_at          DateTime              @db.DateTime(0)
  organization_id     BigInt
  description         String?               @db.VarChar(255)
  enabled             Boolean               @default(false)
  image_url           String?               @db.VarChar(255)
  oauth_access_grants oauth_access_grants[]
  oauth_access_tokens oauth_access_tokens[]
  organizations       organizations         @relation(fields: [organization_id], references: [id], onUpdate: Restrict, map: "fk_rails_e2fdb31d70")

  @@index([organization_id], map: "index_oauth_applications_on_organization_id")
}

model oauth_client_authentications {
  id              BigInt         @id @default(autoincrement())
  client_id       String         @db.VarChar(255)
  client_secret   String         @db.VarChar(255)
  endpoint        String         @db.MediumText
  redirect_uri    String         @db.MediumText
  scopes          String?        @db.VarChar(255)
  state           String         @db.VarChar(255)
  organization_id BigInt?
  user_id         BigInt?
  source_id       BigInt?
  source_type     String?        @db.VarChar(255)
  created_at      DateTime       @db.DateTime(0)
  updated_at      DateTime       @db.DateTime(0)
  organizations   organizations? @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_1afd9ae1c3")
  users           users?         @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_6316f701ef")

  @@index([organization_id], map: "index_oauth_client_authentications_on_organization_id")
  @@index([source_id, source_type], map: "index_oauth_client_authentications_on_source_id_and_source_type")
  @@index([user_id], map: "index_oauth_client_authentications_on_user_id")
}

model operations {
  id                BigInt         @id @default(autoincrement())
  action            String         @db.VarChar(255)
  status            String         @db.VarChar(255)
  additional_info   String?        @db.Text
  response          String?        @db.MediumText
  send_notification Boolean?       @default(false)
  organization_id   BigInt
  user_id           BigInt?
  action_queue_id   BigInt?
  started_at        DateTime?      @db.Timestamp(0)
  completed_at      DateTime?      @db.Timestamp(0)
  created_at        DateTime       @db.DateTime(0)
  updated_at        DateTime       @db.DateTime(0)
  is_system         Boolean?       @default(false)
  action_queues     action_queues? @relation(fields: [action_queue_id], references: [id], onUpdate: SetNull, map: "fk_rails_0b0d086032")
  organizations     organizations  @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_491483aaed")
  users             users?         @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_63fbf4e94e")

  @@index([action_queue_id], map: "index_operations_on_action_queue_id")
  @@index([organization_id], map: "index_operations_on_organization_id")
  @@index([user_id], map: "index_operations_on_user_id")
}

model order_item_adjustments {
  id                BigInt       @id @default(autoincrement())
  coupon_id         BigInt?
  order_item_id     BigInt?
  coupon_code       String       @db.VarChar(255)
  coupon_offer      String?      @db.Text
  coupon_offer_type String?      @db.VarChar(255)
  amount            Decimal?     @db.Decimal(10, 2)
  created_at        DateTime     @db.DateTime(0)
  updated_at        DateTime     @db.DateTime(0)
  coupons           coupons?     @relation(fields: [coupon_id], references: [id], onUpdate: SetNull, map: "fk_rails_15cff11644")
  order_items       order_items? @relation(fields: [order_item_id], references: [id], onDelete: Cascade, map: "fk_rails_e29f53ca47")

  @@index([coupon_id], map: "index_order_item_adjustments_on_coupon_id")
  @@index([order_item_id], map: "index_order_item_adjustments_on_order_item_id")
}

model order_items {
  id                     BigInt                   @id @default(autoincrement())
  item_id                BigInt
  item_type              String                   @db.VarChar(255)
  quantity               Int                      @default(1)
  original_price         Decimal                  @db.Decimal(10, 2)
  discount               Decimal?                 @db.Decimal(10, 2)
  purchase_price         Decimal                  @db.Decimal(10, 2)
  status                 String                   @default("NOT_PURCHASED") @db.VarChar(255)
  user_id                BigInt
  order_id               BigInt
  organization_id        BigInt
  created_at             DateTime                 @db.DateTime(0)
  updated_at             DateTime                 @db.DateTime(0)
  purchased_at           DateTime?                @db.DateTime(0)
  paid_amount            Decimal                  @default(0.00) @db.Decimal(10, 2)
  currency               String                   @db.VarChar(3)
  order_item_adjustments order_item_adjustments[]
  users                  users                    @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_0779e952fa")
  orders                 orders                   @relation(fields: [order_id], references: [id], onDelete: Cascade, map: "fk_rails_e3cb28f071")
  organizations          organizations            @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_f8defdf81b")

  @@index([item_id, item_type], map: "index_order_items_on_item_id_and_item_type")
  @@index([order_id], map: "index_order_items_on_order_id")
  @@index([order_id, user_id, organization_id], map: "index_order_items_on_order_user_organization")
  @@index([organization_id], map: "index_order_items_on_organization_id")
  @@index([user_id], map: "index_order_items_on_user_id")
}

model order_shipments {
  id                BigInt          @id @default(autoincrement())
  order_id          BigInt
  external_order_id String?         @db.VarChar(255)
  tracker_id        String?         @db.VarChar(255)
  tracking_url      String?         @db.VarChar(255)
  status            String          @default("PENDING") @db.VarChar(255)
  message           String?         @db.Text
  shipped_at        DateTime        @default(now()) @db.Timestamp(0)
  completed_at      DateTime?       @db.Timestamp(0)
  created_at        DateTime        @db.DateTime(0)
  updated_at        DateTime        @db.DateTime(0)
  orders            orders          @relation(fields: [order_id], references: [id], onDelete: Cascade, map: "fk_rails_b506691fd9")
  shipped_items     shipped_items[]

  @@index([order_id, external_order_id, tracker_id], map: "index_external_order_tracker")
  @@index([external_order_id], map: "index_order_shipments_on_external_order_id")
  @@index([order_id], map: "index_order_shipments_on_order_id")
  @@index([tracker_id], map: "index_order_shipments_on_tracker_id")
}

model order_transactions {
  id                       BigInt                 @id @default(autoincrement())
  transaction_id           String?                @db.VarChar(255)
  status                   String                 @default("PENDING") @db.VarChar(64)
  total_price              Decimal?               @db.Decimal(10, 2)
  currency                 String                 @default("USD") @db.VarChar(8)
  payment_method           String?                @default("CARD") @db.VarChar(64)
  payment_gateway          String?                @db.VarChar(64)
  billing_address          String?                @db.Text
  contact_number           String?                @db.VarChar(255)
  started_at               DateTime?              @db.DateTime(0)
  completed_at             DateTime?              @db.DateTime(0)
  message                  String?                @db.Text
  order_id                 BigInt
  organization_provider_id BigInt
  created_at               DateTime               @db.DateTime(0)
  updated_at               DateTime               @db.DateTime(0)
  orders                   orders                 @relation(fields: [order_id], references: [id], onDelete: Cascade, map: "fk_rails_7ff02d42e9")
  organization_providers   organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_9ab187146a")

  @@index([order_id], map: "index_order_transactions_on_order_id")
  @@index([organization_provider_id], map: "index_order_transactions_on_organization_provider_id")
}

model ordered_links {
  id                                    BigInt        @id @default(autoincrement())
  source_id                             BigInt
  source_type                           String        @db.VarChar(255)
  title                                 String        @db.VarChar(255)
  url                                   String        @db.VarChar(255)
  sequence                              Int           @default(1)
  image_url                             String?       @db.VarChar(255)
  favicon                               String?       @db.VarChar(255)
  organization_id                       BigInt
  created_by                            BigInt?
  updated_by                            BigInt?
  created_at                            DateTime      @db.DateTime(0)
  updated_at                            DateTime      @db.DateTime(0)
  organizations                         organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_6df6381f06")
  users_ordered_links_created_byTousers users?        @relation("ordered_links_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_a1d0a9a777")
  users_ordered_links_updated_byTousers users?        @relation("ordered_links_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_c8a6416eb0")

  @@unique([source_id, source_type, sequence], map: "index_on_channel_links_source_sequence")
  @@index([created_by], map: "fk_rails_a1d0a9a777")
  @@index([updated_by], map: "fk_rails_c8a6416eb0")
  @@index([organization_id], map: "index_ordered_links_on_organization_id")
  @@index([source_id, source_type], map: "index_ordered_links_on_source_id_and_source_type")
}

model orders {
  id                 BigInt               @id @default(autoincrement())
  unique_id          String?              @db.VarChar(40)
  status             String               @default("OPEN") @db.VarChar(255)
  full_address       String               @db.Text
  contact_number     String               @db.VarChar(255)
  paid_amount        Decimal              @db.Decimal(10, 2)
  user_id            BigInt
  organization_id    BigInt
  created_at         DateTime             @db.DateTime(0)
  updated_at         DateTime             @db.DateTime(0)
  completed_at       DateTime?            @db.Timestamp(0)
  coupon_id          BigInt?
  total_amount       Decimal              @db.Decimal(10, 2)
  coupon_info        String?              @db.Text
  currency           String               @db.VarChar(3)
  order_items        order_items[]
  order_shipments    order_shipments[]
  order_transactions order_transactions[]
  coupons            coupons?             @relation(fields: [coupon_id], references: [id], onUpdate: SetNull, map: "fk_rails_907a5e9f62")
  users              users                @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_f868b47f6a")
  organizations      organizations        @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_fe8af6535c")

  @@index([coupon_id], map: "index_orders_on_coupon_id")
  @@index([organization_id], map: "index_orders_on_organization_id")
  @@index([unique_id], map: "index_orders_on_unique_id")
  @@index([user_id], map: "index_orders_on_user_id")
}

model organization_content_partners {
  id                 BigInt           @id @default(autoincrement())
  content_partner_id BigInt
  organization_id    BigInt
  prop_name          String           @db.VarChar(255)
  prop_value         String?          @db.MediumText
  created_at         DateTime         @db.DateTime(0)
  updated_at         DateTime         @db.DateTime(0)
  organizations      organizations    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_39f1a34ebb")
  content_partners   content_partners @relation(fields: [content_partner_id], references: [id], onDelete: Cascade, map: "fk_rails_4764463170")

  @@unique([content_partner_id, organization_id, prop_name], map: "organization_partner_id_prop_name")
  @@index([content_partner_id], map: "index_organization_content_partners_on_content_partner_id")
  @@index([organization_id], map: "index_organization_content_partners_on_organization_id")
}

model organization_partner_features {
  id                 BigInt           @id @default(autoincrement())
  provisioned        Boolean          @default(false)
  organization_id    BigInt
  content_partner_id BigInt
  created_at         DateTime         @db.DateTime(0)
  updated_at         DateTime         @db.DateTime(0)
  organizations      organizations    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_14a2946877")
  content_partners   content_partners @relation(fields: [content_partner_id], references: [id], onDelete: Cascade, map: "fk_rails_4915bb12d9")

  @@index([content_partner_id], map: "index_organization_partner_features_on_content_partner_id")
  @@index([organization_id], map: "index_organization_partner_features_on_organization_id")
}

model organization_providers {
  id                  BigInt                @id @default(autoincrement())
  organization_id     BigInt
  provider_id         BigInt
  enabled             Boolean               @default(false)
  created_at          DateTime              @db.DateTime(0)
  updated_at          DateTime              @db.DateTime(0)
  provisioned         Boolean               @default(true)
  enabled_at          DateTime?             @db.DateTime(0)
  conferences         conferences[]
  external_sources    external_sources[]
  order_transactions  order_transactions[]
  providers           providers             @relation(fields: [provider_id], references: [id], onDelete: Cascade, map: "fk_rails_dfb56d8998")
  organizations       organizations         @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_f911fe4f54")
  provider_properties provider_properties[]
  shipments           shipments[]
  sso_requests        sso_requests[]
  user_tokens         user_tokens[]

  @@unique([organization_id, provider_id], map: "index_organization_providers_on_organization_id_and_provider_id")
  @@index([organization_id], map: "index_organization_providers_on_organization_id")
  @@index([provider_id], map: "index_organization_providers_on_provider_id")
}

model organization_settings {
  id                         BigInt        @id @default(autoincrement())
  organization_id            BigInt        @unique(map: "index_organization_settings_on_organization_id")
  allow_profile_edit_manager Boolean       @default(true)
  allow_profile_edit_learner Boolean       @default(true)
  allow_profile_view_manager Boolean       @default(true)
  allow_profile_view_learner Boolean       @default(true)
  created_at                 DateTime      @db.DateTime(0)
  updated_at                 DateTime      @db.DateTime(0)
  enable_learning_path       Boolean       @default(false)
  enable_event               Boolean       @default(false)
  enable_content_preview     Boolean       @default(false)
  enable_ecommerce           Boolean       @default(false)
  provision_ecommerce        Boolean       @default(false)
  enable_sister_organization Boolean?      @default(false)
  enable_logistics           Boolean       @default(false)
  enable_mfa                 Boolean?
  enable_social_learning     Boolean       @default(false)
  enable_esign               Boolean       @default(false)
  mfa_enabled                Boolean       @default(false)
  mfa_type                   String?       @db.VarChar(255)
  mfa_backup                 String?       @db.VarChar(255)
  enable_feedback            Boolean       @default(false)
  enable_announcement        Boolean       @default(false)
  enable_checklist           Boolean       @default(false)
  enable_survey              Boolean       @default(false)
  provision_mentorship       Boolean       @default(true)
  enable_mentorship          Boolean       @default(false)
  deliver_email_notification Boolean       @default(true)
  organizations              organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_c56e4690c0")
}

model organizations {
  id                              BigInt                          @id @default(autoincrement())
  custom_key                      String                          @unique(map: "index_organizations_on_custom_key") @db.VarChar(255)
  url                             String                          @db.VarChar(255)
  name                            String?                         @db.VarChar(255)
  email                           String                          @db.VarChar(255)
  phone                           String?                         @db.VarChar(255)
  address_1                       String?                         @db.VarChar(255)
  address_2                       String?                         @db.VarChar(255)
  city                            String?                         @db.VarChar(255)
  state                           String?                         @db.VarChar(255)
  country                         String?                         @db.VarChar(255)
  created_at                      DateTime                        @db.DateTime(0)
  updated_at                      DateTime                        @db.DateTime(0)
  logo                            String?                         @db.VarChar(255)
  favicon                         String?                         @db.VarChar(255)
  default_sender_noreply          Boolean?                        @default(false)
  primary_color                   String?                         @db.VarChar(255)
  secondary_color                 String?                         @db.VarChar(255)
  postal_code                     String?                         @db.VarChar(255)
  trial_ends_on                   DateTime?                       @db.DateTime(0)
  contact_name                    String                          @db.VarChar(255)
  page_title                      String                          @default("Auzmor Learn") @db.VarChar(255)
  custom_domain                   String?                         @db.VarChar(255)
  custom_domain_enabled           Boolean                         @default(false)
  sso_enabled                     Boolean                         @default(false)
  locale                          String                          @default("en-US") @db.VarChar(255)
  is_paid                         Boolean?                        @default(false)
  currency                        String                          @default("USD") @db.VarChar(16)
  sister_org_count                Int                             @default(0)
  active                          Boolean                         @default(true)
  description                     String?                         @db.MediumText
  text_description                String?                         @db.MediumText
  parent_id                       BigInt?
  users_count                     Int                             @default(0)
  is_requested_to_be_deleted      Boolean                         @default(false)
  login_page_layout               String?                         @db.VarChar(8)
  login_page_background_type      String?                         @db.VarChar(8)
  login_page_background           String?                         @db.VarChar(255)
  login_page_header               String?                         @db.VarChar(255)
  login_page_header_position      String?                         @db.VarChar(8)
  login_page_description          String?                         @db.VarChar(1024)
  login_page_description_position String?                         @db.VarChar(8)
  time_zone                       String?                         @db.VarChar(255)
  licensed_users_count            Int                             @default(0)
  email_sender_address            String                          @default("auzmor-learn@auzmor.com") @db.VarChar(255)
  email_sender_name               String                          @default("Auzmor Learn") @db.VarChar(255)
  organization_type               String                          @default("LMS") @db.VarChar(8)
  account_verification_channels   account_verification_channels[]
  action_queues                   action_queues[]
  ahoy_events                     ahoy_events[]
  ahoy_visits                     ahoy_visits[]
  announcements                   announcements[]
  api_keys                        api_keys[]
  app_accessibility               app_accessibility[]
  app_user_activity               app_user_activity[]
  apps                            apps[]
  assessments                     assessments[]
  authentication_attempts         authentication_attempts[]
  banners                         banners[]
  booked_slots                    booked_slots[]
  bookmarked_sources              bookmarked_sources[]
  cart_items                      cart_items[]
  categories                      categories[]
  certificate_templates           certificate_templates[]
  channels                        channels[]
  checklist_settings              checklist_settings[]
  checklist_user_activities       checklist_user_activities[]
  checklist_users                 checklist_users[]
  checklists                      checklists[]
  contents                        contents[]
  coupon_audits                   coupon_audits[]
  coupon_rules                    coupon_rules[]
  coupon_rules_accessibility      coupon_rules_accessibility[]
  coupons                         coupons[]
  custom_fields                   custom_fields[]
  devices                         devices[]
  enrollment_trackers             enrollment_trackers[]
  enrollment_versions             enrollment_versions[]
  enrollments                     enrollments[]
  events                          events[]
  external_training_settings      external_training_settings[]
  external_trainings              external_trainings[]
  feedback                        feedback[]
  feedback_questions              feedback_questions[]
  feedback_settings               feedback_settings[]
  flagged_sources                 flagged_sources[]
  forums                          forums[]
  learning_entities               learning_entities[]
  libraries                       libraries[]
  manager_relations               manager_relations[]
  master_roles                    master_roles[]
  meetings                        meetings[]
  mentees                         mentees[]
  mentions                        mentions[]
  mentors                         mentors[]
  mentorship_requests             mentorship_requests[]
  notifications                   notifications[]
  oauth_applications              oauth_applications[]
  oauth_client_authentications    oauth_client_authentications[]
  operations                      operations[]
  order_items                     order_items[]
  ordered_links                   ordered_links[]
  orders                          orders[]
  organization_content_partners   organization_content_partners[]
  organization_partner_features   organization_partner_features[]
  organization_providers          organization_providers[]
  organization_settings           organization_settings?
  organizations                   organizations?                  @relation("organizationsToorganizations", fields: [parent_id], references: [id], onUpdate: SetNull, map: "fk_rails_6551137b98")
  other_organizations             organizations[]                 @relation("organizationsToorganizations")
  post_replies                    post_replies[]
  posts                           posts[]
  program_enrollments             program_enrollments[]
  programs                        programs[]
  reportees                       reportees[]
  reporting_manager_relations     reporting_manager_relations[]
  reports                         reports[]
  schedule_reports                schedule_reports[]
  search_terms                    search_terms[]
  service_accounts                service_accounts[]
  shared_enrollments              shared_enrollments[]
  shared_entities                 shared_entities[]
  skills                          skills[]
  slots                           slots[]
  social_groups                   social_groups[]
  source_visibility               source_visibility[]
  stores                          stores[]
  submissions                     submissions[]
  support_requests                support_requests[]
  surveys                         surveys[]
  sync_requests                   sync_requests[]
  teams                           teams[]
  time_access_logs                time_access_logs[]
  training_metrics                training_metrics[]
  user_access_tokens              user_access_tokens[]
  user_accounts                   user_accounts[]
  user_certificates               user_certificates[]
  user_reactions                  user_reactions[]
  user_roles                      user_roles[]
  user_skills                     user_skills[]
  user_support_messages           user_support_messages[]
  user_support_settings           user_support_settings[]
  users                           users[]
  webhooks                        webhooks[]
  workflows                       workflows[]

  @@index([parent_id], map: "fk_rails_6551137b98")
}

model permissions {
  id             BigInt        @id @default(autoincrement())
  resource       String?       @db.VarChar(255)
  action         String?       @db.VarChar(255)
  master_role_id BigInt?
  created_at     DateTime      @db.DateTime(0)
  updated_at     DateTime      @db.DateTime(0)
  master_roles   master_roles? @relation(fields: [master_role_id], references: [id], onDelete: Cascade, map: "fk_rails_021393b0bc")

  @@unique([resource, action, master_role_id], map: "index_permissions_on_resource_and_action_and_master_role_id")
  @@index([master_role_id], map: "index_permissions_on_master_role_id")
}

model poll_configurations {
  id                                          BigInt   @id @default(autoincrement())
  expires_at                                  DateTime @db.DateTime(0)
  show_result                                 Boolean? @default(true)
  votes_count                                 Int?     @default(0)
  participants_count                          Int?     @default(0)
  created_by                                  BigInt?
  updated_by                                  BigInt?
  poll_id                                     BigInt?
  created_at                                  DateTime @db.DateTime(0)
  updated_at                                  DateTime @db.DateTime(0)
  posts                                       posts?   @relation(fields: [poll_id], references: [id], onDelete: Cascade, map: "fk_rails_04cbdda2a7")
  users_poll_configurations_updated_byTousers users?   @relation("poll_configurations_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_13bd94acb3")
  users_poll_configurations_created_byTousers users?   @relation("poll_configurations_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_7b8267660f")

  @@index([updated_by], map: "fk_rails_13bd94acb3")
  @@index([created_by], map: "fk_rails_7b8267660f")
  @@index([poll_id], map: "index_poll_configurations_on_poll_id")
}

model poll_options {
  id                                   BigInt   @id @default(autoincrement())
  sequence                             Int?     @default(0)
  poll_id                              BigInt?
  option                               String   @db.Text
  votes_count                          Int?     @default(0)
  created_by                           BigInt?
  updated_by                           BigInt?
  created_at                           DateTime @db.DateTime(0)
  updated_at                           DateTime @db.DateTime(0)
  users_poll_options_updated_byTousers users?   @relation("poll_options_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_00ee8a1fbe")
  posts                                posts?   @relation(fields: [poll_id], references: [id], onDelete: Cascade, map: "fk_rails_aa85becb42")
  users_poll_options_created_byTousers users?   @relation("poll_options_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_db458e8159")

  @@index([updated_by], map: "fk_rails_00ee8a1fbe")
  @@index([created_by], map: "fk_rails_db458e8159")
  @@index([poll_id], map: "index_poll_options_on_poll_id")
}

model post_replies {
  id                                   BigInt         @id @default(autoincrement())
  message                              String         @db.MediumText
  full_message                         String         @db.MediumText
  type                                 String         @db.VarChar(64)
  parent_id                            BigInt?
  replies_count                        Int            @default(0)
  reactions_count                      Int            @default(0)
  popularity_score                     Int            @default(0)
  is_visible                           Boolean        @default(true)
  is_edited                            Boolean        @default(false)
  organization_id                      BigInt
  post_id                              BigInt
  created_by                           BigInt?
  updated_by                           BigInt?
  last_engaged_at                      DateTime       @db.DateTime(0)
  created_at                           DateTime       @db.DateTime(0)
  updated_at                           DateTime       @db.DateTime(0)
  flags_count                          Int            @default(0)
  is_link_preview_enabled              Boolean        @default(true)
  users_post_replies_updated_byTousers users?         @relation("post_replies_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_1eda2d5eb5")
  posts                                posts          @relation(fields: [post_id], references: [id], onDelete: Cascade, map: "fk_rails_440efa5863")
  users_post_replies_created_byTousers users?         @relation("post_replies_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_646867f13c")
  post_replies                         post_replies?  @relation("post_repliesTopost_replies", fields: [parent_id], references: [id], onDelete: Cascade, map: "fk_rails_671275a771")
  other_post_replies                   post_replies[] @relation("post_repliesTopost_replies")
  organizations                        organizations  @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_af0bb462e5")

  @@index([updated_by], map: "fk_rails_1eda2d5eb5")
  @@index([created_by], map: "fk_rails_646867f13c")
  @@index([parent_id], map: "fk_rails_671275a771")
  @@index([organization_id], map: "index_post_replies_on_organization_id")
  @@index([post_id], map: "index_post_replies_on_post_id")
  @@index([post_id, organization_id, created_by, parent_id], map: "index_post_replies_organization_user_post_parent")
}

model posts {
  id                                    BigInt                @id @default(autoincrement())
  title                                 String                @db.VarChar(255)
  description                           String?               @db.MediumText
  long_description                      String?               @db.MediumText
  type                                  String                @default("Discussion") @db.VarChar(64)
  comments_count                        Int                   @default(0)
  replies_count                         Int                   @default(0)
  views_count                           Int                   @default(0)
  reactions_count                       Int                   @default(0)
  popularity_score                      Int                   @default(0)
  open                                  Boolean               @default(true)
  is_visible                            Boolean               @default(true)
  is_edited                             Boolean               @default(false)
  organization_id                       BigInt
  forum_id                              BigInt
  created_by                            BigInt?
  updated_by                            BigInt?
  last_engaged_at                       DateTime              @db.DateTime(0)
  created_at                            DateTime              @db.DateTime(0)
  updated_at                            DateTime              @db.DateTime(0)
  flags_count                           Int                   @default(0)
  is_marked_as_answered                 Boolean               @default(false)
  marked_answered_by                    BigInt?
  is_link_preview_enabled               Boolean               @default(true)
  poll_configurations                   poll_configurations[]
  poll_options                          poll_options[]
  post_replies                          post_replies[]
  users_posts_created_byTousers         users?                @relation("posts_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_036eff4c65")
  forums                                forums                @relation(fields: [forum_id], references: [id], onDelete: Cascade, map: "fk_rails_27a284872f")
  users_posts_marked_answered_byTousers users?                @relation("posts_marked_answered_byTousers", fields: [marked_answered_by], references: [id], map: "fk_rails_6b3900d42f")
  users_posts_updated_byTousers         users?                @relation("posts_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_ad35ec03e3")
  organizations                         organizations         @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_eb7f8546a1")

  @@index([created_by], map: "fk_rails_036eff4c65")
  @@index([marked_answered_by], map: "fk_rails_6b3900d42f")
  @@index([updated_by], map: "fk_rails_ad35ec03e3")
  @@index([forum_id], map: "index_posts_on_forum_id")
  @@index([forum_id, organization_id, created_by], map: "index_posts_on_forum_id_and_organization_id_and_created_by")
  @@index([organization_id], map: "index_posts_on_organization_id")
  @@index([type, organization_id, created_by], map: "index_posts_on_type_and_organization_id_and_created_by")
}

model program_enrollments {
  id                                           BigInt                       @id @default(autoincrement())
  assigned                                     Boolean                      @default(false)
  assigned_at                                  DateTime?                    @db.DateTime(0)
  enrolled                                     Boolean                      @default(false)
  enrolled_at                                  DateTime?                    @db.DateTime(0)
  started                                      Boolean                      @default(false)
  started_at                                   DateTime?                    @db.DateTime(0)
  completed                                    Boolean                      @default(false)
  completed_at                                 DateTime?                    @db.DateTime(0)
  due_date                                     DateTime?                    @db.Date
  status                                       String                       @default("NOT_STARTED") @db.VarChar(255)
  completion_percentage                        Int                          @default(0)
  total_time_spent                             Int                          @default(0)
  mentor_feedback_submitted                    Boolean                      @default(false)
  mentee_feedback_submitted                    Boolean                      @default(false)
  assigned_by                                  BigInt?
  mentee_id                                    BigInt
  mentor_id                                    BigInt?
  program_id                                   BigInt
  organization_id                              BigInt
  created_at                                   DateTime                     @db.DateTime(0)
  updated_at                                   DateTime                     @db.DateTime(0)
  prerequisite_status                          String                       @default("NOT_STARTED") @db.VarChar(255)
  milestones_completed                         Boolean                      @default(false)
  milestones_completed_at                      DateTime?                    @db.DateTime(0)
  postprogram_self_review_status               String                       @default("NOT_STARTED") @db.VarChar(255)
  postprogram_stakeholder_review_status        String                       @default("NOT_STARTED") @db.VarChar(255)
  organizations                                organizations                @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_66c237dae4")
  users_program_enrollments_assigned_byTousers users?                       @relation("program_enrollments_assigned_byTousers", fields: [assigned_by], references: [id], onUpdate: SetNull, map: "fk_rails_6ea457da3f")
  users_program_enrollments_mentee_idTousers   users                        @relation("program_enrollments_mentee_idTousers", fields: [mentee_id], references: [id], onDelete: Cascade, map: "fk_rails_72e02c9e0a")
  programs                                     programs                     @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_8aad8fc74e")
  users_program_enrollments_mentor_idTousers   users?                       @relation("program_enrollments_mentor_idTousers", fields: [mentor_id], references: [id], onUpdate: SetNull, map: "fk_rails_a728c0039b")
  program_milestone_progress                   program_milestone_progress[]

  @@unique([mentee_id, mentor_id, program_id], map: "index_on_program_enrollments_mentor_mentee_program")
  @@index([assigned_by], map: "fk_rails_6ea457da3f")
  @@index([mentor_id], map: "fk_rails_a728c0039b")
  @@index([organization_id], map: "index_program_enrollments_on_organization_id")
  @@index([program_id], map: "index_program_enrollments_on_program_id")
}

model program_goals {
  id                     BigInt                   @id @default(autoincrement())
  goal                   String                   @db.MediumText
  program_id             BigInt
  created_by             BigInt?
  created_at             DateTime                 @db.DateTime(0)
  updated_at             DateTime                 @db.DateTime(0)
  approved               Boolean                  @default(false)
  programs               programs                 @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_47859a4324")
  users                  users?                   @relation(fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_9b7f0b36ee")
  program_goals_feedback program_goals_feedback[]

  @@index([created_by], map: "fk_rails_9b7f0b36ee")
  @@index([program_id], map: "index_program_goals_on_program_id")
}

model program_goals_feedback {
  id              BigInt        @id @default(autoincrement())
  user_id         BigInt
  program_goal_id BigInt
  rating          Int           @default(0)
  feedback_type   String        @default("PRE_COMPLETION") @db.VarChar(255)
  submitted_at    DateTime      @db.DateTime(0)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_3f050e5243")
  program_goals   program_goals @relation(fields: [program_goal_id], references: [id], onDelete: Cascade, map: "fk_rails_86bd59f056")

  @@unique([program_goal_id, user_id, feedback_type], map: "program_goal_feedback_unique")
  @@index([user_id], map: "fk_rails_a694cf0491")
  @@index([program_goal_id], map: "index_program_goals_feedback_on_program_goal_id")
}

model program_mentee_feedback {
  id                                             BigInt   @id @default(autoincrement())
  curious_mindset                                Int?     @default(0)
  learning_agility                               Int?     @default(0)
  openness_to_feedback                           Int?     @default(0)
  meticulousness                                 Int?     @default(0)
  adherence_to_timelines                         Int?     @default(0)
  additional_feedback                            String?  @db.MediumText
  overall_rating                                 Decimal? @db.Decimal(10, 2)
  program_id                                     BigInt
  mentee_id                                      BigInt?
  mentor_id                                      BigInt?
  submitted_at                                   DateTime @db.DateTime(0)
  created_at                                     DateTime @db.DateTime(0)
  updated_at                                     DateTime @db.DateTime(0)
  users_program_mentee_feedback_mentee_idTousers users?   @relation("program_mentee_feedback_mentee_idTousers", fields: [mentee_id], references: [id], onDelete: Cascade, map: "fk_rails_357f62a9b2")
  users_program_mentee_feedback_mentor_idTousers users?   @relation("program_mentee_feedback_mentor_idTousers", fields: [mentor_id], references: [id], onUpdate: SetNull, map: "fk_rails_71e6cfc3f1")
  programs                                       programs @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_a2b68bb3f1")

  @@index([mentor_id], map: "fk_rails_7665e249f9")
  @@index([mentee_id], map: "fk_rails_8556664035")
  @@index([program_id], map: "index_program_mentee_feedback_on_program_id")
}

model program_mentor_feedback {
  id                                             BigInt   @id @default(autoincrement())
  rating                                         Int?
  review                                         String?  @db.MediumText
  program_id                                     BigInt
  mentee_id                                      BigInt?
  mentor_id                                      BigInt?
  submitted_at                                   DateTime @db.DateTime(0)
  created_at                                     DateTime @db.DateTime(0)
  updated_at                                     DateTime @db.DateTime(0)
  is_visible                                     Boolean  @default(true)
  programs                                       programs @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_116bf95cb9")
  users_program_mentor_feedback_mentor_idTousers users?   @relation("program_mentor_feedback_mentor_idTousers", fields: [mentor_id], references: [id], onDelete: Cascade, map: "fk_rails_7665e249f9")
  users_program_mentor_feedback_mentee_idTousers users?   @relation("program_mentor_feedback_mentee_idTousers", fields: [mentee_id], references: [id], onUpdate: SetNull, map: "fk_rails_8556664035")

  @@index([mentee_id], map: "fk_rails_357f62a9b2")
  @@index([mentor_id], map: "fk_rails_71e6cfc3f1")
  @@index([program_id], map: "index_program_mentor_feedback_on_program_id")
}

model program_milestone_item_progress {
  id                            BigInt                     @id @default(autoincrement())
  program_milestone_item_id     BigInt
  program_milestone_progress_id BigInt
  started                       Boolean                    @default(false)
  started_at                    DateTime?                  @db.DateTime(0)
  completed                     Boolean                    @default(false)
  completed_at                  DateTime?                  @db.DateTime(0)
  status                        String                     @default("NOT_STARTED") @db.VarChar(255)
  completion_percentage         Int                        @default(0)
  total_time_spent              Int                        @default(0)
  created_at                    DateTime                   @db.DateTime(0)
  updated_at                    DateTime                   @db.DateTime(0)
  program_milestone_progress    program_milestone_progress @relation(fields: [program_milestone_progress_id], references: [id], onDelete: Cascade, map: "fk_rails_7f10399c47")
  program_milestone_items       program_milestone_items    @relation(fields: [program_milestone_item_id], references: [id], onDelete: Cascade, map: "fk_rails_8852c8e125")

  @@unique([program_milestone_progress_id, program_milestone_item_id], map: "index_on_program_milestone_item_progress_parent_item")
  @@index([program_milestone_item_id], map: "index_on_program_milestone_item_progress_milestone_item")
  @@index([program_milestone_progress_id], map: "index_on_program_milestone_item_progress_milestone_progress")
}

model program_milestone_items {
  id                                              BigInt                            @id @default(autoincrement())
  program_milestone_id                            BigInt
  item_id                                         BigInt
  item_type                                       String                            @db.VarChar(255)
  sequence                                        Int                               @default(1)
  created_by                                      BigInt?
  updated_by                                      BigInt?
  created_at                                      DateTime                          @db.DateTime(0)
  updated_at                                      DateTime                          @db.DateTime(0)
  is_available                                    Boolean                           @default(true)
  program_milestone_item_progress                 program_milestone_item_progress[]
  users_program_milestone_items_updated_byTousers users?                            @relation("program_milestone_items_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_382a3d1051")
  program_milestones                              program_milestones                @relation(fields: [program_milestone_id], references: [id], onDelete: Cascade, map: "fk_rails_6274082f2e")
  users_program_milestone_items_created_byTousers users?                            @relation("program_milestone_items_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_f661dfe29f")

  @@unique([program_milestone_id, item_id, item_type], map: "index_program_milestone_items_milestone_items")
  @@index([updated_by], map: "fk_rails_382a3d1051")
  @@index([created_by], map: "fk_rails_f661dfe29f")
  @@index([item_type, item_id], map: "index_program_milestone_items_on_item")
  @@index([program_milestone_id], map: "index_program_milestone_items_on_program_milestone_id")
}

model program_milestone_progress {
  id                              BigInt                            @id @default(autoincrement())
  program_enrollment_id           BigInt
  program_milestone_id            BigInt
  started                         Boolean                           @default(false)
  started_at                      DateTime?                         @db.DateTime(0)
  completed                       Boolean                           @default(false)
  completed_at                    DateTime?                         @db.DateTime(0)
  due_date                        DateTime?                         @db.Date
  status                          String                            @default("NOT_STARTED") @db.VarChar(255)
  completion_percentage           Int                               @default(0)
  total_time_spent                Int                               @default(0)
  created_at                      DateTime                          @db.DateTime(0)
  updated_at                      DateTime                          @db.DateTime(0)
  program_milestone_item_progress program_milestone_item_progress[]
  program_enrollments             program_enrollments               @relation(fields: [program_enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_54a554ba41")
  program_milestones              program_milestones                @relation(fields: [program_milestone_id], references: [id], onDelete: Cascade, map: "fk_rails_67b364173a")

  @@unique([program_enrollment_id, program_milestone_id], map: "index_on_program_milestone_progress_enrollment_milestone")
  @@index([program_enrollment_id], map: "index_program_milestone_progress_on_program_enrollment_id")
  @@index([program_milestone_id], map: "index_program_milestone_progress_on_program_milestone_id")
}

model program_milestones {
  id                                         BigInt                       @id @default(autoincrement())
  title                                      String                       @db.VarChar(255)
  is_prerequisite                            Boolean                      @default(false)
  due_in_x_days                              Int?
  due_date                                   DateTime?                    @db.Date
  sequence                                   Int                          @default(1)
  items_count                                Int                          @default(0)
  created_by                                 BigInt?
  updated_by                                 BigInt?
  program_id                                 BigInt
  created_at                                 DateTime                     @db.DateTime(0)
  updated_at                                 DateTime                     @db.DateTime(0)
  program_milestone_items                    program_milestone_items[]
  program_milestone_progress                 program_milestone_progress[]
  programs                                   programs                     @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_39c6384c03")
  users_program_milestones_updated_byTousers users?                       @relation("program_milestones_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_4f88ee1e06")
  users_program_milestones_created_byTousers users?                       @relation("program_milestones_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_9eb5076155")

  @@index([updated_by], map: "fk_rails_4f88ee1e06")
  @@index([created_by], map: "fk_rails_9eb5076155")
  @@index([program_id], map: "index_program_milestones_on_program_id")
}

model program_prerequisites {
  id         BigInt   @id @default(autoincrement())
  title      String   @db.VarChar(255)
  type       String   @db.VarChar(255)
  created_at DateTime @db.DateTime(0)
  updated_at DateTime @db.DateTime(0)
  sequence   Int      @default(1)

  @@unique([title, type], map: "index_program_prerequisites_on_title_and_type")
}

model program_settings {
  id                                      BigInt   @id @default(autoincrement())
  program_id                              BigInt
  accessibility                           String   @default("PUBLIC") @db.VarChar(255)
  roles_defined_by                        String   @default("USERS") @db.VarChar(255)
  pairing_configured_by                   String   @default("MENTEES_WITH_MENTOR_APPROVAL") @db.VarChar(255)
  max_mentee_count_per_mentor             Int      @default(1)
  allow_mentors_to_edit_program_templates Boolean  @default(true)
  allow_mentees_to_change_mentor          Boolean  @default(true)
  exit_program_permission                 String   @default("NONE") @db.VarChar(255)
  allow_goal_configuration                Boolean  @default(true)
  allow_managers_to_attend_meetings       Boolean  @default(true)
  is_manager_meeting_attendance_mandatory Boolean  @default(true)
  created_at                              DateTime @db.DateTime(0)
  updated_at                              DateTime @db.DateTime(0)
  programs                                programs @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_cfe06ab482")

  @@index([program_id], map: "index_program_settings_on_program_id")
}

model program_stakeholders {
  id                             BigInt   @id @default(autoincrement())
  stakeholder_id                 BigInt
  program_id                     BigInt
  action                         String   @default("GOAL_FEEDBACK") @db.VarChar(255)
  created_at                     DateTime @db.DateTime(0)
  updated_at                     DateTime @db.DateTime(0)
  role                           String   @db.VarChar(255)
  preprogram_feedback_completed  Boolean  @default(false)
  postprogram_feedback_completed Boolean  @default(false)
  status                         String   @default("PENDING") @db.VarChar(255)
  programs                       programs @relation(fields: [program_id], references: [id], onDelete: Cascade, map: "fk_rails_7c2bda2b9d")
  users                          users    @relation(fields: [stakeholder_id], references: [id], onDelete: Cascade, map: "fk_rails_ca16147904")

  @@unique([stakeholder_id, program_id, role], map: "program_stakeholder_unique")
  @@index([program_id], map: "index_program_stakeholders_on_program_id")
}

model programs {
  id                                                  BigInt                    @id @default(autoincrement())
  title                                               String                    @db.VarChar(255)
  description                                         String                    @db.MediumText
  long_description                                    String                    @db.MediumText
  start_date                                          DateTime?                 @db.Date
  evaluate_in_x_days                                  Int?
  evaluation_date                                     DateTime?                 @db.Date
  status                                              String                    @default("DRAFT") @db.VarChar(255)
  type                                                String                    @db.VarChar(255)
  organization_id                                     BigInt
  owner_id                                            BigInt?
  mentor_program_id                                   BigInt?
  parent_program_id                                   BigInt?
  skills_count                                        Int                       @default(0)
  goals_count                                         Int                       @default(0)
  milestones_count                                    Int                       @default(0)
  created_by                                          BigInt?
  updated_by                                          BigInt?
  created_at                                          DateTime                  @db.DateTime(0)
  updated_at                                          DateTime                  @db.DateTime(0)
  mentorship_requests                                 mentorship_requests[]
  program_enrollments                                 program_enrollments[]
  program_goals                                       program_goals[]
  program_mentee_feedback                             program_mentee_feedback[]
  program_mentor_feedback                             program_mentor_feedback[]
  program_milestones                                  program_milestones[]
  program_settings                                    program_settings[]
  program_stakeholders                                program_stakeholders[]
  organizations                                       organizations             @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_0586629141")
  programs_programs_parent_program_idToprograms       programs?                 @relation("programs_parent_program_idToprograms", fields: [parent_program_id], references: [id], onDelete: Cascade, map: "fk_rails_36c1dc7aad")
  other_programs_programs_parent_program_idToprograms programs[]                @relation("programs_parent_program_idToprograms")
  users_programs_owner_idTousers                      users?                    @relation("programs_owner_idTousers", fields: [owner_id], references: [id], onDelete: Cascade, map: "fk_rails_556def6890")
  programs_programs_mentor_program_idToprograms       programs?                 @relation("programs_mentor_program_idToprograms", fields: [mentor_program_id], references: [id], onUpdate: SetNull, map: "fk_rails_570093c6e8")
  other_programs_programs_mentor_program_idToprograms programs[]                @relation("programs_mentor_program_idToprograms")
  users_programs_created_byTousers                    users?                    @relation("programs_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_6d453028fe")
  users_programs_updated_byTousers                    users?                    @relation("programs_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_7e05c0d2b8")

  @@index([parent_program_id], map: "fk_rails_36c1dc7aad")
  @@index([owner_id], map: "fk_rails_556def6890")
  @@index([mentor_program_id], map: "fk_rails_570093c6e8")
  @@index([created_by], map: "fk_rails_6d453028fe")
  @@index([updated_by], map: "fk_rails_7e05c0d2b8")
  @@index([organization_id], map: "index_programs_on_organization_id")
  @@index([type, organization_id], map: "index_programs_on_type_and_organization_id")
}

model properties {
  id          BigInt   @id @default(autoincrement())
  prop_name   String   @db.VarChar(255)
  prop_value  String?  @db.Text
  source_type String?  @db.VarChar(255)
  source_id   BigInt?
  created_at  DateTime @db.DateTime(0)
  updated_at  DateTime @db.DateTime(0)

  @@unique([prop_name, source_type, source_id], map: "index_properties_on_prop_name_and_source_type_and_source_id")
  @@index([source_type, source_id], map: "index_properties_on_source_type_and_source_id")
}

model provider_properties {
  id                       BigInt                 @id @default(autoincrement())
  prop_name                String                 @db.VarChar(255)
  prop_value               String                 @db.VarChar(255)
  environment              String                 @db.VarChar(255)
  organization_provider_id BigInt
  created_at               DateTime               @db.DateTime(0)
  updated_at               DateTime               @db.DateTime(0)
  organization_providers   organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_9d3344e603")

  @@unique([prop_name, environment, organization_provider_id], map: "unique_provider_properties_organization")
  @@index([organization_provider_id], map: "index_provider_properties_on_organization_provider_id")
}

model providers {
  id                     BigInt                   @id @default(autoincrement())
  provider_type          String                   @db.VarChar(255)
  auth_mechanism         String                   @db.VarChar(255)
  name                   String                   @db.VarChar(255)
  created_at             DateTime                 @db.DateTime(0)
  updated_at             DateTime                 @db.DateTime(0)
  sync_supported         Boolean
  sequence               Int                      @default(1)
  organization_providers organization_providers[]

  @@unique([name, provider_type], map: "index_providers_on_name_and_provider_type")
}

model question_trackers {
  id            BigInt       @id @default(autoincrement())
  enrollment_id BigInt?
  question_id   BigInt?
  question_type String       @db.VarChar(64)
  correct       Boolean?
  created_at    DateTime     @db.DateTime(0)
  updated_at    DateTime     @db.DateTime(0)
  questions     questions?   @relation(fields: [question_id], references: [id], onDelete: Cascade, map: "fk_rails_bbae860e48")
  enrollments   enrollments? @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_d560439e95")

  @@unique([enrollment_id, question_id], map: "index_question_trackers_on_enrollment_id_and_question_id")
  @@index([enrollment_id], map: "index_question_trackers_on_enrollment_id")
  @@index([question_id], map: "index_question_trackers_on_question_id")
}

model questions {
  id                                BigInt                      @id @default(autoincrement())
  question                          String                      @db.Text
  question_type                     String                      @db.VarChar(64)
  shuffle_answers                   Boolean                     @default(true)
  correct_response                  String?                     @db.Text
  incorrect_response                String?                     @db.Text
  assessment_id                     BigInt
  created_at                        DateTime                    @db.DateTime(0)
  updated_at                        DateTime                    @db.DateTime(0)
  customize_response                Boolean?                    @default(false)
  created_by                        BigInt?
  updated_by                        BigInt?
  sequence                          Int?
  answers                           answers[]
  question_trackers                 question_trackers[]
  users_questions_updated_byTousers users?                      @relation("questions_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_043c5d237a")
  users_questions_created_byTousers users?                      @relation("questions_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_bfe2097d67")
  assessments                       assessments                 @relation(fields: [assessment_id], references: [id], onDelete: Cascade, map: "fk_rails_ed899323ab")
  user_assessment_questions         user_assessment_questions[]

  @@index([updated_by], map: "fk_rails_043c5d237a")
  @@index([created_by], map: "fk_rails_bfe2097d67")
  @@index([assessment_id], map: "index_questions_on_assessment_id")
}

model reactions {
  id             BigInt           @id @default(autoincrement())
  name           String           @db.VarChar(64)
  user_reactions user_reactions[]

  @@index([name], map: "index_reactions_on_name")
}

model reminders {
  id                 BigInt   @id @default(autoincrement())
  time_in_mins       Int
  source_id          Int
  source_type        String   @db.VarChar(255)
  created_at         DateTime @db.DateTime(0)
  updated_at         DateTime @db.DateTime(0)
  request_time_value Int
  request_time_unit  String   @db.VarChar(255)
  trigger_at         DateTime @default(now()) @db.Timestamp(0)

  @@index([source_id, source_type], map: "index_reminders_on_source_id_and_source_type")
}

model report_sources {
  id          BigInt   @id @default(autoincrement())
  source_id   BigInt
  source_type String   @db.VarChar(255)
  report_id   BigInt?
  created_at  DateTime @db.DateTime(0)
  updated_at  DateTime @db.DateTime(0)
  reports     reports? @relation(fields: [report_id], references: [id], onDelete: Cascade, map: "fk_rails_9bf0301f2f")

  @@unique([source_id, source_type, report_id], map: "index_report_sources_on_source_id_and_source_type_and_report_id")
  @@index([report_id], map: "index_report_sources_on_report_id")
  @@index([source_id, source_type], map: "index_report_sources_on_source_id_and_source_type")
}

model reportees {
  id                                 BigInt        @id @default(autoincrement())
  reportee_id                        BigInt
  manager_id                         BigInt
  organization_id                    BigInt
  created_at                         DateTime      @db.DateTime(0)
  updated_at                         DateTime      @db.DateTime(0)
  organizations                      organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_65451c5e96")
  users_reportees_reportee_idTousers users         @relation("reportees_reportee_idTousers", fields: [reportee_id], references: [id], onDelete: Cascade, map: "fk_rails_7119070609")
  users_reportees_manager_idTousers  users         @relation("reportees_manager_idTousers", fields: [manager_id], references: [id], onDelete: Cascade, map: "fk_rails_cbdec8dae7")

  @@unique([reportee_id, manager_id, organization_id], map: "index_reportee_manager_organization")
  @@index([manager_id], map: "index_reportees_on_manager_id")
  @@index([organization_id], map: "index_reportees_on_organization_id")
  @@index([reportee_id], map: "index_reportees_on_reportee_id")
}

model reporting_manager_relations {
  id                                                  BigInt        @id @default(autoincrement())
  manager_id                                          BigInt
  user_id                                             BigInt
  organization_id                                     BigInt
  source_id                                           BigInt
  source_type                                         String        @db.VarChar(255)
  created_at                                          DateTime      @db.DateTime(0)
  updated_at                                          DateTime      @db.DateTime(0)
  users_reporting_manager_relations_manager_idTousers users         @relation("reporting_manager_relations_manager_idTousers", fields: [manager_id], references: [id], onDelete: Cascade, map: "fk_rails_01c417c761")
  organizations                                       organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_18a9893e4c")
  users_reporting_manager_relations_user_idTousers    users         @relation("reporting_manager_relations_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_b5e4403508")

  @@unique([manager_id, source_type, source_id, user_id], map: "index_reporting_manager_relations_on_manager_source_user")
  @@index([manager_id], map: "index_reporting_manager_relations_on_manager_id")
  @@index([organization_id], map: "index_reporting_manager_relations_on_organization_id")
  @@index([source_type, source_id], map: "index_reporting_manager_relations_on_source_id_source_type")
  @@index([user_id], map: "index_reporting_manager_relations_on_user_id")
}

model reports {
  id                 BigInt            @id @default(autoincrement())
  category           String            @default("ORGANIZATION") @db.VarChar(32)
  url                String            @db.Text
  format             String            @db.VarChar(16)
  filename           String?           @db.VarChar(255)
  requested_at       DateTime          @db.DateTime(0)
  additional_info    String?           @db.Text
  organization_id    BigInt?
  created_at         DateTime          @db.DateTime(0)
  updated_at         DateTime          @db.DateTime(0)
  content_type       String?           @db.VarChar(255)
  size               BigInt?
  requested_by       BigInt?
  schedule_report_id BigInt?
  start_date         DateTime?         @db.Date
  end_date           DateTime?         @db.Date
  report_sources     report_sources[]
  users              users?            @relation(fields: [requested_by], references: [id], onUpdate: SetNull, map: "fk_rails_9548e98d49")
  organizations      organizations?    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_c912a99069")
  schedule_reports   schedule_reports? @relation(fields: [schedule_report_id], references: [id], onUpdate: SetNull, map: "fk_rails_f12a3816b8")

  @@index([schedule_report_id], map: "fk_rails_f12a3816b8")
  @@index([organization_id], map: "index_reports_on_organization_id")
  @@index([requested_by, schedule_report_id], map: "index_reports_on_requested_by_and_schedule_report_id")
}

model schedule_report_sources {
  id                 BigInt            @id @default(autoincrement())
  source_id          BigInt
  source_type        String            @db.VarChar(255)
  schedule_report_id BigInt?
  created_at         DateTime          @db.DateTime(0)
  updated_at         DateTime          @db.DateTime(0)
  schedule_reports   schedule_reports? @relation(fields: [schedule_report_id], references: [id], onDelete: Cascade, map: "fk_rails_4e5e3bd09a")

  @@unique([source_id, source_type, schedule_report_id], map: "index_schedule_report_sources_on_source_and_schedule_report_id")
  @@index([schedule_report_id], map: "index_schedule_report_sources_on_schedule_report_id")
  @@index([source_id, source_type], map: "index_schedule_report_sources_on_source_id_and_source_type")
}

model schedule_reports {
  id                      BigInt                    @id @default(autoincrement())
  name                    String                    @db.Text
  category                String                    @default("ORGANIZATION") @db.VarChar(255)
  run_every_x_days        Int                       @default(0)
  run_from_date           DateTime                  @db.Date
  run_on_date             DateTime                  @db.Date
  last_ran_on_date        DateTime                  @db.DateTime(0)
  schedule_frequency_info String?                   @db.Text
  scheduled               Boolean                   @default(false)
  user_id                 BigInt?
  status                  String                    @default("ACTIVE") @db.VarChar(16)
  created_at              DateTime                  @db.DateTime(0)
  updated_at              DateTime                  @db.DateTime(0)
  additional_info         String?                   @db.MediumText
  start_date              DateTime?                 @db.Date
  end_date                DateTime?                 @db.Date
  organization_id         BigInt?
  reports                 reports[]
  schedule_report_sources schedule_report_sources[]
  users                   users?                    @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_0656b2a760")
  organizations           organizations?            @relation(fields: [organization_id], references: [id], onUpdate: SetNull, map: "fk_rails_a8f44a3bb6")

  @@index([organization_id], map: "index_schedule_reports_on_organization_id")
  @@index([user_id], map: "index_schedule_reports_on_user_id")
}

model schema_migrations {
  version String @id @db.VarChar(255)
}

model search_terms {
  id              BigInt         @id @default(autoincrement())
  term            String         @db.VarChar(255)
  result_count    Int?
  performer_id    BigInt?
  created_at      DateTime       @db.DateTime(0)
  updated_at      DateTime       @db.DateTime(0)
  source          String         @default("Course") @db.VarChar(255)
  organization_id BigInt?
  users           users?         @relation(fields: [performer_id], references: [id], onUpdate: SetNull, map: "fk_rails_17344023f3")
  organizations   organizations? @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_254ab43904")

  @@index([organization_id], map: "index_search_terms_on_organization_id")
  @@index([performer_id], map: "index_search_terms_on_performer_id")
  @@index([source, created_at], map: "index_search_terms_on_source_and_created_at")
}

model service_accounts {
  id              BigInt        @id @default(autoincrement())
  name            String        @db.VarChar(255)
  description     String?       @db.VarChar(255)
  app_key         String        @db.VarChar(255)
  app_secret      String        @db.VarChar(255)
  active          Boolean       @default(true)
  source_id       BigInt?
  source_type     String?       @db.VarChar(255)
  organization_id BigInt
  user_id         BigInt?
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  users           users?        @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_61fae97f06")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_cf1933d7c1")

  @@unique([app_key, app_secret], map: "index_service_accounts_on_app_key_and_app_secret")
  @@index([organization_id], map: "index_service_accounts_on_organization_id")
  @@index([source_id, source_type], map: "index_service_accounts_on_source_id_and_source_type")
  @@index([user_id], map: "index_service_accounts_on_user_id")
}

model shared_enrollments {
  id              BigInt        @id @default(autoincrement())
  enrollment_id   BigInt
  organization_id BigInt
  user_id         BigInt
  user_account_id BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_28478611e6")
  user_accounts   user_accounts @relation(fields: [user_account_id], references: [id], onDelete: Cascade, map: "fk_rails_34aa661113")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_9b61f53de6")
  enrollments     enrollments   @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_ece3c3cad2")

  @@unique([enrollment_id, user_account_id], map: "index_on_enrollments_accounts_shared_entities")
  @@index([enrollment_id], map: "index_shared_enrollments_on_enrollment_id")
  @@index([organization_id], map: "index_shared_enrollments_on_organization_id")
  @@index([organization_id, enrollment_id], map: "index_shared_enrollments_on_organization_id_and_enrollment_id")
  @@index([user_account_id], map: "index_shared_enrollments_on_user_account_id")
  @@index([user_id], map: "index_shared_enrollments_on_user_id")
  @@index([user_id, enrollment_id], map: "index_shared_enrollments_on_user_id_and_enrollment_id")
}

model shared_entities {
  id              BigInt        @id @default(autoincrement())
  organization_id BigInt
  source_id       BigInt
  source_type     String        @db.VarChar(255)
  medium_id       BigInt?
  medium_type     String?       @db.VarChar(255)
  can_view        Boolean       @default(true)
  can_edit        Boolean       @default(false)
  can_destroy     Boolean       @default(false)
  can_share       Boolean       @default(true)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_02d3affef9")

  @@unique([organization_id, source_id, source_type, medium_id, medium_type], map: "index_shared_entities_unique_index")
  @@index([medium_id, medium_type], map: "index_shared_entities_on_medium_id_and_medium_type")
  @@index([organization_id], map: "index_shared_entities_on_organization_id")
  @@index([source_id, source_type], map: "index_shared_entities_on_source_id_and_source_type")
}

model shipments {
  id                       BigInt                 @id @default(autoincrement())
  name                     String                 @db.VarChar(255)
  image_url                String?                @db.VarChar(255)
  external_id              String                 @db.VarChar(255)
  active                   Boolean                @default(true)
  sku                      String                 @db.VarChar(255)
  shipment_category        String?                @db.VarChar(255)
  shipment_type            String?                @db.VarChar(255)
  count_in_hand            Int                    @default(0)
  organization_provider_id BigInt
  created_at               DateTime               @db.DateTime(0)
  updated_at               DateTime               @db.DateTime(0)
  price                    Decimal                @default(0.00) @db.Decimal(10, 2)
  currency                 String                 @default("USD") @db.VarChar(255)
  organization_providers   organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_af920250d2")
  shipped_items            shipped_items[]
  training_shipments       training_shipments[]

  @@unique([external_id, organization_provider_id], map: "index_shipments_on_external_id_and_organization_provider_id")
  @@index([external_id], map: "index_shipments_on_external_id")
  @@index([organization_provider_id], map: "index_shipments_on_organization_provider_id")
}

model shipped_items {
  id                BigInt          @id @default(autoincrement())
  source_id         BigInt
  source_type       String          @db.VarChar(255)
  shipment_id       BigInt
  status            String          @default("PENDING") @db.VarChar(255)
  quantity          Int             @default(1)
  order_shipment_id BigInt
  price             Decimal         @default(0.00) @db.Decimal(10, 2)
  currency          String          @default("USD") @db.VarChar(255)
  medium_id         BigInt?
  medium_type       String?         @db.VarChar(255)
  order_shipments   order_shipments @relation(fields: [order_shipment_id], references: [id], onDelete: Cascade, map: "fk_rails_08965e1e35")
  shipments         shipments       @relation(fields: [shipment_id], references: [id], onDelete: Cascade, map: "fk_rails_35964ea813")

  @@index([medium_id, medium_type], map: "index_shipped_items_on_medium_id_and_medium_type")
  @@index([order_shipment_id], map: "index_shipped_items_on_order_shipment_id")
  @@index([shipment_id], map: "index_shipped_items_on_shipment_id")
  @@index([shipment_id, source_id, source_type, medium_id, medium_type], map: "index_shipped_items_on_shipment_source_medium")
  @@index([source_id, source_type], map: "index_shipped_items_on_source_id_and_source_type")
  @@index([source_id, source_type, shipment_id], map: "index_source_shipment")
}

model skill_metrics {
  id            BigInt @id @default(autoincrement())
  skill_id      BigInt
  mentors_count Int    @default(0)
  mentees_count Int    @default(0)
  skills        skills @relation(fields: [skill_id], references: [id], onDelete: Cascade, map: "fk_rails_65562ccf79")

  @@index([skill_id], map: "index_skill_metrics_on_skill_id")
}

model skills {
  id              BigInt          @id @default(autoincrement())
  name            String          @db.VarChar(255)
  organization_id BigInt
  created_at      DateTime        @db.DateTime(0)
  updated_at      DateTime        @db.DateTime(0)
  skill_metrics   skill_metrics[]
  organizations   organizations   @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_befcd0faff")
  source_skills   source_skills[]
  user_skills     user_skills[]

  @@index([organization_id], map: "index_skills_on_organization_id")
}

model slots {
  id              BigInt         @id @default(autoincrement())
  user_id         BigInt
  organization_id BigInt
  day_week        String         @db.VarChar(255)
  available       Boolean        @default(true)
  preferences     String?        @db.Text
  duration        BigInt?        @default(0)
  created_at      DateTime       @db.DateTime(0)
  updated_at      DateTime       @db.DateTime(0)
  booked_slots    booked_slots[]
  users           users          @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_6772f242fe")
  organizations   organizations  @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_997610d5af")

  @@unique([user_id, organization_id, day_week], map: "index_slots_on_user_id_and_organization_id_and_day_week")
  @@index([organization_id], map: "index_slots_on_organization_id")
  @@index([user_id], map: "index_slots_on_user_id")
}

model social_groups {
  id              BigInt        @id @default(autoincrement())
  name            String        @db.VarChar(64)
  organization_id BigInt
  is_system       Boolean       @default(true)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4dc6280f0e")

  @@unique([organization_id, name], map: "index_social_groups_on_organization_id_and_name")
  @@index([name], map: "index_social_groups_on_name")
  @@index([organization_id], map: "index_social_groups_on_organization_id")
}

model source_skills {
  id                     BigInt                   @id @default(autoincrement())
  skill_id               BigInt
  source_id              BigInt
  source_type            String                   @db.VarChar(255)
  created_at             DateTime                 @db.DateTime(0)
  updated_at             DateTime                 @db.DateTime(0)
  skills                 skills                   @relation(fields: [skill_id], references: [id], onDelete: Cascade, map: "fk_rails_0e5ccd5370")
  source_skills_feedback source_skills_feedback[]

  @@unique([source_id, source_type, skill_id], map: "index_source_skills_on_source_id_and_source_type_and_skill_id")
  @@index([skill_id], map: "index_source_skills_on_skill_id")
  @@index([source_id, source_type], map: "index_source_skills_on_source_id_and_source_type")
}

model source_skills_feedback {
  id                                              BigInt        @id @default(autoincrement())
  source_skill_id                                 BigInt
  rating                                          Int?
  proficiency                                     String        @db.VarChar(255)
  user_id                                         BigInt
  reviewed_by                                     BigInt?
  reviewed_at                                     DateTime      @db.DateTime(0)
  created_at                                      DateTime      @db.DateTime(0)
  updated_at                                      DateTime      @db.DateTime(0)
  users_source_skills_feedback_reviewed_byTousers users?        @relation("source_skills_feedback_reviewed_byTousers", fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_46fad5b526")
  source_skills                                   source_skills @relation(fields: [source_skill_id], references: [id], onDelete: Cascade, map: "fk_rails_4d8097406f")
  users_source_skills_feedback_user_idTousers     users         @relation("source_skills_feedback_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_8514c5b0b0")

  @@unique([source_skill_id, user_id], map: "skills_feedback_unique")
  @@index([reviewed_by], map: "fk_rails_46fad5b526")
  @@index([source_skill_id], map: "index_source_skills_feedback_on_source_skill_id")
  @@index([user_id], map: "index_source_skills_feedback_on_user_id")
}

model source_teams {
  id          BigInt   @id @default(autoincrement())
  team_id     BigInt
  created_at  DateTime @db.DateTime(0)
  updated_at  DateTime @db.DateTime(0)
  source_id   BigInt
  team_name   String   @db.VarChar(255)
  source_type String   @default("Course") @db.VarChar(255)
  teams       teams    @relation(fields: [team_id], references: [id], onDelete: Cascade, map: "fk_rails_50fcb8f39a")

  @@unique([team_id, source_id, source_type], map: "index_source_teams_on_team_id_and_source_id_and_source_type")
  @@index([source_id, source_type], map: "index_source_teams_on_source_id_and_source_type")
  @@index([team_id], map: "index_source_teams_on_team_id")
}

model source_visibility {
  id              BigInt        @id @default(autoincrement())
  user_id         BigInt?
  source_id       BigInt
  source_type     String        @db.VarChar(255)
  medium_id       BigInt?
  medium_type     String?       @db.VarChar(255)
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  users           users?        @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_d8bf941708")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "index_source_visibility_on_organization_id")

  @@unique([user_id, source_id, source_type, medium_id, medium_type], map: "index_source_visibility_unique_index")
  @@index([medium_id, medium_type], map: "index_source_visibility_on_medium_id_and_medium_type")
  @@index([organization_id], map: "index_source_visibility_on_organization_id")
  @@index([source_id, source_type], map: "index_source_visibility_on_source_id_and_source_type")
  @@index([user_id], map: "index_source_visibility_on_user_id")
}

model sso_requests {
  id                                                                          BigInt                 @id @default(autoincrement())
  request_id                                                                  String                 @db.VarChar(255)
  status                                                                      String                 @default("INITIATED") @db.VarChar(255)
  response                                                                    String?                @db.Text
  user_id                                                                     BigInt?
  user_account_id                                                             BigInt?
  user_access_token_id                                                        BigInt?
  generic_access_token_id                                                     BigInt?
  organization_provider_id                                                    BigInt
  created_at                                                                  DateTime               @db.DateTime(0)
  updated_at                                                                  DateTime               @db.DateTime(0)
  user_accounts                                                               user_accounts?         @relation(fields: [user_account_id], references: [id], onDelete: Cascade, map: "fk_rails_032e73bf28")
  users                                                                       users?                 @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_52ff939a9a")
  user_access_tokens_sso_requests_user_access_token_idTouser_access_tokens    user_access_tokens?    @relation("sso_requests_user_access_token_idTouser_access_tokens", fields: [user_access_token_id], references: [id], onUpdate: SetNull, map: "fk_rails_68992501f0")
  user_access_tokens_sso_requests_generic_access_token_idTouser_access_tokens user_access_tokens?    @relation("sso_requests_generic_access_token_idTouser_access_tokens", fields: [generic_access_token_id], references: [id], onUpdate: SetNull, map: "fk_rails_acd4c27d91")
  organization_providers                                                      organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_e564c20d6d")

  @@index([generic_access_token_id], map: "index_sso_requests_on_generic_access_token_id")
  @@index([organization_provider_id], map: "index_sso_requests_on_organization_provider_id")
  @@index([request_id], map: "index_sso_requests_on_request_id")
  @@index([user_access_token_id], map: "index_sso_requests_on_user_access_token_id")
  @@index([user_account_id], map: "index_sso_requests_on_user_account_id")
  @@index([user_id], map: "index_sso_requests_on_user_id")
}

model stores {
  id               BigInt         @id @default(autoincrement())
  organization_id  BigInt?
  web_url          String?        @db.VarChar(255)
  store_url        String?        @db.VarChar(255)
  meta_title       String?        @db.VarChar(255)
  meta_description String?        @db.Text
  support_email_id String?        @db.VarChar(255)
  support_contact  String?        @db.VarChar(15)
  widget_id        String         @db.VarChar(16)
  created_at       DateTime       @db.DateTime(0)
  updated_at       DateTime       @db.DateTime(0)
  organizations    organizations? @relation(fields: [organization_id], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_rails_7d5249b49d")

  @@index([organization_id], map: "index_stores_on_organization_id")
}

model submission_reviews {
  id                  BigInt      @id @default(autoincrement())
  level               Int         @default(1)
  status              String      @default("IN_PROGRESS") @db.VarChar(255)
  review_started      Boolean     @default(false)
  review_started_at   DateTime    @db.DateTime(0)
  review_completed    Boolean     @default(false)
  review_completed_at DateTime?   @db.DateTime(0)
  score               Int?
  feedback            String?     @db.Text
  reviewed_by         BigInt?
  submission_id       BigInt
  created_at          DateTime    @db.DateTime(0)
  updated_at          DateTime    @db.DateTime(0)
  submissions         submissions @relation(fields: [submission_id], references: [id], onDelete: Cascade, map: "fk_rails_13e29c743c")
  users               users?      @relation(fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_de5b28a6ca")

  @@index([reviewed_by], map: "fk_rails_de5b28a6ca")
  @@index([submission_id], map: "index_submission_reviews_on_submission_id")
}

model submissions {
  id                                   BigInt                       @id @default(autoincrement())
  source_type                          String                       @db.VarChar(255)
  source_id                            BigInt
  module                               String                       @db.VarChar(255)
  attempt                              Int                          @default(1)
  status                               String                       @default("PENDING") @db.VarChar(255)
  user_id                              BigInt?
  organization_id                      BigInt
  submitted_at                         DateTime                     @db.DateTime(0)
  review_started_at                    DateTime?                    @db.DateTime(0)
  review_completed_at                  DateTime?                    @db.DateTime(0)
  reviewed_by                          BigInt?
  created_at                           DateTime                     @db.DateTime(0)
  updated_at                           DateTime                     @db.DateTime(0)
  levels                               Int                          @default(1) @db.TinyInt
  latest                               Boolean                      @default(true)
  checklist_user_submissions           checklist_user_submissions[]
  submission_reviews                   submission_reviews[]
  users_submissions_user_idTousers     users?                       @relation("submissions_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_8d85741475")
  users_submissions_reviewed_byTousers users?                       @relation("submissions_reviewed_byTousers", fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_c0e30e9456")
  organizations                        organizations                @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_c82b273c72")

  @@index([reviewed_by], map: "fk_rails_c0e30e9456")
  @@index([organization_id], map: "index_submissions_on_organization_id")
  @@index([source_id, source_type], map: "index_submissions_on_source_id_and_source_type")
  @@index([user_id], map: "index_submissions_on_user_id")
}

model support_requests {
  id                    BigInt        @id @default(autoincrement())
  from                  String        @db.VarChar(255)
  subject               String        @db.VarChar(128)
  body                  String?       @db.Text
  name                  String        @default("GENERAL_QUERIES") @db.VarChar(128)
  status                String        @default("IN_PROGRESS") @db.VarChar(32)
  ticket_id             String?       @db.VarChar(16)
  organization_id       BigInt
  user_id               BigInt?
  created_at            DateTime      @db.DateTime(0)
  updated_at            DateTime      @db.DateTime(0)
  is_debug_log_attached Boolean       @default(false)
  users                 users?        @relation(fields: [user_id], references: [id], onUpdate: SetNull, map: "fk_rails_03ae9ca37e")
  organizations         organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4483697bfc")

  @@index([organization_id], map: "index_support_requests_on_organization_id")
  @@index([user_id], map: "index_support_requests_on_user_id")
}

model survey_metrics {
  id                    BigInt   @id @default(autoincrement())
  completions_count     Int      @default(0)
  total_consumers_count Int      @default(0)
  survey_id             BigInt
  created_at            DateTime @db.DateTime(0)
  updated_at            DateTime @db.DateTime(0)
  surveys               surveys  @relation(fields: [survey_id], references: [id], onDelete: Cascade, map: "fk_rails_7e3fe5f40b")

  @@index([survey_id], map: "index_survey_metrics_on_survey_id")
}

model survey_questions {
  id                                       BigInt                  @id @default(autoincrement())
  question                                 String                  @db.Text
  question_type                            String                  @db.VarChar(255)
  sequence                                 Int                     @default(1)
  mandatory                                Boolean                 @default(true)
  created_by                               BigInt?
  updated_by                               BigInt?
  survey_id                                BigInt
  survey_section_id                        BigInt
  created_at                               DateTime                @db.DateTime(0)
  updated_at                               DateTime                @db.DateTime(0)
  survey_sections                          survey_sections         @relation(fields: [survey_section_id], references: [id], onDelete: Cascade, map: "fk_rails_3315ba205d")
  users_survey_questions_updated_byTousers users?                  @relation("survey_questions_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_555bf21b0f")
  users_survey_questions_created_byTousers users?                  @relation("survey_questions_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_a5ccab69c9")
  surveys                                  surveys                 @relation(fields: [survey_id], references: [id], onDelete: Cascade, map: "fk_rails_d0558bfd89")
  survey_responses                         survey_responses[]
  user_survey_questions                    user_survey_questions[]

  @@index([updated_by], map: "fk_rails_555bf21b0f")
  @@index([created_by], map: "fk_rails_a5ccab69c9")
  @@index([survey_id], map: "index_survey_questions_on_survey_id")
  @@index([survey_section_id], map: "index_survey_questions_on_survey_section_id")
}

model survey_responses {
  id                                       BigInt                  @id @default(autoincrement())
  response                                 String                  @db.Text
  sequence                                 Int                     @default(1)
  created_by                               BigInt?
  updated_by                               BigInt?
  survey_question_id                       BigInt
  created_at                               DateTime                @db.DateTime(0)
  updated_at                               DateTime                @db.DateTime(0)
  survey_questions                         survey_questions        @relation(fields: [survey_question_id], references: [id], onDelete: Cascade, map: "fk_rails_2368f705b4")
  users_survey_responses_created_byTousers users?                  @relation("survey_responses_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_a7401fa40c")
  users_survey_responses_updated_byTousers users?                  @relation("survey_responses_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_bffb9cfa8c")
  user_survey_responses                    user_survey_responses[]

  @@index([created_by], map: "fk_rails_a7401fa40c")
  @@index([updated_by], map: "fk_rails_bffb9cfa8c")
  @@index([survey_question_id], map: "index_survey_responses_on_survey_question_id")
}

model survey_sections {
  id                                      BigInt             @id @default(autoincrement())
  title                                   String             @db.Text
  description                             String?            @db.MediumText
  long_description                        String?            @db.MediumText
  sequence                                Int                @default(1)
  questions_count                         Int                @default(0)
  created_by                              BigInt?
  updated_by                              BigInt?
  survey_id                               BigInt
  created_at                              DateTime           @db.DateTime(0)
  updated_at                              DateTime           @db.DateTime(0)
  survey_questions                        survey_questions[]
  users_survey_sections_updated_byTousers users?             @relation("survey_sections_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_3d436e1c29")
  users_survey_sections_created_byTousers users?             @relation("survey_sections_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_5afacbd8f3")
  surveys                                 surveys            @relation(fields: [survey_id], references: [id], onDelete: Cascade, map: "fk_rails_9b63456ac4")

  @@index([updated_by], map: "fk_rails_3d436e1c29")
  @@index([created_by], map: "fk_rails_5afacbd8f3")
  @@index([survey_id], map: "index_survey_sections_on_survey_id")
}

model surveys {
  id                              BigInt                 @id @default(autoincrement())
  source_id                       BigInt
  source_type                     String                 @db.VarChar(255)
  title                           String                 @db.Text
  sections_count                  Int                    @default(0)
  questions_count                 Int                    @default(0)
  created_by                      BigInt?
  updated_by                      BigInt?
  organization_id                 BigInt
  created_at                      DateTime               @db.DateTime(0)
  updated_at                      DateTime               @db.DateTime(0)
  survey_metrics                  survey_metrics[]
  survey_questions                survey_questions[]
  survey_sections                 survey_sections[]
  organizations                   organizations          @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_31bc4fd548")
  users_surveys_updated_byTousers users?                 @relation("surveys_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_c9d257967f")
  users_surveys_created_byTousers users?                 @relation("surveys_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_d8944d3916")
  user_survey_versions            user_survey_versions[]
  user_surveys                    user_surveys[]

  @@index([updated_by], map: "fk_rails_c9d257967f")
  @@index([created_by], map: "fk_rails_d8944d3916")
  @@index([organization_id], map: "index_surveys_on_organization_id")
  @@index([source_id, source_type], map: "index_surveys_on_source_id_and_source_type")
}

model sync_requests {
  id                 BigInt           @id @default(autoincrement())
  message            String?          @db.VarChar(255)
  completed_at       DateTime?        @db.DateTime(0)
  started_at         DateTime?        @db.DateTime(0)
  status             String           @default("Q") @db.VarChar(1)
  organization_id    BigInt
  content_partner_id BigInt
  created_at         DateTime         @db.DateTime(0)
  updated_at         DateTime         @db.DateTime(0)
  content_partners   content_partners @relation(fields: [content_partner_id], references: [id], onDelete: Cascade, map: "fk_rails_23e06ea319")
  organizations      organizations    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_7506a139f8")

  @@index([content_partner_id], map: "index_sync_requests_on_content_partner_id")
  @@index([organization_id], map: "index_sync_requests_on_organization_id")
}

model team_users {
  id              BigInt        @id @default(autoincrement())
  team_id         BigInt
  user_id         BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  user_account_id BigInt
  teams           teams         @relation(fields: [team_id], references: [id], onDelete: Cascade, map: "fk_rails_6a8dc6a6fc")
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_8b0a3daf0d")
  user_accounts   user_accounts @relation(fields: [user_account_id], references: [id], onDelete: Cascade, map: "fk_user_account_id")

  @@unique([team_id, user_id], map: "index_team_users_on_team_id_and_user_id")
  @@unique([user_id, team_id, user_account_id], map: "index_team_users_on_user_id_and_team_id_and_user_account_id")
  @@index([user_account_id], map: "fk_user_account_id")
  @@index([team_id], map: "index_team_users_on_team_id")
  @@index([user_id], map: "index_team_users_on_user_id")
}

model teams {
  id                                             BigInt                           @id @default(autoincrement())
  name                                           String                           @db.VarChar(255)
  created_at                                     DateTime                         @db.DateTime(0)
  updated_at                                     DateTime                         @db.DateTime(0)
  organization_id                                BigInt?
  image_url                                      String?                          @db.MediumText
  created_by                                     BigInt?
  updated_by                                     BigInt?
  external_id                                    String?                          @db.Text
  description                                    String?                          @db.MediumText
  team_users_count                               Int                              @default(0)
  user_roles_count                               Int                              @default(0)
  remove_incompleted_trainings_on_member_removal Boolean                          @default(false)
  source_teams                                   source_teams[]
  team_users                                     team_users[]
  users_teams_created_byTousers                  users?                           @relation("teams_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_155df162c2")
  users_teams_updated_byTousers                  users?                           @relation("teams_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_b367efffad")
  organizations                                  organizations?                   @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_f07f0bd66d")
  training_reassignments_history                 training_reassignments_history[]

  @@unique([name, organization_id], map: "index_teams_on_name_and_organization_id")
  @@index([created_by], map: "fk_rails_155df162c2")
  @@index([updated_by], map: "fk_rails_b367efffad")
  @@index([organization_id], map: "index_teams_on_organization_id")
}

model time_access_logs {
  id              BigInt        @id @default(autoincrement())
  source_type     String        @db.VarChar(255)
  source_id       Int
  start_date      DateTime      @db.DateTime(0)
  end_date        DateTime      @db.DateTime(0)
  time_spent      BigInt
  organization_id BigInt
  user_id         BigInt
  ahoy_visit_id   BigInt?
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_67413835c3")
  ahoy_visits     ahoy_visits?  @relation(fields: [ahoy_visit_id], references: [id], onUpdate: SetNull, map: "fk_rails_a51f2c02df")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_ffa0e8803d")

  @@index([ahoy_visit_id], map: "index_time_access_logs_on_ahoy_visit_id")
  @@index([organization_id], map: "index_time_access_logs_on_organization_id")
  @@index([source_id, source_type], map: "index_time_access_logs_on_source_id_and_source_type")
  @@index([user_id], map: "index_time_access_logs_on_user_id")
}

model training_metrics {
  id                BigInt        @id @default(autoincrement())
  source_id         BigInt
  source_type       String        @db.VarChar(255)
  organization_id   BigInt
  enrollments_count Int           @default(0)
  teams_count       Int           @default(0)
  average_rating    Decimal?      @db.Decimal(10, 2)
  feedback_count    Int           @default(0)
  orders_count      Int           @default(0)
  created_at        DateTime      @db.DateTime(0)
  updated_at        DateTime      @db.DateTime(0)
  organizations     organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_6aed9f5836")

  @@unique([source_id, source_type, organization_id], map: "index_on_training_metrics_source_organization")
  @@index([organization_id], map: "index_training_metrics_on_organization_id")
  @@index([source_id, source_type], map: "index_training_metrics_on_source_id_and_source_type")
}

model training_reassignments_history {
  id                  BigInt       @id @default(autoincrement())
  enrollment_id       BigInt?
  auto                Boolean      @default(false)
  reset               Boolean      @default(false)
  reassignment_type   String       @db.VarChar(128)
  reassigned_via_team Boolean      @default(false)
  team_id             BigInt?
  created_at          DateTime     @db.DateTime(0)
  updated_at          DateTime     @db.DateTime(0)
  teams               teams?       @relation(fields: [team_id], references: [id], onUpdate: SetNull, map: "fk_rails_337938bef2")
  enrollments         enrollments? @relation(fields: [enrollment_id], references: [id], onDelete: Cascade, map: "fk_rails_92b1042478")

  @@index([enrollment_id], map: "index_training_reassignments_history_on_enrollment_id")
  @@index([team_id], map: "index_training_reassignments_history_on_team_id")
}

model training_shipments {
  id          BigInt    @id @default(autoincrement())
  source_id   BigInt
  source_type String    @db.VarChar(255)
  shipment_id BigInt
  quantity    Int       @default(1)
  created_by  BigInt?
  created_at  DateTime  @db.DateTime(0)
  updated_at  DateTime  @db.DateTime(0)
  sequence    Int?
  users       users?    @relation(fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_3627dede57")
  shipments   shipments @relation(fields: [shipment_id], references: [id], onDelete: Cascade, map: "fk_rails_93ac4357a4")

  @@unique([source_id, source_type, shipment_id], map: "index_on_source_shipment")
  @@index([created_by], map: "fk_rails_3627dede57")
  @@index([shipment_id], map: "index_training_shipments_on_shipment_id")
  @@index([source_id, source_type], map: "index_training_shipments_on_source_id_and_source_type")
}

model user_access_tokens {
  id                                                                    BigInt                 @id @default(autoincrement())
  user_id                                                               BigInt
  platform                                                              String?                @default("Web") @db.VarChar(255)
  access_token                                                          String?                @db.MediumText
  active                                                                Boolean                @default(true)
  created_at                                                            DateTime               @db.DateTime(0)
  updated_at                                                            DateTime               @db.DateTime(0)
  session_id                                                            String                 @db.VarChar(255)
  organization_id                                                       BigInt?
  logged_in_via_sso                                                     Boolean                @default(false)
  implicit_login                                                        Boolean                @default(false)
  device_access_tokens                                                  device_access_tokens[]
  sso_requests_sso_requests_user_access_token_idTouser_access_tokens    sso_requests[]         @relation("sso_requests_user_access_token_idTouser_access_tokens")
  sso_requests_sso_requests_generic_access_token_idTouser_access_tokens sso_requests[]         @relation("sso_requests_generic_access_token_idTouser_access_tokens")
  users                                                                 users                  @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_01da7a5f2c")
  organizations                                                         organizations?         @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "index_user_access_tokens_on_organization_id")
  verified_sessions                                                     verified_sessions[]

  @@index([access_token(length: 256)], map: "index_user_access_tokens_on_access_token")
  @@index([organization_id], map: "index_user_access_tokens_on_organization_id")
  @@index([session_id], map: "index_user_access_tokens_on_session_id")
  @@index([user_id], map: "index_user_access_tokens_on_user_id")
}

model user_accounts {
  id                                       BigInt                       @id @default(autoincrement())
  role                                     String                       @db.VarChar(255)
  status                                   String                       @default("PENDING") @db.VarChar(255)
  designation                              String?                      @db.VarChar(255)
  invitation_created_at                    DateTime?                    @db.DateTime(0)
  invitation_sent_at                       DateTime?                    @db.DateTime(0)
  invitation_accepted_at                   DateTime?                    @db.DateTime(0)
  invited_by_type                          String?                      @db.VarChar(255)
  invitations_count                        Int?                         @default(0)
  invitation_token                         String?                      @db.VarChar(255)
  original_invitation_token                String?                      @db.VarChar(255)
  last_seen_at                             DateTime?                    @db.DateTime(0)
  sign_in_count                            Int                          @default(0)
  current_sign_in_at                       DateTime?                    @db.DateTime(0)
  current_sign_in_ip                       String?                      @db.VarChar(255)
  last_sign_in_at                          DateTime?                    @db.DateTime(0)
  last_sign_in_ip                          String?                      @db.VarChar(255)
  last_failed_attempt_at                   DateTime?                    @db.DateTime(0)
  invited_by_id                            BigInt?
  organization_id                          BigInt
  user_id                                  BigInt
  created_at                               DateTime                     @db.DateTime(0)
  updated_at                               DateTime                     @db.DateTime(0)
  can_authenticate                         Boolean                      @default(true)
  signed_up_via_sso                        Boolean                      @default(false)
  external_id                              String?                      @db.VarChar(255)
  external_source                          String?                      @db.VarChar(255)
  encrypted_otp_secret                     String?                      @db.VarChar(255)
  encrypted_otp_secret_iv                  String?                      @db.VarChar(255)
  encrypted_otp_secret_salt                String?                      @db.VarChar(255)
  consumed_timestep                        Int?
  otp_required_for_login                   Boolean?
  otp_backup_codes                         String?                      @db.Text
  is_visible                               Boolean                      @default(true)
  reportees_count                          Int                          @default(0)
  reporting_managers_count                 Int                          @default(0)
  app_user_activity                        app_user_activity[]
  authentication_attempts                  authentication_attempts[]
  channel_users                            channel_users[]
  configured_channels                      configured_channels[]
  mfa_authenticated_sessions               mfa_authenticated_sessions[]
  shared_enrollments                       shared_enrollments[]
  sso_requests                             sso_requests[]
  team_users                               team_users[]
  organizations                            organizations                @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_04fba92ab8")
  users_user_accounts_user_idTousers       users                        @relation("user_accounts_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_d64ac9bcc2")
  users_user_accounts_invited_by_idTousers users?                       @relation("user_accounts_invited_by_idTousers", fields: [invited_by_id], references: [id], onUpdate: SetNull, map: "fk_rails_e7b57fb594")

  @@unique([user_id, organization_id], map: "index_user_accounts_on_user_id_and_organization_id")
  @@index([invited_by_id], map: "index_user_accounts_on_invited_by_id")
  @@index([organization_id], map: "index_user_accounts_on_organization_id")
  @@index([user_id], map: "index_user_accounts_on_user_id")
}

model user_assessment_answers {
  id                          BigInt                    @id @default(autoincrement())
  user_assessment_question_id BigInt
  answer_id                   BigInt?
  created_at                  DateTime                  @db.DateTime(0)
  updated_at                  DateTime                  @db.DateTime(0)
  answer_text                 String?                   @db.LongText
  answers                     answers?                  @relation(fields: [answer_id], references: [id], onDelete: Cascade, map: "fk_rails_52df46e5ca")
  user_assessment_questions   user_assessment_questions @relation(fields: [user_assessment_question_id], references: [id], onDelete: Cascade, map: "fk_rails_90c6e49eda")

  @@index([answer_id], map: "index_user_assessment_answers_on_answer_id")
  @@index([user_assessment_question_id], map: "index_user_assessment_answers_on_user_assessment_question_id")
}

model user_assessment_questions {
  id                      BigInt                    @id @default(autoincrement())
  correct                 Boolean?
  question_id             BigInt
  user_assessment_id      BigInt
  created_at              DateTime                  @db.DateTime(0)
  updated_at              DateTime                  @db.DateTime(0)
  total_time_spent        BigInt                    @default(0)
  started                 Boolean                   @default(true)
  started_at              DateTime?                 @db.DateTime(0)
  completed               Boolean                   @default(false)
  completed_at            DateTime?                 @db.DateTime(0)
  feedback                String?                   @db.Text
  score                   Int?
  reviewed_by             BigInt?
  reviewed_at             DateTime?                 @db.DateTime(0)
  status                  String?                   @default("IN_PROGRESS") @db.VarChar(255)
  user_assessment_answers user_assessment_answers[]
  user_assessments        user_assessments          @relation(fields: [user_assessment_id], references: [id], onDelete: Cascade, map: "fk_rails_155ec8d31d")
  users                   users?                    @relation(fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_630d3fd5b9")
  questions               questions                 @relation(fields: [question_id], references: [id], onDelete: Cascade, map: "fk_rails_900bd2ede8")

  @@unique([question_id, user_assessment_id], map: "assessment_questions_unique")
  @@index([reviewed_by], map: "fk_rails_630d3fd5b9")
  @@index([question_id], map: "index_user_assessment_questions_on_question_id")
  @@index([user_assessment_id], map: "index_user_assessment_questions_on_user_assessment_id")
}

model user_assessment_versions {
  id                        BigInt                      @id @default(autoincrement())
  assessment_id             BigInt?
  user_id                   BigInt?
  last_attempt              Int
  score                     Int?                        @default(0)
  status                    String                      @default("IN_PROGRESS") @db.VarChar(255)
  version_id                Int                         @default(1)
  latest                    Boolean                     @default(true)
  created_at                DateTime                    @db.DateTime(0)
  updated_at                DateTime                    @db.DateTime(0)
  completed                 Boolean                     @default(false)
  enrolled_user_assessments enrolled_user_assessments[]
  users                     users?                      @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_0c117b939e")
  assessments               assessments?                @relation(fields: [assessment_id], references: [id], onDelete: Cascade, map: "fk_rails_df4c22827d")
  user_assessments          user_assessments[]

  @@index([assessment_id], map: "index_user_assessment_versions_on_assessment_id")
  @@index([user_id], map: "index_user_assessment_versions_on_user_id")
}

model user_assessments {
  id                                        BigInt                      @id @default(autoincrement())
  score                                     Int?                        @default(0)
  attempt                                   Int                         @default(1)
  completed                                 Boolean                     @default(false)
  user_id                                   BigInt
  assessment_id                             BigInt
  created_at                                DateTime                    @db.DateTime(0)
  updated_at                                DateTime                    @db.DateTime(0)
  total_time_spent                          BigInt                      @default(0)
  status                                    String?                     @default("IN_PROGRESS") @db.VarChar(255)
  completed_at                              DateTime?                   @db.DateTime(0)
  reviewed_by                               BigInt?
  reviewed_at                               DateTime?                   @db.DateTime(0)
  user_assessment_version_id                BigInt?
  user_assessment_questions                 user_assessment_questions[]
  users_user_assessments_reviewed_byTousers users?                      @relation("user_assessments_reviewed_byTousers", fields: [reviewed_by], references: [id], onUpdate: SetNull, map: "fk_rails_aad0c42eff")
  users_user_assessments_user_idTousers     users                       @relation("user_assessments_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_b4a24cf7e1")
  assessments                               assessments                 @relation(fields: [assessment_id], references: [id], onDelete: Cascade, map: "fk_rails_cc43be7858")
  user_assessment_versions                  user_assessment_versions?   @relation(fields: [user_assessment_version_id], references: [id], onDelete: Cascade, map: "fk_user_assessments_version_id")

  @@unique([user_id, assessment_id, user_assessment_version_id, attempt], map: "unique_user_assessment")
  @@index([reviewed_by], map: "fk_rails_aad0c42eff")
  @@index([assessment_id], map: "index_user_assessments_on_assessment_id")
  @@index([user_id], map: "index_user_assessments_on_user_id")
  @@index([user_assessment_version_id], map: "index_user_assessments_version_id")
}

model user_certificate_approvals {
  id                                                   BigInt            @id @default(autoincrement())
  user_certificate_id                                  BigInt
  status                                               String            @default("PENDING") @db.VarChar(255)
  requested_by                                         BigInt?
  requested_on                                         DateTime?         @db.DateTime(0)
  approved_by                                          BigInt?
  approved_on                                          DateTime?         @db.DateTime(0)
  rejected_by                                          BigInt?
  rejected_on                                          DateTime?         @db.DateTime(0)
  created_at                                           DateTime          @db.DateTime(0)
  updated_at                                           DateTime          @db.DateTime(0)
  rejection_reason                                     String?           @db.VarChar(1024)
  users_user_certificate_approvals_rejected_byTousers  users?            @relation("user_certificate_approvals_rejected_byTousers", fields: [rejected_by], references: [id], onUpdate: SetNull, map: "fk_rails_0216853cdc")
  users_user_certificate_approvals_approved_byTousers  users?            @relation("user_certificate_approvals_approved_byTousers", fields: [approved_by], references: [id], onUpdate: SetNull, map: "fk_rails_04826f75b8")
  users_user_certificate_approvals_requested_byTousers users?            @relation("user_certificate_approvals_requested_byTousers", fields: [requested_by], references: [id], onUpdate: SetNull, map: "fk_rails_219403561f")
  user_certificates                                    user_certificates @relation(fields: [user_certificate_id], references: [id], onDelete: Cascade, map: "fk_rails_3034df418f")

  @@index([rejected_by], map: "fk_rails_0216853cdc")
  @@index([approved_by], map: "fk_rails_04826f75b8")
  @@index([requested_by], map: "fk_rails_219403561f")
  @@index([user_certificate_id], map: "index_user_certificate_approvals_on_user_certificate_id")
}

model user_certificates {
  id                                         BigInt                       @id @default(autoincrement())
  issue_date                                 DateTime?                    @db.DateTime(0)
  expiration_date                            DateTime?                    @db.DateTime(0)
  training_time                              BigInt?
  download_url                               String?                      @db.MediumText
  certificate_id                             BigInt?
  user_id                                    BigInt
  created_at                                 DateTime                     @db.DateTime(0)
  updated_at                                 DateTime                     @db.DateTime(0)
  thumbnail_url                              String?                      @db.MediumText
  identity                                   String?                      @db.VarChar(255)
  source_name                                String                       @db.VarChar(255)
  source_id                                  BigInt?
  category                                   String                       @default("COURSE") @db.VarChar(255)
  is_system                                  Boolean                      @default(true)
  uploaded_by                                BigInt?
  authority_name                             String?                      @db.VarChar(255)
  title                                      String                       @db.VarChar(255)
  organization_id                            BigInt
  source_type                                String                       @default("Enrollment") @db.VarChar(255)
  status                                     String                       @default("APPROVED") @db.VarChar(32)
  score                                      Int?
  license_id                                 String?                      @db.VarChar(255)
  license_url                                String?                      @db.VarChar(1024)
  latest                                     Boolean                      @default(true)
  parent_id                                  BigInt?
  user_certificate_approvals                 user_certificate_approvals[]
  users_user_certificates_user_idTousers     users                        @relation("user_certificates_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_03b0a0c9d8")
  certificates                               certificates?                @relation(fields: [certificate_id], references: [id], onUpdate: SetNull, map: "fk_rails_4d960ecd81")
  users_user_certificates_uploaded_byTousers users?                       @relation("user_certificates_uploaded_byTousers", fields: [uploaded_by], references: [id], map: "fk_rails_5ef93b5ac6")
  organizations                              organizations                @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_e7ddebee1b")
  user_certificates                          user_certificates?           @relation("user_certificatesTouser_certificates", fields: [parent_id], references: [id], onDelete: Cascade, map: "fk_user_certificates_parent_id")
  other_user_certificates                    user_certificates[]          @relation("user_certificatesTouser_certificates")

  @@index([source_id], map: "fk_rails_2d75eec176")
  @@index([uploaded_by], map: "fk_rails_5ef93b5ac6")
  @@index([organization_id], map: "fk_rails_e7ddebee1b")
  @@index([certificate_id], map: "index_user_certificates_on_certificate_id")
  @@index([parent_id], map: "index_user_certificates_on_parent_id")
  @@index([source_id, source_type], map: "index_user_certificates_on_source_id_and_source_type")
  @@index([user_id], map: "index_user_certificates_on_user_id")
}

model user_preferences {
  id                BigInt   @id @default(autoincrement())
  user_id           BigInt?
  learner_view_type String   @default("MODERN") @db.VarChar(255)
  created_at        DateTime @db.DateTime(0)
  updated_at        DateTime @db.DateTime(0)
  users             users?   @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_a69bfcfd81")

  @@index([user_id], map: "index_user_preferences_on_user_id")
}

model user_properties {
  id         BigInt   @id @default(autoincrement())
  prop_name  String   @db.VarChar(255)
  prop_value String   @db.VarChar(255)
  user_id    BigInt
  created_at DateTime @db.DateTime(0)
  updated_at DateTime @db.DateTime(0)
  users      users    @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_4924e05fff")

  @@unique([prop_name, user_id], map: "index_user_properties_on_prop_name_and_user_id")
  @@index([user_id], map: "index_user_properties_on_user_id")
}

model user_reactions {
  id              BigInt        @id @default(autoincrement())
  source_id       BigInt
  source_type     String        @db.VarChar(64)
  reaction_id     BigInt
  user_id         BigInt
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  reactions       reactions     @relation(fields: [reaction_id], references: [id], onDelete: Cascade, map: "fk_rails_9161488fc5")
  users           users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_bdfe2dc550")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_user_reactions_organization_id")

  @@index([reaction_id], map: "index_user_reactions_on_reaction_id")
  @@index([source_id, source_type], map: "index_user_reactions_on_source_id_and_source_type")
  @@index([user_id], map: "index_user_reactions_on_user_id")
  @@index([organization_id], map: "index_user_reactions_organization")
  @@index([user_id, source_id, source_type, reaction_id], map: "index_user_reactions_source_user_reaction")
}

model user_roles {
  id              BigInt        @id @default(autoincrement())
  item_type       String?       @db.VarChar(255)
  item_id         Int?
  user_id         BigInt?
  master_role_id  BigInt?
  created_at      DateTime      @db.DateTime(0)
  updated_at      DateTime      @db.DateTime(0)
  organization_id BigInt
  users           users?        @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_318345354e")
  master_roles    master_roles? @relation(fields: [master_role_id], references: [id], onDelete: Cascade, map: "fk_rails_dc53981feb")
  organizations   organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "index_user_roles_on_organization_id")

  @@unique([item_type, item_id, user_id, master_role_id], map: "index_user_roles_on_all")
  @@index([master_role_id], map: "index_user_roles_on_master_role_id")
  @@index([organization_id], map: "index_user_roles_on_organization_id")
  @@index([user_id], map: "index_user_roles_on_user_id")
}

model user_skills {
  id               BigInt        @id @default(autoincrement())
  skill_id         BigInt
  user_id          BigInt
  organization_id  BigInt
  proficiency_type String        @db.VarChar(255)
  can_mentor       Boolean       @default(false)
  created_at       DateTime      @db.DateTime(0)
  updated_at       DateTime      @db.DateTime(0)
  category         String        @db.VarChar(255)
  average_rating   Decimal?      @db.Decimal(10, 2)
  organizations    organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_4c3e385016")
  skills           skills        @relation(fields: [skill_id], references: [id], onDelete: Cascade, map: "fk_rails_59acb6e327")
  users            users         @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_fe61b6a893")

  @@unique([user_id, organization_id, skill_id, category], map: "index_on_user_skills_user_organization_category_skill")
  @@index([organization_id], map: "index_user_skills_on_organization_id")
  @@index([skill_id], map: "index_user_skills_on_skill_id")
  @@index([user_id], map: "index_user_skills_on_user_id")
  @@index([user_id, organization_id], map: "index_user_skills_on_user_id_and_organization_id")
}

model user_sources {
  id                                   BigInt   @id @default(autoincrement())
  user_id                              BigInt
  source_id                            Int
  source_type                          String   @db.VarChar(255)
  created_at                           DateTime @db.DateTime(0)
  updated_at                           DateTime @db.DateTime(0)
  type                                 String   @default("Instructor") @db.VarChar(255)
  created_by                           BigInt?
  users_user_sources_created_byTousers users?   @relation("user_sources_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_7ae6f91e1f")
  users_user_sources_user_idTousers    users    @relation("user_sources_user_idTousers", fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_fe3685e002")

  @@index([created_by], map: "fk_rails_7ae6f91e1f")
  @@index([source_id, source_type], map: "index_user_sources_on_source_id_and_source_type")
  @@index([user_id], map: "index_user_sources_on_user_id")
}

model user_support_messages {
  id                                            BigInt        @id @default(autoincrement())
  locale                                        Int           @default(0)
  message                                       String        @db.Text
  organization_id                               BigInt
  created_by                                    BigInt?
  updated_by                                    BigInt?
  created_at                                    DateTime      @db.DateTime(0)
  updated_at                                    DateTime      @db.DateTime(0)
  users_user_support_messages_updated_byTousers users?        @relation("user_support_messages_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_aa633fcce2")
  organizations                                 organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_d8478c7976")
  users_user_support_messages_created_byTousers users?        @relation("user_support_messages_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_f00fd61091")

  @@unique([organization_id, locale], map: "index_user_support_messages_on_organization_id_and_locale")
  @@index([updated_by], map: "fk_rails_aa633fcce2")
  @@index([created_by], map: "fk_rails_f00fd61091")
  @@index([organization_id], map: "index_user_support_messages_on_organization_id")
}

model user_support_settings {
  id                                            BigInt        @id @default(autoincrement())
  organization_id                               BigInt
  support_email                                 String        @db.VarChar(255)
  created_by                                    BigInt?
  updated_by                                    BigInt?
  created_at                                    DateTime      @db.DateTime(0)
  updated_at                                    DateTime      @db.DateTime(0)
  users_user_support_settings_updated_byTousers users?        @relation("user_support_settings_updated_byTousers", fields: [updated_by], references: [id], onUpdate: SetNull, map: "fk_rails_1288b41e2c")
  organizations                                 organizations @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_315a4dbe1d")
  users_user_support_settings_created_byTousers users?        @relation("user_support_settings_created_byTousers", fields: [created_by], references: [id], onUpdate: SetNull, map: "fk_rails_5a3971e5c3")

  @@index([updated_by], map: "fk_rails_1288b41e2c")
  @@index([created_by], map: "fk_rails_5a3971e5c3")
  @@index([organization_id], map: "index_user_support_settings_on_organization_id")
}

model user_survey_questions {
  id                    BigInt                  @id @default(autoincrement())
  user_survey_id        BigInt
  survey_question_id    BigInt
  submitted_at          DateTime?               @db.DateTime(0)
  created_at            DateTime                @db.DateTime(0)
  updated_at            DateTime                @db.DateTime(0)
  user_surveys          user_surveys            @relation(fields: [user_survey_id], references: [id], onDelete: Cascade, map: "fk_rails_07f760718a")
  survey_questions      survey_questions        @relation(fields: [survey_question_id], references: [id], onDelete: Cascade, map: "fk_rails_c491ff4937")
  user_survey_responses user_survey_responses[]

  @@unique([user_survey_id, survey_question_id], map: "index_user_survey_questions_survey_question")
  @@index([survey_question_id], map: "index_user_survey_questions_on_survey_question_id")
  @@index([user_survey_id], map: "index_user_survey_questions_on_user_survey_id")
}

model user_survey_responses {
  id                      BigInt                @id @default(autoincrement())
  user_survey_question_id BigInt
  survey_response_text    String?               @db.Text
  survey_response_id      BigInt?
  submitted_at            DateTime?             @db.DateTime(0)
  created_at              DateTime              @db.DateTime(0)
  updated_at              DateTime              @db.DateTime(0)
  survey_responses        survey_responses?     @relation(fields: [survey_response_id], references: [id], onDelete: Cascade, map: "fk_rails_0338d22b41")
  user_survey_questions   user_survey_questions @relation(fields: [user_survey_question_id], references: [id], onDelete: Cascade, map: "fk_rails_78f3819deb")

  @@index([survey_response_id], map: "index_user_survey_responses_on_survey_response_id")
  @@index([user_survey_question_id], map: "index_user_survey_responses_on_user_survey_question_id")
}

model user_survey_versions {
  id                       BigInt                  @id @default(autoincrement())
  survey_id                BigInt?
  user_id                  BigInt?
  status                   String                  @default("IN_PROGRESS") @db.VarChar(255)
  version_id               Int                     @default(1)
  questions_answered_count Int                     @default(0)
  completed                Boolean                 @default(false)
  latest                   Boolean                 @default(true)
  created_at               DateTime                @db.DateTime(0)
  updated_at               DateTime                @db.DateTime(0)
  enrolled_user_surveys    enrolled_user_surveys[]
  surveys                  surveys?                @relation(fields: [survey_id], references: [id], onDelete: Cascade, map: "fk_rails_46bdf3769d")
  users                    users?                  @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_7689504f16")
  user_surveys             user_surveys[]

  @@index([survey_id], map: "index_user_survey_versions_on_survey_id")
  @@index([user_id], map: "index_user_survey_versions_on_user_id")
}

model user_surveys {
  id                       BigInt                  @id @default(autoincrement())
  status                   String                  @default("IN_PROGRESS") @db.VarChar(255)
  started                  Boolean                 @default(true)
  started_at               DateTime                @db.DateTime(0)
  completed                Boolean                 @default(false)
  completed_at             DateTime?               @db.DateTime(0)
  questions_answered_count Int                     @default(0)
  survey_id                BigInt
  user_id                  BigInt
  created_at               DateTime                @db.DateTime(0)
  updated_at               DateTime                @db.DateTime(0)
  user_survey_version_id   BigInt?
  user_survey_questions    user_survey_questions[]
  users                    users                   @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_29e084d796")
  surveys                  surveys                 @relation(fields: [survey_id], references: [id], onDelete: Cascade, map: "fk_rails_e38389079e")
  user_survey_versions     user_survey_versions?   @relation(fields: [user_survey_version_id], references: [id], onDelete: Cascade, map: "fk_user_survey_version_id")

  @@index([user_survey_version_id], map: "index_user_survey_version_id")
  @@index([survey_id], map: "index_user_surveys_on_survey_id")
  @@index([user_id], map: "index_user_surveys_on_user_id")
  @@index([user_id, survey_id], map: "index_user_surveys_on_user_id_and_survey_id")
}

model user_tokens {
  id                       BigInt                 @id @default(autoincrement())
  prop_name                String                 @db.VarChar(255)
  prop_value               String                 @db.Text
  user_id                  BigInt
  organization_provider_id BigInt
  created_at               DateTime               @db.DateTime(0)
  updated_at               DateTime               @db.DateTime(0)
  organization_providers   organization_providers @relation(fields: [organization_provider_id], references: [id], onDelete: Cascade, map: "fk_rails_87b5e2c1ff")
  users                    users                  @relation(fields: [user_id], references: [id], onDelete: Cascade, map: "fk_rails_e0a9c15abb")

  @@unique([prop_name, user_id, organization_provider_id], map: "user_token_unique_property")
  @@index([organization_provider_id], map: "index_user_tokens_on_organization_provider_id")
  @@index([user_id], map: "index_user_tokens_on_user_id")
}

model users {
  id                                                                                  BigInt                             @id @default(autoincrement())
  email                                                                               String?                            @db.VarChar(255)
  encrypted_password                                                                  String                             @default("") @db.VarChar(255)
  reset_password_token                                                                String?                            @db.VarChar(255)
  reset_password_sent_at                                                              DateTime?                          @db.DateTime(0)
  remember_created_at                                                                 DateTime?                          @db.DateTime(0)
  last_seen_at                                                                        DateTime?                          @db.DateTime(0)
  sign_in_count                                                                       Int                                @default(0)
  current_sign_in_at                                                                  DateTime?                          @db.DateTime(0)
  last_sign_in_at                                                                     DateTime?                          @db.DateTime(0)
  current_sign_in_ip                                                                  String?                            @db.VarChar(255)
  last_sign_in_ip                                                                     String?                            @db.VarChar(255)
  first_name                                                                          String                             @default("") @db.VarChar(255)
  status                                                                              String                             @default("PENDING") @db.VarChar(255)
  mobile_no                                                                           String?                            @db.VarChar(255)
  time_zone                                                                           String?                            @db.VarChar(255)
  last_name                                                                           String                             @default("") @db.VarChar(255)
  invitation_token                                                                    String?                            @db.VarChar(255)
  invitation_created_at                                                               DateTime?                          @db.DateTime(0)
  invitation_sent_at                                                                  DateTime?                          @db.DateTime(0)
  invitation_accepted_at                                                              DateTime?                          @db.DateTime(0)
  invitation_limit                                                                    Int?
  invited_by_type                                                                     String?                            @db.VarChar(255)
  invitations_count                                                                   Int?                               @default(0)
  invited_by_id                                                                       BigInt?
  created_at                                                                          DateTime                           @db.DateTime(0)
  updated_at                                                                          DateTime                           @db.DateTime(0)
  organization_id                                                                     BigInt
  username                                                                            String?                            @db.VarChar(255)
  image_url                                                                           String?                            @db.MediumText
  designation                                                                         String?                            @db.VarChar(255)
  original_invitation_token                                                           String?                            @db.VarChar(255)
  middle_name                                                                         String?                            @db.VarChar(255)
  profile_color                                                                       String?                            @db.VarChar(255)
  role                                                                                String                             @db.VarChar(255)
  full_name                                                                           String?                            @db.VarChar(255)
  external_id                                                                         String?                            @db.Text
  external_source                                                                     String?                            @db.VarChar(255)
  failed_attempts                                                                     Int                                @default(0)
  last_failed_attempt_at                                                              DateTime?                          @db.DateTime(0)
  locale                                                                              String                             @default("en-US") @db.VarChar(255)
  force_change_password                                                               Boolean?                           @default(false)
  ahoy_events                                                                         ahoy_events[]
  announcement_readers                                                                announcement_readers[]
  announcements_announcements_updated_byTousers                                       announcements[]                    @relation("announcements_updated_byTousers")
  announcements_announcements_published_byTousers                                     announcements[]                    @relation("announcements_published_byTousers")
  announcements_announcements_created_byTousers                                       announcements[]                    @relation("announcements_created_byTousers")
  app_user_activity                                                                   app_user_activity[]
  apps_apps_updated_byTousers                                                         apps[]                             @relation("apps_updated_byTousers")
  apps_apps_created_byTousers                                                         apps[]                             @relation("apps_created_byTousers")
  assessment_trackers                                                                 assessment_trackers[]
  assessments_assessments_updated_byTousers                                           assessments[]                      @relation("assessments_updated_byTousers")
  assessments_assessments_created_byTousers                                           assessments[]                      @relation("assessments_created_byTousers")
  attachments                                                                         attachments[]
  authentication_attempts                                                             authentication_attempts[]
  banners_banners_created_byTousers                                                   banners[]                          @relation("banners_created_byTousers")
  banners_banners_updated_byTousers                                                   banners[]                          @relation("banners_updated_byTousers")
  booked_slots                                                                        booked_slots[]
  bookmarked_sources                                                                  bookmarked_sources[]
  cart_items                                                                          cart_items[]
  channel_join_requests_channel_join_requests_user_idTousers                          channel_join_requests[]            @relation("channel_join_requests_user_idTousers")
  channel_join_requests_channel_join_requests_responded_byTousers                     channel_join_requests[]            @relation("channel_join_requests_responded_byTousers")
  channel_users_channel_users_user_idTousers                                          channel_users[]                    @relation("channel_users_user_idTousers")
  channel_users_channel_users_invited_byTousers                                       channel_users[]                    @relation("channel_users_invited_byTousers")
  channels_channels_created_byTousers                                                 channels[]                         @relation("channels_created_byTousers")
  channels_channels_updated_byTousers                                                 channels[]                         @relation("channels_updated_byTousers")
  checklist_assignee_accessibility_checklist_assignee_accessibility_created_byTousers checklist_assignee_accessibility[] @relation("checklist_assignee_accessibility_created_byTousers")
  checklist_assignee_accessibility_checklist_assignee_accessibility_updated_byTousers checklist_assignee_accessibility[] @relation("checklist_assignee_accessibility_updated_byTousers")
  checklist_assignee_rules_checklist_assignee_rules_created_byTousers                 checklist_assignee_rules[]         @relation("checklist_assignee_rules_created_byTousers")
  checklist_assignee_rules_checklist_assignee_rules_updated_byTousers                 checklist_assignee_rules[]         @relation("checklist_assignee_rules_updated_byTousers")
  checklist_comments_checklist_comments_updated_byTousers                             checklist_comments[]               @relation("checklist_comments_updated_byTousers")
  checklist_comments_checklist_comments_created_byTousers                             checklist_comments[]               @relation("checklist_comments_created_byTousers")
  checklist_item_responses_checklist_item_responses_created_byTousers                 checklist_item_responses[]         @relation("checklist_item_responses_created_byTousers")
  checklist_item_responses_checklist_item_responses_updated_byTousers                 checklist_item_responses[]         @relation("checklist_item_responses_updated_byTousers")
  checklist_items_checklist_items_created_byTousers                                   checklist_items[]                  @relation("checklist_items_created_byTousers")
  checklist_items_checklist_items_updated_byTousers                                   checklist_items[]                  @relation("checklist_items_updated_byTousers")
  checklist_reviewer_accessibility_checklist_reviewer_accessibility_created_byTousers checklist_reviewer_accessibility[] @relation("checklist_reviewer_accessibility_created_byTousers")
  checklist_reviewer_accessibility_checklist_reviewer_accessibility_updated_byTousers checklist_reviewer_accessibility[] @relation("checklist_reviewer_accessibility_updated_byTousers")
  checklist_reviewer_rules_checklist_reviewer_rules_updated_byTousers                 checklist_reviewer_rules[]         @relation("checklist_reviewer_rules_updated_byTousers")
  checklist_reviewer_rules_checklist_reviewer_rules_created_byTousers                 checklist_reviewer_rules[]         @relation("checklist_reviewer_rules_created_byTousers")
  checklist_user_activities                                                           checklist_user_activities[]
  checklist_user_attempts_checklist_user_attempts_user_idTousers                      checklist_user_attempts[]          @relation("checklist_user_attempts_user_idTousers")
  checklist_user_attempts_checklist_user_attempts_rework_requested_byTousers          checklist_user_attempts[]          @relation("checklist_user_attempts_rework_requested_byTousers")
  checklist_user_rework_history_checklist_user_rework_history_reviewed_byTousers      checklist_user_rework_history[]    @relation("checklist_user_rework_history_reviewed_byTousers")
  checklist_user_rework_history_checklist_user_rework_history_user_idTousers          checklist_user_rework_history[]    @relation("checklist_user_rework_history_user_idTousers")
  checklist_users_checklist_users_user_idTousers                                      checklist_users[]                  @relation("checklist_users_user_idTousers")
  checklist_users_checklist_users_assigned_byTousers                                  checklist_users[]                  @relation("checklist_users_assigned_byTousers")
  checklist_users_checklist_users_rework_requested_byTousers                          checklist_users[]                  @relation("checklist_users_rework_requested_byTousers")
  checklist_viewer_accessibility_checklist_viewer_accessibility_updated_byTousers     checklist_viewer_accessibility[]   @relation("checklist_viewer_accessibility_updated_byTousers")
  checklist_viewer_accessibility_checklist_viewer_accessibility_created_byTousers     checklist_viewer_accessibility[]   @relation("checklist_viewer_accessibility_created_byTousers")
  checklist_viewer_rules_checklist_viewer_rules_created_byTousers                     checklist_viewer_rules[]           @relation("checklist_viewer_rules_created_byTousers")
  checklist_viewer_rules_checklist_viewer_rules_updated_byTousers                     checklist_viewer_rules[]           @relation("checklist_viewer_rules_updated_byTousers")
  checklists_checklists_updated_byTousers                                             checklists[]                       @relation("checklists_updated_byTousers")
  checklists_checklists_created_byTousers                                             checklists[]                       @relation("checklists_created_byTousers")
  contents                                                                            contents[]
  coupon_audits                                                                       coupon_audits[]
  coupons_coupons_created_byTousers                                                   coupons[]                          @relation("coupons_created_byTousers")
  coupons_coupons_updated_byTousers                                                   coupons[]                          @relation("coupons_updated_byTousers")
  devices                                                                             devices[]
  enrollment_trackers_enrollment_trackers_assigned_byTousers                          enrollment_trackers[]              @relation("enrollment_trackers_assigned_byTousers")
  enrollment_trackers_enrollment_trackers_user_idTousers                              enrollment_trackers[]              @relation("enrollment_trackers_user_idTousers")
  enrollment_versions_enrollment_versions_assigned_byTousers                          enrollment_versions[]              @relation("enrollment_versions_assigned_byTousers")
  enrollment_versions_enrollment_versions_user_idTousers                              enrollment_versions[]              @relation("enrollment_versions_user_idTousers")
  enrollments_enrollments_assigned_byTousers                                          enrollments[]                      @relation("enrollments_assigned_byTousers")
  enrollments_enrollments_user_idTousers                                              enrollments[]                      @relation("enrollments_user_idTousers")
  event_attendance                                                                    event_attendance[]
  event_sessions_event_sessions_created_byTousers                                     event_sessions[]                   @relation("event_sessions_created_byTousers")
  event_sessions_event_sessions_updated_byTousers                                     event_sessions[]                   @relation("event_sessions_updated_byTousers")
  events_events_created_byTousers                                                     events[]                           @relation("events_created_byTousers")
  events_events_updated_byTousers                                                     events[]                           @relation("events_updated_byTousers")
  external_trainings_external_trainings_updated_byTousers                             external_trainings[]               @relation("external_trainings_updated_byTousers")
  external_trainings_external_trainings_created_byTousers                             external_trainings[]               @relation("external_trainings_created_byTousers")
  feedback_feedback_user_idTousers                                                    feedback[]                         @relation("feedback_user_idTousers")
  feedback_feedback_hidden_byTousers                                                  feedback[]                         @relation("feedback_hidden_byTousers")
  flagged_sources                                                                     flagged_sources[]
  forums_forums_created_byTousers                                                     forums[]                           @relation("forums_created_byTousers")
  forums_forums_updated_byTousers                                                     forums[]                           @relation("forums_updated_byTousers")
  learning_entities                                                                   learning_entities[]
  libraries_libraries_updated_byTousers                                               libraries[]                        @relation("libraries_updated_byTousers")
  libraries_libraries_created_byTousers                                               libraries[]                        @relation("libraries_created_byTousers")
  manager_relations                                                                   manager_relations[]
  meeting_recipients                                                                  meeting_recipients[]
  mentees                                                                             mentees[]
  mentors                                                                             mentors[]
  mentorship_requests_mentorship_requests_responded_byTousers                         mentorship_requests[]              @relation("mentorship_requests_responded_byTousers")
  mentorship_requests_mentorship_requests_requested_byTousers                         mentorship_requests[]              @relation("mentorship_requests_requested_byTousers")
  notification_settings                                                               notification_settings[]
  notifications_notifications_actor_idTousers                                         notifications[]                    @relation("notifications_actor_idTousers")
  notifications_notifications_owner_idTousers                                         notifications[]                    @relation("notifications_owner_idTousers")
  oauth_client_authentications                                                        oauth_client_authentications[]
  operations                                                                          operations[]
  order_items                                                                         order_items[]
  ordered_links_ordered_links_created_byTousers                                       ordered_links[]                    @relation("ordered_links_created_byTousers")
  ordered_links_ordered_links_updated_byTousers                                       ordered_links[]                    @relation("ordered_links_updated_byTousers")
  orders                                                                              orders[]
  poll_configurations_poll_configurations_updated_byTousers                           poll_configurations[]              @relation("poll_configurations_updated_byTousers")
  poll_configurations_poll_configurations_created_byTousers                           poll_configurations[]              @relation("poll_configurations_created_byTousers")
  poll_options_poll_options_updated_byTousers                                         poll_options[]                     @relation("poll_options_updated_byTousers")
  poll_options_poll_options_created_byTousers                                         poll_options[]                     @relation("poll_options_created_byTousers")
  post_replies_post_replies_updated_byTousers                                         post_replies[]                     @relation("post_replies_updated_byTousers")
  post_replies_post_replies_created_byTousers                                         post_replies[]                     @relation("post_replies_created_byTousers")
  posts_posts_created_byTousers                                                       posts[]                            @relation("posts_created_byTousers")
  posts_posts_marked_answered_byTousers                                               posts[]                            @relation("posts_marked_answered_byTousers")
  posts_posts_updated_byTousers                                                       posts[]                            @relation("posts_updated_byTousers")
  program_enrollments_program_enrollments_assigned_byTousers                          program_enrollments[]              @relation("program_enrollments_assigned_byTousers")
  program_enrollments_program_enrollments_mentee_idTousers                            program_enrollments[]              @relation("program_enrollments_mentee_idTousers")
  program_enrollments_program_enrollments_mentor_idTousers                            program_enrollments[]              @relation("program_enrollments_mentor_idTousers")
  program_goals                                                                       program_goals[]
  program_goals_feedback                                                              program_goals_feedback[]
  program_mentee_feedback_program_mentee_feedback_mentee_idTousers                    program_mentee_feedback[]          @relation("program_mentee_feedback_mentee_idTousers")
  program_mentee_feedback_program_mentee_feedback_mentor_idTousers                    program_mentee_feedback[]          @relation("program_mentee_feedback_mentor_idTousers")
  program_mentor_feedback_program_mentor_feedback_mentor_idTousers                    program_mentor_feedback[]          @relation("program_mentor_feedback_mentor_idTousers")
  program_mentor_feedback_program_mentor_feedback_mentee_idTousers                    program_mentor_feedback[]          @relation("program_mentor_feedback_mentee_idTousers")
  program_milestone_items_program_milestone_items_updated_byTousers                   program_milestone_items[]          @relation("program_milestone_items_updated_byTousers")
  program_milestone_items_program_milestone_items_created_byTousers                   program_milestone_items[]          @relation("program_milestone_items_created_byTousers")
  program_milestones_program_milestones_updated_byTousers                             program_milestones[]               @relation("program_milestones_updated_byTousers")
  program_milestones_program_milestones_created_byTousers                             program_milestones[]               @relation("program_milestones_created_byTousers")
  program_stakeholders                                                                program_stakeholders[]
  programs_programs_owner_idTousers                                                   programs[]                         @relation("programs_owner_idTousers")
  programs_programs_created_byTousers                                                 programs[]                         @relation("programs_created_byTousers")
  programs_programs_updated_byTousers                                                 programs[]                         @relation("programs_updated_byTousers")
  questions_questions_updated_byTousers                                               questions[]                        @relation("questions_updated_byTousers")
  questions_questions_created_byTousers                                               questions[]                        @relation("questions_created_byTousers")
  reportees_reportees_reportee_idTousers                                              reportees[]                        @relation("reportees_reportee_idTousers")
  reportees_reportees_manager_idTousers                                               reportees[]                        @relation("reportees_manager_idTousers")
  reporting_manager_relations_reporting_manager_relations_manager_idTousers           reporting_manager_relations[]      @relation("reporting_manager_relations_manager_idTousers")
  reporting_manager_relations_reporting_manager_relations_user_idTousers              reporting_manager_relations[]      @relation("reporting_manager_relations_user_idTousers")
  reports                                                                             reports[]
  schedule_reports                                                                    schedule_reports[]
  search_terms                                                                        search_terms[]
  service_accounts                                                                    service_accounts[]
  shared_enrollments                                                                  shared_enrollments[]
  slots                                                                               slots[]
  source_skills_feedback_source_skills_feedback_reviewed_byTousers                    source_skills_feedback[]           @relation("source_skills_feedback_reviewed_byTousers")
  source_skills_feedback_source_skills_feedback_user_idTousers                        source_skills_feedback[]           @relation("source_skills_feedback_user_idTousers")
  source_visibility                                                                   source_visibility[]
  sso_requests                                                                        sso_requests[]
  submission_reviews                                                                  submission_reviews[]
  submissions_submissions_user_idTousers                                              submissions[]                      @relation("submissions_user_idTousers")
  submissions_submissions_reviewed_byTousers                                          submissions[]                      @relation("submissions_reviewed_byTousers")
  support_requests                                                                    support_requests[]
  survey_questions_survey_questions_updated_byTousers                                 survey_questions[]                 @relation("survey_questions_updated_byTousers")
  survey_questions_survey_questions_created_byTousers                                 survey_questions[]                 @relation("survey_questions_created_byTousers")
  survey_responses_survey_responses_created_byTousers                                 survey_responses[]                 @relation("survey_responses_created_byTousers")
  survey_responses_survey_responses_updated_byTousers                                 survey_responses[]                 @relation("survey_responses_updated_byTousers")
  survey_sections_survey_sections_updated_byTousers                                   survey_sections[]                  @relation("survey_sections_updated_byTousers")
  survey_sections_survey_sections_created_byTousers                                   survey_sections[]                  @relation("survey_sections_created_byTousers")
  surveys_surveys_updated_byTousers                                                   surveys[]                          @relation("surveys_updated_byTousers")
  surveys_surveys_created_byTousers                                                   surveys[]                          @relation("surveys_created_byTousers")
  team_users                                                                          team_users[]
  teams_teams_created_byTousers                                                       teams[]                            @relation("teams_created_byTousers")
  teams_teams_updated_byTousers                                                       teams[]                            @relation("teams_updated_byTousers")
  time_access_logs                                                                    time_access_logs[]
  training_shipments                                                                  training_shipments[]
  user_access_tokens                                                                  user_access_tokens[]
  user_accounts_user_accounts_user_idTousers                                          user_accounts[]                    @relation("user_accounts_user_idTousers")
  user_accounts_user_accounts_invited_by_idTousers                                    user_accounts[]                    @relation("user_accounts_invited_by_idTousers")
  user_assessment_questions                                                           user_assessment_questions[]
  user_assessment_versions                                                            user_assessment_versions[]
  user_assessments_user_assessments_reviewed_byTousers                                user_assessments[]                 @relation("user_assessments_reviewed_byTousers")
  user_assessments_user_assessments_user_idTousers                                    user_assessments[]                 @relation("user_assessments_user_idTousers")
  user_certificate_approvals_user_certificate_approvals_rejected_byTousers            user_certificate_approvals[]       @relation("user_certificate_approvals_rejected_byTousers")
  user_certificate_approvals_user_certificate_approvals_approved_byTousers            user_certificate_approvals[]       @relation("user_certificate_approvals_approved_byTousers")
  user_certificate_approvals_user_certificate_approvals_requested_byTousers           user_certificate_approvals[]       @relation("user_certificate_approvals_requested_byTousers")
  user_certificates_user_certificates_user_idTousers                                  user_certificates[]                @relation("user_certificates_user_idTousers")
  user_certificates_user_certificates_uploaded_byTousers                              user_certificates[]                @relation("user_certificates_uploaded_byTousers")
  user_preferences                                                                    user_preferences[]
  user_properties                                                                     user_properties[]
  user_reactions                                                                      user_reactions[]
  user_roles                                                                          user_roles[]
  user_skills                                                                         user_skills[]
  user_sources_user_sources_created_byTousers                                         user_sources[]                     @relation("user_sources_created_byTousers")
  user_sources_user_sources_user_idTousers                                            user_sources[]                     @relation("user_sources_user_idTousers")
  user_support_messages_user_support_messages_updated_byTousers                       user_support_messages[]            @relation("user_support_messages_updated_byTousers")
  user_support_messages_user_support_messages_created_byTousers                       user_support_messages[]            @relation("user_support_messages_created_byTousers")
  user_support_settings_user_support_settings_updated_byTousers                       user_support_settings[]            @relation("user_support_settings_updated_byTousers")
  user_support_settings_user_support_settings_created_byTousers                       user_support_settings[]            @relation("user_support_settings_created_byTousers")
  user_survey_versions                                                                user_survey_versions[]
  user_surveys                                                                        user_surveys[]
  user_tokens                                                                         user_tokens[]
  users                                                                               users?                             @relation("usersTousers", fields: [invited_by_id], references: [id], onUpdate: SetNull, map: "fk_rails_ae14a5013f")
  other_users                                                                         users[]                            @relation("usersTousers")
  organizations                                                                       organizations                      @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_d7b9ff90af")

  @@unique([email, organization_id], map: "index_users_on_email_and_organization_id")
  @@unique([username, organization_id], map: "index_users_on_username_and_organization_id")
  @@index([invitations_count], map: "index_users_on_invitations_count")
  @@index([invited_by_id], map: "index_users_on_invited_by_id")
  @@index([organization_id], map: "index_users_on_organization_id")
}

model verified_sessions {
  id                   BigInt             @id @default(autoincrement())
  resource_id          BigInt?
  resource_type        String?            @db.VarChar(255)
  action               String             @db.VarChar(255)
  duration             Int                @default(0)
  started_at           DateTime           @db.DateTime(0)
  expired_at           DateTime           @db.DateTime(0)
  channel_name         String             @db.VarChar(255)
  user_access_token_id BigInt
  created_at           DateTime           @db.DateTime(0)
  updated_at           DateTime           @db.DateTime(0)
  user_access_tokens   user_access_tokens @relation(fields: [user_access_token_id], references: [id], onDelete: Cascade, map: "fk_rails_4d76827c19")

  @@index([resource_id, resource_type], map: "index_verified_sessions_on_resource_id_and_resource_type")
  @@index([user_access_token_id], map: "index_verified_sessions_on_user_access_token_id")
  @@index([resource_id, resource_type, action], map: "index_verified_sessions_resource_and_action")
}

model webhook_events {
  id                BigInt             @id @default(autoincrement())
  webhook_id        BigInt
  master_webhook_id BigInt
  created_at        DateTime           @db.DateTime(0)
  updated_at        DateTime           @db.DateTime(0)
  master_webhooks   master_webhooks    @relation(fields: [master_webhook_id], references: [id], onDelete: Cascade, map: "fk_rails_c3afcbdbbb")
  webhooks          webhooks           @relation(fields: [webhook_id], references: [id], onDelete: Cascade, map: "fk_rails_ebe0b3e833")
  webhook_triggers  webhook_triggers[]

  @@unique([webhook_id, master_webhook_id], map: "index_webhook_events_on_webhook_id_and_master_webhook_id")
  @@index([master_webhook_id], map: "index_webhook_events_on_master_webhook_id")
  @@index([webhook_id], map: "index_webhook_events_on_webhook_id")
}

model webhook_triggers {
  id                BigInt          @id @default(autoincrement())
  event_id          String          @db.VarChar(255)
  status            Int?
  attempts          Int             @default(1)
  elapsed_time      Float?          @db.Float
  webhook_id        BigInt
  master_webhook_id BigInt
  created_at        DateTime        @db.DateTime(0)
  updated_at        DateTime        @db.DateTime(0)
  webhook_event_id  BigInt?
  webhooks          webhooks        @relation(fields: [webhook_id], references: [id], onDelete: Cascade, map: "fk_rails_213bdf602a")
  master_webhooks   master_webhooks @relation(fields: [master_webhook_id], references: [id], onDelete: Cascade, map: "fk_rails_671e9cd42c")
  webhook_events    webhook_events? @relation(fields: [webhook_event_id], references: [id], onDelete: Cascade, map: "fk_rails_a6e69abfef")

  @@index([master_webhook_id], map: "index_webhook_triggers_on_master_webhook_id")
  @@index([webhook_event_id], map: "index_webhook_triggers_on_webhook_event_id")
  @@index([webhook_id], map: "index_webhook_triggers_on_webhook_id")
}

model webhooks {
  id               BigInt             @id @default(autoincrement())
  url              String             @db.VarChar(255)
  active           Boolean            @default(true)
  title            String             @db.VarChar(255)
  log_history      Boolean            @default(false)
  ssl              Boolean            @default(false)
  organization_id  BigInt
  created_at       DateTime           @db.DateTime(0)
  updated_at       DateTime           @db.DateTime(0)
  description      String?            @db.VarChar(255)
  webhook_events   webhook_events[]
  webhook_triggers webhook_triggers[]
  organizations    organizations      @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_49212d501e")

  @@index([organization_id], map: "index_webhooks_on_organization_id")
}

model workflow_rules {
  id               BigInt    @id @default(autoincrement())
  workflow_id      BigInt
  source_type      String    @db.VarChar(255)
  field_id         Int
  field_type       String    @db.VarChar(255)
  field_match_type String    @db.VarChar(255)
  field_value      String    @db.VarChar(255)
  created_at       DateTime  @db.DateTime(0)
  updated_at       DateTime  @db.DateTime(0)
  workflows        workflows @relation(fields: [workflow_id], references: [id], onDelete: Cascade, map: "fk_rails_9006aa74f3")

  @@index([field_type, field_id], map: "index_workflow_rules_on_field_type_and_field_id")
  @@index([workflow_id], map: "index_workflow_rules_on_workflow_id")
}

model workflows {
  id                 BigInt           @id @default(autoincrement())
  name               String           @db.VarChar(255)
  description        String?          @db.VarChar(255)
  source_type        String           @db.VarChar(255)
  organization_id    BigInt
  action             String           @db.VarChar(255)
  target_id          Int
  target_type        String           @db.VarChar(255)
  rules_match_policy String           @default("ALL") @db.VarChar(255)
  created_at         DateTime         @db.DateTime(0)
  updated_at         DateTime         @db.DateTime(0)
  workflow_rules     workflow_rules[]
  organizations      organizations    @relation(fields: [organization_id], references: [id], onDelete: Cascade, map: "fk_rails_477b8ee18d")

  @@index([organization_id], map: "index_workflows_on_organization_id")
  @@index([target_type, target_id], map: "index_workflows_on_target_type_and_target_id")
}
Leave a Comment