keonik / prisma-erd-generator

Generate an ER Diagram based on your Prisma schema every time you run npx prisma generate
https://www.npmjs.com/package/prisma-erd-generator
MIT License
894 stars 52 forks source link

"Maximum Text Size In Diagram Exceeded" #49

Closed janpio closed 2 years ago

janpio commented 2 years ago

When creating a diagram for the following Prisma schema (via https://github.com/prisma/prisma/issues/10856#issue-1088186269) I get a "Maximum Text Size In Diagram Exceeded" instead of a real diagram:

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

generator erd {
  provider = "prisma-erd-generator"
}

model AccountBalances {
  AccountBalanceID_PK String    @id
  AccountID_FK        String?
  Date                Float?
  Balance             Float?
  TotalMarketValue    Float?
  Accounts            Accounts? @relation(fields: [AccountID_FK], references: [AccountID_PK], onDelete: Cascade)
}

model AccountDefaultsTags {
  AccountID_NN_FK String
  TagID_NN_FK     String
  Accounts        Accounts @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  Tags            Tags     @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)

  @@id([AccountID_NN_FK, TagID_NN_FK])
}

model AccountGroups {
  AccountGroupID_PK                                     String                              @id
  ParentID_FK                                           String?
  Position                                              Int?
  WebsiteID_UK_FK                                       String?                             @unique(map: "sqlite_autoindex_AccountGroups_2")
  TypeNumber                                            Int?
  CurrencyCode                                          String?
  IncludeInBalances                                     Int?
  IncludeInSidebar                                      Int?
  IncludeInTransactions                                 Int?
  IncludeInLists                                        Int?
  IncludeInReports                                      Int?
  IncludePendingTransactions                            Int?
  Favorite                                              Int?
  Name                                                  String?
  ShortName                                             String?
  Info                                                  String?
  ColorString                                           String?
  AlternateColorString                                  String?
  TintColorString                                       String?
  AlternateTintColorString                              String?
  ImageData                                             Bytes?
  AlternateImageData                                    Bytes?
  SubtitleTypeNumber                                    Int?
  Subtitle                                              String?
  BalanceOptionTypeNumber                               Int?
  MinimumBalance                                        Float?
  MinimumBalanceAlertTypeNumber                         Int?
  MinimumBalanceForAlert                                Float?
  MaximumBalance                                        Float?
  MaximumBalanceAlertTypeNumber                         Int?
  MaximumBalanceForAlert                                Float?
  MiscValues                                            Bytes?
  AccountGroups                                         AccountGroups?                      @relation("AccountGroupsToAccountGroups_ParentID_FK", fields: [ParentID_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Websites_AccountGroups_WebsiteID_UK_FKToWebsites      Websites?                           @relation("AccountGroups_WebsiteID_UK_FKToWebsites", fields: [WebsiteID_UK_FK], references: [WebsiteID_PK])
  other_AccountGroups                                   AccountGroups[]                     @relation("AccountGroupsToAccountGroups_ParentID_FK")
  Accounts                                              Accounts[]
  Attachments                                           Attachments[]
  InvestmentPortfoliosAccountGroups                     InvestmentPortfoliosAccountGroups[]
  Notes                                                 Notes[]
  ReportForecastDetails                                 ReportForecastDetails[]
  ReportGoalDetails                                     ReportGoalDetails[]
  ReportsAccountGroups                                  ReportsAccountGroups[]
  Websites_AccountGroupsToWebsites_AccountGroupID_UK_FK Websites?                           @relation("AccountGroupsToWebsites_AccountGroupID_UK_FK")
}

model Accounts {
  AccountID_PK                                                                                 String                         @id
  AccountGroupID_NN_FK                                                                         String
  PayeeID_NN_UK_FK                                                                             String                         @unique(map: "sqlite_autoindex_Accounts_2")
  CategoryID_NN_UK_FK                                                                          String                         @unique(map: "sqlite_autoindex_Accounts_3")
  SecurityID_UK_FK                                                                             String?                        @unique(map: "sqlite_autoindex_Accounts_4")
  InvestmentAccountDetailsID_UK_FK                                                             String?                        @unique(map: "sqlite_autoindex_Accounts_5")
  LoanAccountDetailsID_UK_FK                                                                   String?                        @unique(map: "sqlite_autoindex_Accounts_6")
  GoalAccountDetailsID_UK_FK                                                                   String?                        @unique(map: "sqlite_autoindex_Accounts_7")
  InstitutionID_FK                                                                             String?
  DownloadConnectionID_UK_FK                                                                   String?                        @unique(map: "sqlite_autoindex_Accounts_8")
  DefaultFlagID_FK                                                                             String?
  DefaultPayeeID_FK                                                                            String?
  DefaultTransactionTypeID_FK                                                                  String?
  DefaultCategoryID_FK                                                                         String?
  WebsiteID_UK_FK                                                                              String?                        @unique(map: "sqlite_autoindex_Accounts_9")
  Position                                                                                     Int?
  TypeNumber                                                                                   Int?
  StatusNumber                                                                                 Int?
  CurrencyCode                                                                                 String?
  IncludeInBalances                                                                            Int?
  IncludeInSidebar                                                                             Int?
  IncludeInTransactions                                                                        Int?
  IncludeInGroupTransactions                                                                   Int?
  IncludeInInvestments                                                                         Int?
  IncludeInLists                                                                               Int?
  IncludeInReports                                                                             Int?
  IncludePendingTransactions                                                                   Int?
  Favorite                                                                                     Int?
  Name                                                                                         String?
  ShortName                                                                                    String?
  Info                                                                                         String?
  ColorString                                                                                  String?
  AlternateColorString                                                                         String?
  TintColorString                                                                              String?
  AlternateTintColorString                                                                     String?
  ImageData                                                                                    Bytes?
  AlternateImageData                                                                           Bytes?
  SubtitleTypeNumber                                                                           Int?
  Subtitle                                                                                     String?
  InstitutionName                                                                              String?
  InstitutionURL                                                                               String?
  RoutingNumber                                                                                String?
  Taxable                                                                                      Int?
  InterestRate                                                                                 Float?
  FeeTypeNumber                                                                                Int?
  Fee                                                                                          Float?
  PaymentDay                                                                                   Int?
  CreditLimit                                                                                  Float?
  AvailableBalance                                                                             Float?
  AvailableBalanceDate                                                                         Float?
  LedgerBalance                                                                                Float?
  LedgerBalanceDate                                                                            Float?
  MarketValue                                                                                  Float?
  MarketValueDate                                                                              Float?
  BalanceOptionTypeNumber                                                                      Int?
  MinimumBalance                                                                               Float?
  MinimumBalanceAlertTypeNumber                                                                Int?
  MinimumBalanceForAlert                                                                       Float?
  MaximumBalance                                                                               Float?
  MaximumBalanceAlertTypeNumber                                                                Int?
  MaximumBalanceForAlert                                                                       Float?
  TransactionEntryTypeNumber                                                                   Int?
  DefaultMemo                                                                                  String?
  DefaultAmount                                                                                Float?
  DefaultStatusNumber                                                                          Int?
  OFXIntuitBankID                                                                              String?
  OFXIntuitUserID                                                                              String?
  ImportSettings                                                                               Bytes?
  CheckPrintingSettings                                                                        Bytes?
  MiscValues                                                                                   Bytes?
  AccountGroups                                                                                AccountGroups                  @relation(fields: [AccountGroupID_NN_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Categories_Accounts_CategoryID_NN_UK_FKToCategories                                          Categories                     @relation("Accounts_CategoryID_NN_UK_FKToCategories", fields: [CategoryID_NN_UK_FK], references: [CategoryID_PK], onDelete: Cascade)
  Categories_Accounts_DefaultCategoryID_FKToCategories                                         Categories?                    @relation("Accounts_DefaultCategoryID_FKToCategories", fields: [DefaultCategoryID_FK], references: [CategoryID_PK])
  Flags                                                                                        Flags?                         @relation(fields: [DefaultFlagID_FK], references: [FlagID_PK])
  Payees_Accounts_DefaultPayeeID_FKToPayees                                                    Payees?                        @relation("Accounts_DefaultPayeeID_FKToPayees", fields: [DefaultPayeeID_FK], references: [PayeeID_PK])
  TransactionTypes                                                                             TransactionTypes?              @relation(fields: [DefaultTransactionTypeID_FK], references: [TransactionTypeID_PK])
  DownloadConnections_Accounts_DownloadConnectionID_UK_FKToDownloadConnections                 DownloadConnections?           @relation("Accounts_DownloadConnectionID_UK_FKToDownloadConnections", fields: [DownloadConnectionID_UK_FK], references: [DownloadConnectionID_PK])
  GoalAccountDetails_Accounts_GoalAccountDetailsID_UK_FKToGoalAccountDetails                   GoalAccountDetails?            @relation("Accounts_GoalAccountDetailsID_UK_FKToGoalAccountDetails", fields: [GoalAccountDetailsID_UK_FK], references: [GoalAccountDetailsID_PK])
  Institutions                                                                                 Institutions?                  @relation(fields: [InstitutionID_FK], references: [InstitutionID_PK])
  InvestmentAccountDetails_Accounts_InvestmentAccountDetailsID_UK_FKToInvestmentAccountDetails InvestmentAccountDetails?      @relation("Accounts_InvestmentAccountDetailsID_UK_FKToInvestmentAccountDetails", fields: [InvestmentAccountDetailsID_UK_FK], references: [InvestmentAccountDetailsID_PK])
  LoanAccountDetails_Accounts_LoanAccountDetailsID_UK_FKToLoanAccountDetails                   LoanAccountDetails?            @relation("Accounts_LoanAccountDetailsID_UK_FKToLoanAccountDetails", fields: [LoanAccountDetailsID_UK_FK], references: [LoanAccountDetailsID_PK])
  Payees_Accounts_PayeeID_NN_UK_FKToPayees                                                     Payees                         @relation("Accounts_PayeeID_NN_UK_FKToPayees", fields: [PayeeID_NN_UK_FK], references: [PayeeID_PK], onDelete: Cascade)
  Securities_Accounts_SecurityID_UK_FKToSecurities                                             Securities?                    @relation("Accounts_SecurityID_UK_FKToSecurities", fields: [SecurityID_UK_FK], references: [SecurityID_PK])
  Websites_Accounts_WebsiteID_UK_FKToWebsites                                                  Websites?                      @relation("Accounts_WebsiteID_UK_FKToWebsites", fields: [WebsiteID_UK_FK], references: [WebsiteID_PK])
  AccountBalances                                                                              AccountBalances[]
  AccountDefaultsTags                                                                          AccountDefaultsTags[]
  AccountsUsers                                                                                AccountsUsers[]
  Attachments                                                                                  Attachments[]
  BudgetsAccounts                                                                              BudgetsAccounts[]
  Categories_AccountsToCategories_AccountID_UK_FK                                              Categories?                    @relation("AccountsToCategories_AccountID_UK_FK")
  DownloadConnections_AccountsToDownloadConnections_AccountID_NN_UK_FK                         DownloadConnections?           @relation("AccountsToDownloadConnections_AccountID_NN_UK_FK")
  GoalAccountDetails_AccountsToGoalAccountDetails_AccountID_NN_UK_FK                           GoalAccountDetails?            @relation("AccountsToGoalAccountDetails_AccountID_NN_UK_FK")
  GoalAccountDetails_AccountsToGoalAccountDetails_PaymentAccountID_FK                          GoalAccountDetails[]           @relation("AccountsToGoalAccountDetails_PaymentAccountID_FK")
  ImportedAccounts                                                                             ImportedAccounts[]
  InvestmentAccountDetails_AccountsToInvestmentAccountDetails_AccountID_NN_UK_FK               InvestmentAccountDetails?      @relation("AccountsToInvestmentAccountDetails_AccountID_NN_UK_FK")
  InvestmentPortfoliosAccounts                                                                 InvestmentPortfoliosAccounts[]
  LoanAccountDetails_AccountsToLoanAccountDetails_AccountID_NN_UK_FK                           LoanAccountDetails?            @relation("AccountsToLoanAccountDetails_AccountID_NN_UK_FK")
  LoanAccountDetails_AccountsToLoanAccountDetails_PaymentAccountID_FK                          LoanAccountDetails[]           @relation("AccountsToLoanAccountDetails_PaymentAccountID_FK")
  Notes                                                                                        Notes[]
  Payees_AccountsToPayees_AccountID_UK_FK                                                      Payees?                        @relation("AccountsToPayees_AccountID_UK_FK")
  ReportForecastDetails                                                                        ReportForecastDetails[]
  ReportGoalDetails                                                                            ReportGoalDetails[]
  ReportsAccounts                                                                              ReportsAccounts[]
  ScheduledTransactions                                                                        ScheduledTransactions[]
  Securities_AccountsToSecurities_AccountID_UK_FK                                              Securities?                    @relation("AccountsToSecurities_AccountID_UK_FK")
  Statements                                                                                   Statements[]
  TransactionRuleTransactions                                                                  TransactionRuleTransactions[]
  Transactions                                                                                 Transactions[]
  Websites_AccountsToWebsites_AccountID_UK_FK                                                  Websites?                      @relation("AccountsToWebsites_AccountID_UK_FK")
}

model AccountsUsers {
  AccountID_NN_FK String
  EntityID_NN_FK  String
  DefaultUser     Int?
  PercentOwned    Float?
  Accounts        Accounts @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  Entities        Entities @relation(fields: [EntityID_NN_FK], references: [EntityID_PK], onDelete: Cascade)

  @@id([AccountID_NN_FK, EntityID_NN_FK])
}

model Attachments {
  AttachmentID_PK           String                 @id
  NoteID_FK                 String?
  LocationID_FK             String?
  EntityID_FK               String?
  CreditScoreID_FK          String?
  AccountGroupID_FK         String?
  AccountID_FK              String?
  TransactionID_FK          String?
  FlagID_FK                 String?
  PayeeID_FK                String?
  TransactionTypeID_FK      String?
  CategoryID_FK             String?
  TagID_FK                  String?
  SecurityID_FK             String?
  SecurityGroupID_FK        String?
  SecurityGoalID_FK         String?
  SecurityAssetClassID_FK   String?
  SecuritySectorID_FK       String?
  SecurityIndustryID_FK     String?
  SecurityExchangeID_FK     String?
  SecurityFundCategoryID_FK String?
  SecurityFundFamilyID_FK   String?
  SecurityCustomLabelID_FK  String?
  InvestmentPortfolioID_FK  String?
  ImportedTransactionID_FK  String?
  ScheduledTransactionID_FK String?
  ExchangeRateSetID_FK      String?
  StatementID_FK            String?
  ReportID_FK               String?
  BudgetID_FK               String?
  Position                  Int?
  TypeNumber                Int?
  Name                      String?
  ShortName                 String?
  Info                      String?
  Extension                 String?
  CreationDate              Float?
  AccountGroups             AccountGroups?         @relation(fields: [AccountGroupID_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Accounts                  Accounts?              @relation(fields: [AccountID_FK], references: [AccountID_PK], onDelete: Cascade)
  Budgets                   Budgets?               @relation(fields: [BudgetID_FK], references: [BudgetID_PK], onDelete: Cascade)
  Categories                Categories?            @relation(fields: [CategoryID_FK], references: [CategoryID_PK], onDelete: Cascade)
  CreditScores              CreditScores?          @relation(fields: [CreditScoreID_FK], references: [CreditScoreID_PK], onDelete: Cascade)
  Entities                  Entities?              @relation(fields: [EntityID_FK], references: [EntityID_PK], onDelete: Cascade)
  ExchangeRateSets          ExchangeRateSets?      @relation(fields: [ExchangeRateSetID_FK], references: [ExchangeRateSetID_PK], onDelete: Cascade)
  Flags                     Flags?                 @relation(fields: [FlagID_FK], references: [FlagID_PK], onDelete: Cascade)
  ImportedTransactions      ImportedTransactions?  @relation(fields: [ImportedTransactionID_FK], references: [ImportedTransactionID_PK], onDelete: Cascade)
  InvestmentPortfolios      InvestmentPortfolios?  @relation(fields: [InvestmentPortfolioID_FK], references: [InvestmentPortfolioID_PK])
  Locations                 Locations?             @relation(fields: [LocationID_FK], references: [LocationID_PK], onDelete: Cascade)
  Notes                     Notes?                 @relation(fields: [NoteID_FK], references: [NoteID_PK], onDelete: Cascade)
  Payees                    Payees?                @relation(fields: [PayeeID_FK], references: [PayeeID_PK], onDelete: Cascade)
  Reports                   Reports?               @relation(fields: [ReportID_FK], references: [ReportID_PK], onDelete: Cascade)
  ScheduledTransactions     ScheduledTransactions? @relation(fields: [ScheduledTransactionID_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)
  SecurityAssetClasses      SecurityAssetClasses?  @relation(fields: [SecurityAssetClassID_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)
  SecurityCustomLabels      SecurityCustomLabels?  @relation(fields: [SecurityCustomLabelID_FK], references: [SecurityCustomLabelID_PK])
  SecurityExchanges         SecurityExchanges?     @relation(fields: [SecurityExchangeID_FK], references: [SecurityExchangeID_PK])
  fundCategories            fundCategories?        @relation(fields: [SecurityFundCategoryID_FK], references: [SecurityFundCategoryID_PK], onDelete: Cascade)
  SecurityFundFamilies      SecurityFundFamilies?  @relation(fields: [SecurityFundFamilyID_FK], references: [SecurityFundFamilyID_PK], onDelete: Cascade)
  SecurityGoals             SecurityGoals?         @relation(fields: [SecurityGoalID_FK], references: [SecurityGoalID_PK], onDelete: Cascade)
  SecurityGroups            SecurityGroups?        @relation(fields: [SecurityGroupID_FK], references: [SecurityGroupID_PK], onDelete: Cascade)
  Securities                Securities?            @relation(fields: [SecurityID_FK], references: [SecurityID_PK], onDelete: Cascade)
  SecurityIndustries        SecurityIndustries?    @relation(fields: [SecurityIndustryID_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)
  SecuritySectors           SecuritySectors?       @relation(fields: [SecuritySectorID_FK], references: [SecuritySectorID_PK], onDelete: Cascade)
  Statements                Statements?            @relation(fields: [StatementID_FK], references: [StatementID_PK], onDelete: Cascade)
  Tags                      Tags?                  @relation(fields: [TagID_FK], references: [TagID_PK], onDelete: Cascade)
  Transactions              Transactions?          @relation(fields: [TransactionID_FK], references: [TransactionID_PK], onDelete: Cascade)
  TransactionTypes          TransactionTypes?      @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK], onDelete: Cascade)
}

model BudgetColumnDetails {
  BudgetColumnDetailsID_PK                                         String   @id
  BudgetID_NN_UK_FK                                                String   @unique(map: "sqlite_autoindex_BudgetColumnDetails_2")
  ColumnWidthTypeNumber                                            Int?
  Column1Name                                                      String?
  Column1Width                                                     Int?
  Column2Name                                                      String?
  Column2Width                                                     Int?
  Column3Name                                                      String?
  Column3Width                                                     Int?
  Column4Name                                                      String?
  Column4Width                                                     Int?
  Column5Name                                                      String?
  Column5Width                                                     Int?
  Column6Name                                                      String?
  Column6Width                                                     Int?
  Column7Name                                                      String?
  Column7Width                                                     Int?
  Column8Name                                                      String?
  Column8Width                                                     Int?
  Column9Name                                                      String?
  Column9Width                                                     Int?
  Column10Name                                                     String?
  Column10Width                                                    Int?
  Column11Name                                                     String?
  Column11Width                                                    Int?
  Column12Name                                                     String?
  Column12Width                                                    Int?
  Column13Name                                                     String?
  Column13Width                                                    Int?
  Column14Name                                                     String?
  Column14Width                                                    Int?
  Column15Name                                                     String?
  Column15Width                                                    Int?
  Column16Name                                                     String?
  Column16Width                                                    Int?
  Column17Name                                                     String?
  Column17Width                                                    Int?
  Column18Name                                                     String?
  Column18Width                                                    Int?
  Column19Name                                                     String?
  Column19Width                                                    Int?
  Column20Name                                                     String?
  Column20Width                                                    Int?
  Column21Name                                                     String?
  Column21Width                                                    Int?
  Column22Name                                                     String?
  Column22Width                                                    Int?
  Column23Name                                                     String?
  Column23Width                                                    Int?
  Column24Name                                                     String?
  Column24Width                                                    Int?
  Column25Name                                                     String?
  Column25Width                                                    Int?
  Column26Name                                                     String?
  Column26Width                                                    Int?
  Column27Name                                                     String?
  Column27Width                                                    Int?
  Column28Name                                                     String?
  Column28Width                                                    Int?
  Column29Name                                                     String?
  Column29Width                                                    Int?
  Column30Name                                                     String?
  Column30Width                                                    Int?
  Column31Name                                                     String?
  Column31Width                                                    Int?
  Column32Name                                                     String?
  Column32Width                                                    Int?
  Column33Name                                                     String?
  Column33Width                                                    Int?
  Column34Name                                                     String?
  Column34Width                                                    Int?
  Column35Name                                                     String?
  Column35Width                                                    Int?
  Column36Name                                                     String?
  Column36Width                                                    Int?
  Column37Name                                                     String?
  Column37Width                                                    Int?
  Column38Name                                                     String?
  Column38Width                                                    Int?
  Column39Name                                                     String?
  Column39Width                                                    Int?
  Column40Name                                                     String?
  Column40Width                                                    Int?
  Budgets_BudgetColumnDetails_BudgetID_NN_UK_FKToBudgets           Budgets  @relation("BudgetColumnDetails_BudgetID_NN_UK_FKToBudgets", fields: [BudgetID_NN_UK_FK], references: [BudgetID_PK], onDelete: Cascade)
  Budgets_BudgetColumnDetailsToBudgets_BudgetColumnDetailsID_UK_FK Budgets? @relation("BudgetColumnDetailsToBudgets_BudgetColumnDetailsID_UK_FK")
}

model BudgetGroups {
  BudgetGroupID_PK         String         @id
  ParentID_FK              String?
  Position                 Int?
  TypeNumber               Int?
  IncludeInSidebar         Int?
  IncludeInLists           Int?
  IncludeInBudgets         Int?
  Favorite                 Int?
  Name                     String?
  ShortName                String?
  Info                     String?
  ColorString              String?
  AlternateColorString     String?
  TintColorString          String?
  AlternateTintColorString String?
  ImageData                Bytes?
  AlternateImageData       Bytes?
  Subtitle                 String?
  BudgetGroups             BudgetGroups?  @relation("BudgetGroupsToBudgetGroups_ParentID_FK", fields: [ParentID_FK], references: [BudgetGroupID_PK], onDelete: Cascade)
  other_BudgetGroups       BudgetGroups[] @relation("BudgetGroupsToBudgetGroups_ParentID_FK")
  Budgets                  Budgets[]
}

model BudgetItemSubintervals {
  BudgetItemSubintervalID_PK String      @id
  BudgetItemID_NN_FK         String
  Position                   Int?
  DateIntervalTypeNumber     Int?
  StartDate                  Float?
  EndDate                    Float?
  BudgetedAmount             Float?
  FixedAmount                Float?
  BudgetItems                BudgetItems @relation(fields: [BudgetItemID_NN_FK], references: [BudgetItemID_PK], onDelete: Cascade)
}

model BudgetItems {
  BudgetItemID_PK           String                   @id
  ParentID_FK               String?
  Position                  Int?
  BudgetID_NN_FK            String
  CategoryID_FK             String?
  TypeNumber                Int?
  DateIntervalTypeNumber    Int?
  DateSubintervalTypeNumber Int?
  CurrencyCode              String?
  BudgetedAmountTypeNumber  Int?
  BudgetedAmount            Float?
  FixedAmount               Float?
  Budgets                   Budgets                  @relation(fields: [BudgetID_NN_FK], references: [BudgetID_PK], onDelete: Cascade)
  Categories                Categories?              @relation(fields: [CategoryID_FK], references: [CategoryID_PK], onDelete: Cascade)
  BudgetItems               BudgetItems?             @relation("BudgetItemsToBudgetItems_ParentID_FK", fields: [ParentID_FK], references: [BudgetItemID_PK], onDelete: Cascade)
  BudgetItemSubintervals    BudgetItemSubintervals[]
  other_BudgetItems         BudgetItems[]            @relation("BudgetItemsToBudgetItems_ParentID_FK")
}

model Budgets {
  BudgetID_PK                                                                  String                         @id
  BudgetGroupID_FK                                                             String?
  BudgetColumnDetailsID_UK_FK                                                  String?                        @unique(map: "sqlite_autoindex_Budgets_2")
  ExchangeRateSetID_FK                                                         String?
  Position                                                                     Int?
  TypeNumber                                                                   Int?
  OrientationTypeNumber                                                        Int?
  LayoutTypeNumber                                                             Int?
  ColorSchemeTypeNumber                                                        Int?
  GraphTypeNumber                                                              Int?
  FormatTypeNumber                                                             Int?
  DateRangeTypeNumber                                                          Int?
  StartDate                                                                    Float?
  EndDate                                                                      Float?
  DateIntervalTypeNumber                                                       Int?
  DateIntervalComparisonTypeNumber                                             Int?
  CurrencyCode                                                                 String?
  IncludeInSidebar                                                             Int?
  IncludeInLists                                                               Int?
  IncludeInReports                                                             Int?
  IncludePendingTransactions                                                   Int?
  Favorite                                                                     Int?
  Name                                                                         String?
  ShortName                                                                    String?
  Info                                                                         String?
  IncludeAccountsTypeNumber                                                    Int?
  IncludeCategoriesTypeNumber                                                  Int?
  IncludeTagsTypeNumber                                                        Int?
  IncludeScheduledTransactionsTypeNumber                                       Int?
  IncludeOtherCategoryListing                                                  Int?
  IncludeOtherIncomeCategoryListing                                            Int?
  IncludeOtherExpensesCategoryListing                                          Int?
  IncludeNoCategoryListing                                                     Int?
  IncludeNoIncomeCategoryListing                                               Int?
  IncludeNoExpensesCategoryListing                                             Int?
  IncludeNoTagListing                                                          Int?
  IncludeBalanceAdjustmentsTypeNumber                                          Int?
  IncludeTransfersTypeNumber                                                   Int?
  IncludeTransactionAmountTypeNumber                                           Int?
  IncludeTransactionStatusTypeNumber                                           Int?
  IncludeItemsPastTodayTypeNumber                                              Int?
  IncludeTotalAmountTypeNumber                                                 Int?
  ShowBudgetedItemAmountTypeOptions                                            Int?
  ScalingFactor                                                                Float?
  FontName                                                                     String?
  FontSize                                                                     Float?
  RowHeight                                                                    Float?
  HeadingColorString                                                           String?
  AlternatingRowColorString                                                    String?
  ShowAlternatingRowColor                                                      Int?
  ConstrainGraphXAxisToZero                                                    Int?
  ConstrainGraphYAxisToZero                                                    Int?
  FlipGraphDefaultAxis                                                         Int?
  NumberOfRowsValuesCanExpandInto                                              Int?
  ShowItemsWithShortNames                                                      Int?
  ShowItemsWithoutValues                                                       Int?
  ShowRowInfoAcrossTwoLines                                                    Int?
  ShowAmountsWithoutDecimals                                                   Int?
  ShowTransactionSplitDetails                                                  Int?
  ShowOtherDetails                                                             Int?
  IncludeColumnsTypeNumber                                                     Int?
  ItemSortingTypeNumber                                                        Int?
  TransactionSortingTypeNumber                                                 Int?
  MiscValues                                                                   Bytes?
  BudgetColumnDetails_BudgetColumnDetailsToBudgets_BudgetColumnDetailsID_UK_FK BudgetColumnDetails?           @relation("BudgetColumnDetailsToBudgets_BudgetColumnDetailsID_UK_FK", fields: [BudgetColumnDetailsID_UK_FK], references: [BudgetColumnDetailsID_PK])
  BudgetGroups                                                                 BudgetGroups?                  @relation(fields: [BudgetGroupID_FK], references: [BudgetGroupID_PK])
  ExchangeRateSets                                                             ExchangeRateSets?              @relation(fields: [ExchangeRateSetID_FK], references: [ExchangeRateSetID_PK])
  Attachments                                                                  Attachments[]
  BudgetColumnDetails_BudgetColumnDetails_BudgetID_NN_UK_FKToBudgets           BudgetColumnDetails?           @relation("BudgetColumnDetails_BudgetID_NN_UK_FKToBudgets")
  BudgetItems                                                                  BudgetItems[]
  BudgetsAccounts                                                              BudgetsAccounts[]
  BudgetsCategories                                                            BudgetsCategories[]
  BudgetsScheduledTransactions                                                 BudgetsScheduledTransactions[]
  BudgetsTags                                                                  BudgetsTags[]
  Notes                                                                        Notes[]
}

model BudgetsAccounts {
  BudgetID_NN_FK  String
  AccountID_NN_FK String
  Accounts        Accounts @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  Budgets         Budgets  @relation(fields: [BudgetID_NN_FK], references: [BudgetID_PK], onDelete: Cascade)

  @@id([BudgetID_NN_FK, AccountID_NN_FK])
}

model BudgetsCategories {
  BudgetID_NN_FK   String
  CategoryID_NN_FK String
  Budgets          Budgets    @relation(fields: [BudgetID_NN_FK], references: [BudgetID_PK], onDelete: Cascade)
  Categories       Categories @relation(fields: [CategoryID_NN_FK], references: [CategoryID_PK], onDelete: Cascade)

  @@id([BudgetID_NN_FK, CategoryID_NN_FK])
}

model BudgetsScheduledTransactions {
  BudgetID_NN_FK               String
  ScheduledTransactionID_NN_FK String
  Budgets                      Budgets               @relation(fields: [BudgetID_NN_FK], references: [BudgetID_PK], onDelete: Cascade)
  ScheduledTransactions        ScheduledTransactions @relation(fields: [ScheduledTransactionID_NN_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)

  @@id([BudgetID_NN_FK, ScheduledTransactionID_NN_FK])
}

model BudgetsTags {
  BudgetID_NN_FK String
  TagID_NN_FK    String
  Budgets        Budgets @relation(fields: [BudgetID_NN_FK], references: [BudgetID_PK], onDelete: Cascade)
  Tags           Tags    @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)

  @@id([BudgetID_NN_FK, TagID_NN_FK])
}

model Categories {
  CategoryID_PK                                      String                        @id
  ParentID_FK                                        String?
  Position                                           Int?
  AccountID_UK_FK                                    String?                       @unique(map: "sqlite_autoindex_Categories_2")
  TaxCodeID_FK                                       String?
  TypeNumber                                         Int?
  ExpectedAmountTypeNumber                           Int?
  TaxRelated                                         Int?
  IncludeInLists                                     Int?
  IncludeInReports                                   Int?
  Favorite                                           Int?
  Name                                               String?
  ShortName                                          String?
  Info                                               String?
  ColorString                                        String?
  AlternateColorString                               String?
  TintColorString                                    String?
  AlternateTintColorString                           String?
  ImageData                                          Bytes?
  AlternateImageData                                 Bytes?
  Accounts_AccountsToCategories_AccountID_UK_FK      Accounts?                     @relation("AccountsToCategories_AccountID_UK_FK", fields: [AccountID_UK_FK], references: [AccountID_PK])
  Categories                                         Categories?                   @relation("CategoriesToCategories_ParentID_FK", fields: [ParentID_FK], references: [CategoryID_PK], onDelete: Cascade)
  TaxCodes                                           TaxCodes?                     @relation(fields: [TaxCodeID_FK], references: [TaxCodeID_PK])
  Accounts_Accounts_CategoryID_NN_UK_FKToCategories  Accounts?                     @relation("Accounts_CategoryID_NN_UK_FKToCategories")
  Accounts_Accounts_DefaultCategoryID_FKToCategories Accounts[]                    @relation("Accounts_DefaultCategoryID_FKToCategories")
  Attachments                                        Attachments[]
  BudgetItems                                        BudgetItems[]
  BudgetsCategories                                  BudgetsCategories[]
  other_Categories                                   Categories[]                  @relation("CategoriesToCategories_ParentID_FK")
  LoanTransactionDetails                             LoanTransactionDetails[]
  Notes                                              Notes[]
  ReportForecastDetails                              ReportForecastDetails[]
  ReportGoalDetails                                  ReportGoalDetails[]
  ReportsCategories                                  ReportsCategories[]
  ScheduledTransactions                              ScheduledTransactions[]
  TransactionRuleTransactions                        TransactionRuleTransactions[]
  Transactions                                       Transactions[]
}

model CreditScores {
  CreditScoreID_PK      String                  @id
  EntityID_NN_FK        String
  TypeNumber            Int?
  Name                  String?
  ShortName             String?
  Info                  String?
  Date                  Float?
  ScoreNumber           Int?
  ScoreString           String?
  Entities              Entities                @relation(fields: [EntityID_NN_FK], references: [EntityID_PK], onDelete: Cascade)
  Attachments           Attachments[]
  Notes                 Notes[]
  ReportForecastDetails ReportForecastDetails[]
  ReportGoalDetails     ReportGoalDetails[]
  ReportsCreditScores   ReportsCreditScores[]
}

model DownloadConnections {
  DownloadConnectionID_PK                                           String               @id
  AccountID_NN_UK_FK                                                String               @unique(map: "sqlite_autoindex_DownloadConnections_2")
  InstitutionCustomerID_NN_FK                                       String
  OFXBankID                                                         String?
  OFXBrokerID                                                       String?
  OFXAccountTypeNumber                                              Int?
  LastOFXSignOnResponseCode                                         String?
  LastOFXSignOnResponseSeverity                                     String?
  LastOFXSignOnResponseMessage                                      String?
  LastOFXAccountResponseCode                                        String?
  LastOFXAccountResponseSeverity                                    String?
  LastOFXAccountResponseMessage                                     String?
  LastOFXTransactionRequestDate                                     Float?
  LastOFXTransactionRequestEndDate                                  Float?
  LastSuccessfulOFXTransactionRequestDate                           Float?
  LastSuccessfulOFXTransactionRequestEndDate                        Float?
  Accounts_AccountsToDownloadConnections_AccountID_NN_UK_FK         Accounts             @relation("AccountsToDownloadConnections_AccountID_NN_UK_FK", fields: [AccountID_NN_UK_FK], references: [AccountID_PK], onDelete: Cascade)
  InstitutionCustomers                                              InstitutionCustomers @relation(fields: [InstitutionCustomerID_NN_FK], references: [InstitutionCustomerID_PK], onDelete: Cascade)
  Accounts_Accounts_DownloadConnectionID_UK_FKToDownloadConnections Accounts?            @relation("Accounts_DownloadConnectionID_UK_FKToDownloadConnections")
}

model Entities {
  EntityID_PK                              String                         @id
  PayeeID_NN_UK_FK                         String                         @unique(map: "sqlite_autoindex_Entities_2")
  Position                                 Int?
  TypeNumber                               Int?
  Name                                     String?
  ShortName                                String?
  Info                                     String?
  ColorString                              String?
  AlternateColorString                     String?
  TintColorString                          String?
  AlternateTintColorString                 String?
  ImageData                                Bytes?
  AlternateImageData                       Bytes?
  CountryCodeForTaxes                      String?
  IdentifierTypeNumber                     Int?
  Identifier                               String?
  Birthdate                                Float?
  Payees_Entities_PayeeID_NN_UK_FKToPayees Payees                         @relation("Entities_PayeeID_NN_UK_FKToPayees", fields: [PayeeID_NN_UK_FK], references: [PayeeID_PK], onDelete: Cascade)
  AccountsUsers                            AccountsUsers[]
  Attachments                              Attachments[]
  CreditScores                             CreditScores[]
  InvestmentPortfoliosEntities             InvestmentPortfoliosEntities[]
  Notes                                    Notes[]
  Payees_EntitiesToPayees_EntityID_UK_FK   Payees?                        @relation("EntitiesToPayees_EntityID_UK_FK")
  ReportForecastDetails                    ReportForecastDetails[]
  ReportGoalDetails                        ReportGoalDetails[]
  ReportsEntities                          ReportsEntities[]
  ScheduledTransactions                    ScheduledTransactions[]
  TransactionRuleTransactions              TransactionRuleTransactions[]
  Transactions                             Transactions[]
}

model ExchangeRateSets {
  ExchangeRateSetID_PK String          @id
  TypeNumber           Int?
  Name                 String?
  ShortName            String?
  Info                 String?
  Date                 Float?
  Attachments          Attachments[]
  Budgets              Budgets[]
  ExchangeRates        ExchangeRates[]
  Notes                Notes[]
  Reports              Reports[]
}

model ExchangeRates {
  ExchangeRateID_PK        String            @id
  ExchangeRateSetID_FK     String?
  UpdateBehaviorTypeNumber Int?
  BaseCurrencyCode         String?
  TermCurrencyCode         String?
  ExchangeRate             Float?
  ExchangeRateAsOfDate     Float?
  ExchangeRateSets         ExchangeRateSets? @relation(fields: [ExchangeRateSetID_FK], references: [ExchangeRateSetID_PK], onDelete: Cascade)
}

model Flags {
  FlagID_PK                   String                        @id
  TypeNumber                  Int?
  StyleNumber                 Int?
  BehaviorNumber              Int?
  IncludeInLists              Int?
  IncludeInReports            Int?
  Favorite                    Int?
  Name                        String?
  ShortName                   String?
  Info                        String?
  ColorString                 String?
  AlternateColorString        String?
  TintColorString             String?
  AlternateTintColorString    String?
  ImageData                   Bytes?
  AlternateImageData          Bytes?
  Accounts                    Accounts[]
  Attachments                 Attachments[]
  Notes                       Notes[]
  ReportsFlags                ReportsFlags[]
  ScheduledTransactions       ScheduledTransactions[]
  TransactionRuleTransactions TransactionRuleTransactions[]
  Transactions                Transactions[]
}

model GoalAccountDetails {
  GoalAccountDetailsID_PK                                                                      String                 @id
  AccountID_NN_UK_FK                                                                           String                 @unique(map: "sqlite_autoindex_GoalAccountDetails_2")
  PaymentAccountID_FK                                                                          String?
  ScheduledTransactionID_UK_FK                                                                 String?                @unique(map: "sqlite_autoindex_GoalAccountDetails_3")
  TypeNumber                                                                                   Int?
  GoalAmount                                                                                   Float?
  StartDate                                                                                    Float?
  EndDate                                                                                      Float?
  DateIntervalTypeNumber                                                                       Int?
  PeriodicAmount                                                                               Float?
  HasOfferedToSetupSchedule                                                                    Int?
  MiscValues                                                                                   Bytes?
  Accounts_AccountsToGoalAccountDetails_AccountID_NN_UK_FK                                     Accounts               @relation("AccountsToGoalAccountDetails_AccountID_NN_UK_FK", fields: [AccountID_NN_UK_FK], references: [AccountID_PK], onDelete: Cascade)
  Accounts_AccountsToGoalAccountDetails_PaymentAccountID_FK                                    Accounts?              @relation("AccountsToGoalAccountDetails_PaymentAccountID_FK", fields: [PaymentAccountID_FK], references: [AccountID_PK])
  ScheduledTransactions_GoalAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions ScheduledTransactions? @relation("GoalAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions", fields: [ScheduledTransactionID_UK_FK], references: [ScheduledTransactionID_PK])
  Accounts_Accounts_GoalAccountDetailsID_UK_FKToGoalAccountDetails                             Accounts?              @relation("Accounts_GoalAccountDetailsID_UK_FKToGoalAccountDetails")
  ScheduledTransactions_GoalAccountDetailsToScheduledTransactions_GoalAccountDetailsID_UK_FK   ScheduledTransactions? @relation("GoalAccountDetailsToScheduledTransactions_GoalAccountDetailsID_UK_FK")
}

model HistoricalPrices {
  HistoricalPriceID_PK String     @id
  SecurityID_NN_FK     String
  OriginNumber         Int?
  Date                 Float?
  Open                 Float?
  High                 Float?
  Low                  Float?
  Close                Float?
  Volume               Float?
  AdjustedClose        Float?
  Securities           Securities @relation(fields: [SecurityID_NN_FK], references: [SecurityID_PK], onDelete: Cascade)
}

model ImportLogs {
  ImportLogID_PK                                String   @id
  ImportID_NN_UK_FK                             String   @unique(map: "sqlite_autoindex_ImportLogs_2")
  TypeNumber                                    Int?
  Name                                          String?
  Extension                                     String?
  Log                                           String?
  Imports_ImportLogs_ImportID_NN_UK_FKToImports Imports  @relation("ImportLogs_ImportID_NN_UK_FKToImports", fields: [ImportID_NN_UK_FK], references: [ImportID_PK], onDelete: Cascade)
  Imports_ImportLogsToImports_ImportLogID_UK_FK Imports? @relation("ImportLogsToImports_ImportLogID_UK_FK")
}

model ImportedAccounts {
  ImportedAccountID_PK String                 @id
  ImportID_NN_FK       String
  AccountID_NN_FK      String
  OrderInImport        Int?
  TypeNumber           Int?
  CurrencyCode         String?
  NameInImport         String?
  ActualAccountName    String?
  InstitutionName      String?
  Info                 String?
  RequestedStartDate   Float?
  RequestedEndDate     Float?
  StartDate            Float?
  EndDate              Float?
  FirstTransactionDate Float?
  LastTransactionDate  Float?
  StartingBalance      Float?
  AvailableBalance     Float?
  AvailableBalanceDate Float?
  LedgerBalance        Float?
  LedgerBalanceDate    Float?
  InterestRate         Float?
  CreditLimit          Float?
  Imported             Int?
  ImportedForCreating  Int?
  Accounts             Accounts               @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  Imports              Imports                @relation(fields: [ImportID_NN_FK], references: [ImportID_PK], onDelete: Cascade)
  ImportedTransactions ImportedTransactions[]
}

model ImportedInvestmentTransactionDetails {
  ImportedInvestmentTransactionDetailsID_PK                                                                                    String                @id
  ImportedTransactionID_NN_UK_FK                                                                                               String                @unique(map: "sqlite_autoindex_ImportedInvestmentTransactionDetails_2")
  SecurityAction                                                                                                               String?
  Name                                                                                                                         String?
  IdentifierTypeNumber                                                                                                         Int?
  Identifier                                                                                                                   String?
  Symbol                                                                                                                       String?
  FundingTypeNumber                                                                                                            Int?
  EffectiveDate                                                                                                                Float?
  Units                                                                                                                        Float?
  UnitPrice                                                                                                                    Float?
  Commission                                                                                                                   Float?
  ImportedTransactions_ImportedInvestmentTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions               ImportedTransactions  @relation("ImportedInvestmentTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions", fields: [ImportedTransactionID_NN_UK_FK], references: [ImportedTransactionID_PK], onDelete: Cascade)
  ImportedTransactions_ImportedInvestmentTransactionDetailsToImportedTransactions_ImportedInvestmentTransactionDetailsID_UK_FK ImportedTransactions? @relation("ImportedInvestmentTransactionDetailsToImportedTransactions_ImportedInvestmentTransactionDetailsID_UK_FK")
}

model ImportedLoanTransactionDetails {
  ImportedLoanTransactionDetailsID_PK                                                                              String                @id
  ImportedTransactionID_NN_UK_FK                                                                                   String                @unique(map: "sqlite_autoindex_ImportedLoanTransactionDetails_2")
  ImportedTransactions_ImportedLoanTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions         ImportedTransactions  @relation("ImportedLoanTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions", fields: [ImportedTransactionID_NN_UK_FK], references: [ImportedTransactionID_PK], onDelete: Cascade)
  ImportedTransactions_ImportedLoanTransactionDetailsToImportedTransactions_ImportedLoanTransactionDetailsID_UK_FK ImportedTransactions? @relation("ImportedLoanTransactionDetailsToImportedTransactions_ImportedLoanTransactionDetailsID_UK_FK")
}

model ImportedTransactions {
  ImportedTransactionID_PK                                                                                                                     String                                @id
  ParentID_FK                                                                                                                                  String?
  Position                                                                                                                                     Int?
  ImportedAccountID_FK                                                                                                                         String?
  ImportedInvestmentTransactionDetailsID_UK_FK                                                                                                 String?                               @unique(map: "sqlite_autoindex_ImportedTransactions_2")
  ImportedLoanTransactionDetailsID_UK_FK                                                                                                       String?                               @unique(map: "sqlite_autoindex_ImportedTransactions_3")
  TransactionID_UK_FK                                                                                                                          String?                               @unique(map: "sqlite_autoindex_ImportedTransactions_4")
  OrderInImport                                                                                                                                Int?
  UniqueID                                                                                                                                     String?
  OriginalCurrencyCode                                                                                                                         String?
  OriginalCurrencyRate                                                                                                                         Float?
  DateString                                                                                                                                   String?
  Date                                                                                                                                         Float?
  ClearedDate                                                                                                                                  Float?
  Payee                                                                                                                                        String?
  TransactionType                                                                                                                              String?
  TransactionTypeTypeNumber                                                                                                                    Int?
  Category                                                                                                                                     String?
  Tags                                                                                                                                         String?
  Memo                                                                                                                                         String?
  CheckNumber                                                                                                                                  String?
  TransactionNumber                                                                                                                            String?
  Amount                                                                                                                                       Float?
  AmountAppliedToBalance                                                                                                                       Float?
  StatusNumber                                                                                                                                 Int?
  Imported                                                                                                                                     Int?
  ActionNumber                                                                                                                                 Int?
  ImportedAccounts                                                                                                                             ImportedAccounts?                     @relation(fields: [ImportedAccountID_FK], references: [ImportedAccountID_PK])
  ImportedInvestmentTransactionDetails_ImportedInvestmentTransactionDetailsToImportedTransactions_ImportedInvestmentTransactionDetailsID_UK_FK ImportedInvestmentTransactionDetails? @relation("ImportedInvestmentTransactionDetailsToImportedTransactions_ImportedInvestmentTransactionDetailsID_UK_FK", fields: [ImportedInvestmentTransactionDetailsID_UK_FK], references: [ImportedInvestmentTransactionDetailsID_PK])
  ImportedLoanTransactionDetails_ImportedLoanTransactionDetailsToImportedTransactions_ImportedLoanTransactionDetailsID_UK_FK                   ImportedLoanTransactionDetails?       @relation("ImportedLoanTransactionDetailsToImportedTransactions_ImportedLoanTransactionDetailsID_UK_FK", fields: [ImportedLoanTransactionDetailsID_UK_FK], references: [ImportedLoanTransactionDetailsID_PK])
  ImportedTransactions                                                                                                                         ImportedTransactions?                 @relation("ImportedTransactionsToImportedTransactions_ParentID_FK", fields: [ParentID_FK], references: [ImportedTransactionID_PK], onDelete: Cascade)
  Transactions_ImportedTransactions_TransactionID_UK_FKToTransactions                                                                          Transactions?                         @relation("ImportedTransactions_TransactionID_UK_FKToTransactions", fields: [TransactionID_UK_FK], references: [TransactionID_PK])
  Attachments                                                                                                                                  Attachments[]
  ImportedInvestmentTransactionDetails_ImportedInvestmentTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions               ImportedInvestmentTransactionDetails? @relation("ImportedInvestmentTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions")
  ImportedLoanTransactionDetails_ImportedLoanTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions                           ImportedLoanTransactionDetails?       @relation("ImportedLoanTransactionDetails_ImportedTransactionID_NN_UK_FKToImportedTransactions")
  other_ImportedTransactions                                                                                                                   ImportedTransactions[]                @relation("ImportedTransactionsToImportedTransactions_ParentID_FK")
  Transactions_ImportedTransactionsToTransactions_ImportedTransactionID_UK_FK                                                                  Transactions?                         @relation("ImportedTransactionsToTransactions_ImportedTransactionID_UK_FK")
}

model Imports {
  ImportID_PK                                      String             @id
  ImportLogID_UK_FK                                String?            @unique(map: "sqlite_autoindex_Imports_2")
  StatementID_UK_FK                                String?            @unique(map: "sqlite_autoindex_Imports_3")
  TypeNumber                                       Int?
  FileTypeNumber                                   Int?
  OriginNumber                                     Int?
  Date                                             Float?
  UserName                                         String?
  HardwareUUID                                     String?
  DeviceName                                       String?
  StartDate                                        Float?
  EndDate                                          Float?
  FirstTransactionDate                             Float?
  LastTransactionDate                              Float?
  ImportLogs_ImportLogsToImports_ImportLogID_UK_FK ImportLogs?        @relation("ImportLogsToImports_ImportLogID_UK_FK", fields: [ImportLogID_UK_FK], references: [ImportLogID_PK])
  Statements_Imports_StatementID_UK_FKToStatements Statements?        @relation("Imports_StatementID_UK_FKToStatements", fields: [StatementID_UK_FK], references: [StatementID_PK], onDelete: Cascade)
  ImportLogs_ImportLogs_ImportID_NN_UK_FKToImports ImportLogs?        @relation("ImportLogs_ImportID_NN_UK_FKToImports")
  ImportedAccounts                                 ImportedAccounts[]
  Statements_ImportsToStatements_ImportID_UK_FK    Statements?        @relation("ImportsToStatements_ImportID_UK_FK")
}

model InstitutionCustomers {
  InstitutionCustomerID_PK String                @id
  InstitutionID_NN_FK      String
  OFXClientID              String?
  OFXHasChangedPIN         Int?
  Institutions             Institutions          @relation(fields: [InstitutionID_NN_FK], references: [InstitutionID_PK], onDelete: Cascade)
  DownloadConnections      DownloadConnections[]
}

model Institutions {
  InstitutionID_PK                  String                 @id
  TypeNumber                        Int?
  SCCode                            String?
  AllowsDirectConnect               Int?
  AllowsWebConnect                  Int?
  AllowsExpressWebConnect           Int?
  Name                              String?
  ShortName                         String?
  Info                              String?
  ColorString                       String?
  AlternateColorString              String?
  TintColorString                   String?
  AlternateTintColorString          String?
  ImageData                         Bytes?
  AlternateImageData                Bytes?
  Address1                          String?
  Address2                          String?
  Address3                          String?
  City                              String?
  State                             String?
  ZipCode                           String?
  Country                           String?
  CustomerServicePhone              String?
  TechnicalSupportPhone             String?
  WebsiteURL                        String?
  LogoURL                           String?
  OFXLastProfileRequestDate         Float?
  OFXAppID                          String?
  OFXAppVersion                     String?
  OFXURL                            String?
  OFXHeader                         String?
  OFXVersion                        String?
  OFXOrg                            String?
  OFXFID                            String?
  OFXBankID                         String?
  OFXIntuitBankID                   String?
  OFXBrokerID                       String?
  OFXPINMinCharacters               Int?
  OFXPINMaxCharacters               Int?
  OFXPINCharacterType               String?
  OFXPINCaseSensitive               Int?
  OFXPINAllowSpecialCharacters      Int?
  OFXPINAllowSpaceCharacters        Int?
  OFXCanChangePin                   Int?
  OFXChangePinFirst                 Int?
  OFXClientIDRequired               Int?
  OFXAccountDiscoveryAvailable      Int?
  OFXDirectConnectSetupOptionNumber Int?
  OFXSendRequestsWithLineBreaks     Int?
  OFXAddTrailingSlashToRequestURLs  Int?
  OFXSignOnURL                      String?
  OFXSignUpURL                      String?
  OFXBankURL                        String?
  OFXCreditCardURL                  String?
  OFXLoanURL                        String?
  OFXInvestmentURL                  String?
  OFXInterbankTransferURL           String?
  OFXWireTransferURL                String?
  OFXBillPayURL                     String?
  OFXEmailURL                       String?
  OFXSecurityListURL                String?
  OFXBillerDirectoryURL             String?
  OFXBillDeliveryURL                String?
  OFXProfileURL                     String?
  OFXImageDownloadURL               String?
  Accounts                          Accounts[]
  InstitutionCustomers              InstitutionCustomers[]
}

model InvestmentAccountDetails {
  InvestmentAccountDetailsID_PK                                                String      @id
  AccountID_NN_UK_FK                                                           String      @unique(map: "sqlite_autoindex_InvestmentAccountDetails_2")
  DefaultSecurityID_FK                                                         String?
  DefaultEquityLotTrackingTypeNumber                                           Int?
  DefaultMutualFundLotTrackingTypeNumber                                       Int?
  DefaultDebtInstrumentLotTrackingTypeNumber                                   Int?
  DefaultDerivativeLotTrackingTypeNumber                                       Int?
  DefaultOtherLotTrackingTypeNumber                                            Int?
  MiscValues                                                                   Bytes?
  Accounts_AccountsToInvestmentAccountDetails_AccountID_NN_UK_FK               Accounts    @relation("AccountsToInvestmentAccountDetails_AccountID_NN_UK_FK", fields: [AccountID_NN_UK_FK], references: [AccountID_PK], onDelete: Cascade)
  Securities                                                                   Securities? @relation(fields: [DefaultSecurityID_FK], references: [SecurityID_PK])
  Accounts_Accounts_InvestmentAccountDetailsID_UK_FKToInvestmentAccountDetails Accounts?   @relation("Accounts_InvestmentAccountDetailsID_UK_FKToInvestmentAccountDetails")
}

model InvestmentAccountPositionMarketValues {
  InvestmentAccountPositionMarketValueID_PK String                      @id
  InvestmentAccountPositionID_FK            String?
  Date                                      Float?
  Units                                     Float?
  UnitPrice                                 Float?
  InvestmentAccountPositions                InvestmentAccountPositions? @relation(fields: [InvestmentAccountPositionID_FK], references: [InvestmentAccountPositionID_PK], onDelete: Cascade)
}

model InvestmentAccountPositions {
  InvestmentAccountPositionID_PK         String                                  @id
  InvestmentAggregatePositionID_FK       String?
  TypeNumber                             Int?
  OpenDate                               Float?
  AdjustedUnits                          Float?
  AdjustedTotalAmount                    Float?
  AdjustedCostBasis                      Float?
  AdjustedSalesProceeds                  Float?
  RealizedUnits                          Float?
  RealizedShortTermUnits                 Float?
  RealizedLongTermUnits                  Float?
  RealizedCosts                          Float?
  RealizedShortTermCosts                 Float?
  RealizedLongTermCosts                  Float?
  RealizedPurchaseAmount                 Float?
  RealizedShortTermPurchaseAmount        Float?
  RealizedLongTermPurchaseAmount         Float?
  RealizedPurchaseCosts                  Float?
  RealizedShortTermPurchaseCosts         Float?
  RealizedLongTermPurchaseCosts          Float?
  RealizedCostBasis                      Float?
  RealizedShortTermCostBasis             Float?
  RealizedLongTermCostBasis              Float?
  RealizedIncomeAmount                   Float?
  RealizedShortTermIncomeAmount          Float?
  RealizedLongTermIncomeAmount           Float?
  RealizedIncomeCosts                    Float?
  RealizedShortTermIncomeCosts           Float?
  RealizedLongTermIncomeCosts            Float?
  RealizedInterestIncomeAmount           Float?
  RealizedShortTermInterestIncomeAmount  Float?
  RealizedLongTermInterestIncomeAmount   Float?
  RealizedInterestIncomeCosts            Float?
  RealizedShortTermInterestIncomeCosts   Float?
  RealizedLongTermInterestIncomeCosts    Float?
  RealizedInterestExpenseAmount          Float?
  RealizedShortTermInterestExpenseAmount Float?
  RealizedLongTermInterestExpenseAmount  Float?
  RealizedInterestExpenseCosts           Float?
  RealizedShortTermInterestExpenseCosts  Float?
  RealizedLongTermInterestExpenseCosts   Float?
  RealizedMiscIncomeAmount               Float?
  RealizedShortTermMiscIncomeAmount      Float?
  RealizedLongTermMiscIncomeAmount       Float?
  RealizedMiscIncomeCosts                Float?
  RealizedShortTermMiscIncomeCosts       Float?
  RealizedLongTermMiscIncomeCosts        Float?
  RealizedMiscExpenseAmount              Float?
  RealizedShortTermMiscExpenseAmount     Float?
  RealizedLongTermMiscExpenseAmount      Float?
  RealizedMiscExpenseCosts               Float?
  RealizedShortTermMiscExpenseCosts      Float?
  RealizedLongTermMiscExpenseCosts       Float?
  RealizedSalesAmount                    Float?
  RealizedShortTermSalesAmount           Float?
  RealizedLongTermSalesAmount            Float?
  RealizedSalesCosts                     Float?
  RealizedShortTermSalesCosts            Float?
  RealizedLongTermSalesCosts             Float?
  RealizedSalesProceeds                  Float?
  RealizedShortTermSalesProceeds         Float?
  RealizedLongTermSalesProceeds          Float?
  RealizedGainLoss                       Float?
  RealizedPercentGainLoss                Float?
  RealizedShortTermGainLoss              Float?
  RealizedShortTermPercentGainLoss       Float?
  RealizedLongTermGainLoss               Float?
  RealizedLongTermPercentGainLoss        Float?
  RealizedReturn                         Float?
  RealizedShortTermReturn                Float?
  RealizedLongTermReturn                 Float?
  OutstandingUnits                       Float?
  OutstandingCostBasis                   Float?
  OutstandingSalesProceeds               Float?
  InvestmentAggregatePositions           InvestmentAggregatePositions?           @relation(fields: [InvestmentAggregatePositionID_FK], references: [InvestmentAggregatePositionID_PK])
  InvestmentAccountPositionMarketValues  InvestmentAccountPositionMarketValues[]
  InvestmentTransactionDetails           InvestmentTransactionDetails[]
}

model InvestmentAggregatePositionMarketValues {
  InvestmentAggregatePositionMarketValueID_PK String                        @id
  InvestmentAggregatePositionID_FK            String?
  Date                                        Float?
  Units                                       Float?
  UnitPrice                                   Float?
  InvestmentAggregatePositions                InvestmentAggregatePositions? @relation(fields: [InvestmentAggregatePositionID_FK], references: [InvestmentAggregatePositionID_PK], onDelete: Cascade)
}

model InvestmentAggregatePositions {
  InvestmentAggregatePositionID_PK        String                                    @id
  TypeNumber                              Int?
  OpenDate                                Float?
  AdjustedUnits                           Float?
  RealizedUnits                           Float?
  RealizedShortTermUnits                  Float?
  RealizedLongTermUnits                   Float?
  OutstandingUnits                        Float?
  InvestmentAccountPositions              InvestmentAccountPositions[]
  InvestmentAggregatePositionMarketValues InvestmentAggregatePositionMarketValues[]
}

model InvestmentPortfolios {
  InvestmentPortfolioID_PK                   String                                       @id
  ParentID_FK                                String?
  Position                                   Int?
  TypeNumber                                 Int?
  DateRangeTypeNumber                        Int?
  UseCurrentDate                             Int?
  Date                                       Float?
  StartDate                                  Float?
  EndDate                                    Float?
  IncludeInLists                             Int?
  IncludeInReports                           Int?
  IncludePendingTransactions                 Int?
  Favorite                                   Int?
  Name                                       String?
  ShortName                                  String?
  Info                                       String?
  ColorString                                String?
  AlternateColorString                       String?
  TintColorString                            String?
  AlternateTintColorString                   String?
  ImageData                                  Bytes?
  AlternateImageData                         Bytes?
  IncludeEntitiesTypeNumber                  Int?
  IncludeAccountGroupsTypeNumber             Int?
  IncludeAccountsTypeNumber                  Int?
  IncludeSecurityTypesTypeNumber             Int?
  IncludeSecuritiesTypeNumber                Int?
  IncludeSecurityGroupsTypeNumber            Int?
  IncludeSecurityGoalsTypeNumber             Int?
  IncludeSecurityAssetClassesTypeNumber      Int?
  IncludeSecuritySectorsTypeNumber           Int?
  IncludeSecurityIndustriesTypeNumber        Int?
  IncludeSecurityExchangesTypeNumber         Int?
  IncludeSecurityFundCategoriesTypeNumber    Int?
  IncludeSecurityFundFamiliesTypeNumber      Int?
  IncludeSecurityCustomLabelsTypeNumber      Int?
  InvestmentPortfolios                       InvestmentPortfolios?                        @relation("InvestmentPortfoliosToInvestmentPortfolios_ParentID_FK", fields: [ParentID_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  Attachments                                Attachments[]
  other_InvestmentPortfolios                 InvestmentPortfolios[]                       @relation("InvestmentPortfoliosToInvestmentPortfolios_ParentID_FK")
  InvestmentPortfoliosAccountGroups          InvestmentPortfoliosAccountGroups[]
  InvestmentPortfoliosAccounts               InvestmentPortfoliosAccounts[]
  InvestmentPortfoliosEntities               InvestmentPortfoliosEntities[]
  InvestmentPortfoliosSecurities             InvestmentPortfoliosSecurities[]
  InvestmentPortfoliosSecurityAssetClasses   InvestmentPortfoliosSecurityAssetClasses[]
  InvestmentPortfoliosSecurityCustomLabels   InvestmentPortfoliosSecurityCustomLabels[]
  InvestmentPortfoliosSecurityExchanges      InvestmentPortfoliosSecurityExchanges[]
  InvestmentPortfoliosSecurityFundCategories InvestmentPortfoliosSecurityFundCategories[]
  InvestmentPortfoliosSecurityFundFamilies   InvestmentPortfoliosSecurityFundFamilies[]
  InvestmentPortfoliosSecurityGoals          InvestmentPortfoliosSecurityGoals[]
  InvestmentPortfoliosSecurityGroups         InvestmentPortfoliosSecurityGroups[]
  InvestmentPortfoliosSecurityIndustries     InvestmentPortfoliosSecurityIndustries[]
  InvestmentPortfoliosSecuritySectors        InvestmentPortfoliosSecuritySectors[]
  InvestmentPortfoliosSecurityTypes          InvestmentPortfoliosSecurityTypes[]
  Notes                                      Notes[]
  ReportForecastDetails                      ReportForecastDetails[]
  ReportGoalDetails                          ReportGoalDetails[]
  ReportsInvestmentPortfolios                ReportsInvestmentPortfolios[]
}

model InvestmentPortfoliosAccountGroups {
  InvestmentPortfolioID_NN_FK String
  AccountGroupID_NN_FK        String
  AccountGroups               AccountGroups        @relation(fields: [AccountGroupID_NN_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, AccountGroupID_NN_FK])
}

model InvestmentPortfoliosAccounts {
  InvestmentPortfolioID_NN_FK String
  AccountID_NN_FK             String
  Accounts                    Accounts             @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, AccountID_NN_FK])
}

model InvestmentPortfoliosEntities {
  InvestmentPortfolioID_NN_FK String
  EntityID_NN_FK              String
  Entities                    Entities             @relation(fields: [EntityID_NN_FK], references: [EntityID_PK], onDelete: Cascade)
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, EntityID_NN_FK])
}

model InvestmentPortfoliosSecurities {
  InvestmentPortfolioID_NN_FK String
  SecurityID_NN_FK            String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  Securities                  Securities           @relation(fields: [SecurityID_NN_FK], references: [SecurityID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityID_NN_FK])
}

model InvestmentPortfoliosSecurityAssetClasses {
  InvestmentPortfolioID_NN_FK String
  SecurityAssetClassID_NN_FK  String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityAssetClasses        SecurityAssetClasses @relation(fields: [SecurityAssetClassID_NN_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityAssetClassID_NN_FK])
}

model InvestmentPortfoliosSecurityCustomLabels {
  InvestmentPortfolioID_NN_FK String
  SecurityCustomLabelID_NN_FK String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityCustomLabels        SecurityCustomLabels @relation(fields: [SecurityCustomLabelID_NN_FK], references: [SecurityCustomLabelID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityCustomLabelID_NN_FK])
}

model InvestmentPortfoliosSecurityExchanges {
  InvestmentPortfolioID_NN_FK String
  SecurityExchangeID_NN_FK    String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityExchanges           SecurityExchanges    @relation(fields: [SecurityExchangeID_NN_FK], references: [SecurityExchangeID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityExchangeID_NN_FK])
}

model InvestmentPortfoliosSecurityFundCategories {
  InvestmentPortfolioID_NN_FK  String
  SecurityFundCategoryID_NN_FK String
  InvestmentPortfolios         InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  fundCategories               fundCategories       @relation(fields: [SecurityFundCategoryID_NN_FK], references: [SecurityFundCategoryID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityFundCategoryID_NN_FK])
}

model InvestmentPortfoliosSecurityFundFamilies {
  InvestmentPortfolioID_NN_FK String
  SecurityFundFamilyID_NN_FK  String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityFundFamilies        SecurityFundFamilies @relation(fields: [SecurityFundFamilyID_NN_FK], references: [SecurityFundFamilyID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityFundFamilyID_NN_FK])
}

model InvestmentPortfoliosSecurityGoals {
  InvestmentPortfolioID_NN_FK String
  SecurityGoalID_NN_FK        String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityGoals               SecurityGoals        @relation(fields: [SecurityGoalID_NN_FK], references: [SecurityGoalID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityGoalID_NN_FK])
}

model InvestmentPortfoliosSecurityGroups {
  InvestmentPortfolioID_NN_FK String
  SecurityGroupID_NN_FK       String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityGroups              SecurityGroups       @relation(fields: [SecurityGroupID_NN_FK], references: [SecurityGroupID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityGroupID_NN_FK])
}

model InvestmentPortfoliosSecurityIndustries {
  InvestmentPortfolioID_NN_FK String
  SecurityIndustryID_NN_FK    String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityIndustries          SecurityIndustries   @relation(fields: [SecurityIndustryID_NN_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityIndustryID_NN_FK])
}

model InvestmentPortfoliosSecuritySectors {
  InvestmentPortfolioID_NN_FK String
  SecuritySectorID_NN_FK      String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecuritySectors             SecuritySectors      @relation(fields: [SecuritySectorID_NN_FK], references: [SecuritySectorID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecuritySectorID_NN_FK])
}

model InvestmentPortfoliosSecurityTypes {
  InvestmentPortfolioID_NN_FK String
  SecurityTypeID_NN_FK        String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  SecurityTypes               SecurityTypes        @relation(fields: [SecurityTypeID_NN_FK], references: [SecurityTypeID_PK], onDelete: Cascade)

  @@id([InvestmentPortfolioID_NN_FK, SecurityTypeID_NN_FK])
}

model InvestmentTransactionDetails {
  InvestmentTransactionDetailsID_PK                                                                                                           String                             @id
  TransactionID_UK_FK                                                                                                                         String?                            @unique(map: "sqlite_autoindex_InvestmentTransactionDetails_2")
  ScheduledTransactionID_UK_FK                                                                                                                String?                            @unique(map: "sqlite_autoindex_InvestmentTransactionDetails_3")
  TransactionRuleTransactionID_UK_FK                                                                                                          String?                            @unique(map: "sqlite_autoindex_InvestmentTransactionDetails_4")
  SecurityID_FK                                                                                                                               String?
  InvestmentAccountPositionID_FK                                                                                                              String?
  LotTrackingTypeNumber                                                                                                                       Int?
  EffectTypeNumber                                                                                                                            Int?
  EffectiveDate                                                                                                                               Float?
  OriginalSecurityCurrencyRate                                                                                                                Float?
  Units                                                                                                                                       Float?
  UnitPrice                                                                                                                                   Float?
  Commission                                                                                                                                  Float?
  OtherAmountTypeNumber                                                                                                                       Int?
  OtherAmount                                                                                                                                 Float?
  TotalAmount                                                                                                                                 Float?
  AdjustedUnits                                                                                                                               Float?
  AdjustedTotalAmount                                                                                                                         Float?
  AdjustedCostBasis                                                                                                                           Float?
  AdjustedSalesProceeds                                                                                                                       Float?
  RealizedUnits                                                                                                                               Float?
  RealizedCostBasis                                                                                                                           Float?
  RealizedSalesProceeds                                                                                                                       Float?
  RealizedGainLoss                                                                                                                            Float?
  RealizedPercentGainLoss                                                                                                                     Float?
  RealizedReturn                                                                                                                              Float?
  OutstandingUnits                                                                                                                            Float?
  OutstandingCostBasis                                                                                                                        Float?
  OutstandingSalesProceeds                                                                                                                    Float?
  RunningPositionRealizedUnits                                                                                                                Float?
  RunningPositionRealizedCostBasis                                                                                                            Float?
  RunningPositionRealizedSalesProceeds                                                                                                        Float?
  RunningPositionRealizedGainLoss                                                                                                             Float?
  RunningPositionRealizedPercentGainLoss                                                                                                      Float?
  RunningPositionRealizedReturn                                                                                                               Float?
  RunningPositionOutstandingUnits                                                                                                             Float?
  RunningPositionOutstandingCostBasis                                                                                                         Float?
  RunningPositionOutstandingSalesProceeds                                                                                                     Float?
  InvestmentAccountPositions                                                                                                                  InvestmentAccountPositions?        @relation(fields: [InvestmentAccountPositionID_FK], references: [InvestmentAccountPositionID_PK])
  ScheduledTransactions_InvestmentTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions                                      ScheduledTransactions?             @relation("InvestmentTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions", fields: [ScheduledTransactionID_UK_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)
  Securities                                                                                                                                  Securities?                        @relation(fields: [SecurityID_FK], references: [SecurityID_PK])
  Transactions_InvestmentTransactionDetails_TransactionID_UK_FKToTransactions                                                                 Transactions?                      @relation("InvestmentTransactionDetails_TransactionID_UK_FKToTransactions", fields: [TransactionID_UK_FK], references: [TransactionID_PK], onDelete: Cascade)
  TransactionRuleTransactions_InvestmentTransactionDetails_TransactionRuleTransactionID_UK_FKToTransactionRuleTransactions                    TransactionRuleTransactions?       @relation("InvestmentTransactionDetails_TransactionRuleTransactionID_UK_FKToTransactionRuleTransactions", fields: [TransactionRuleTransactionID_UK_FK], references: [TransactionRuleTransactionID_PK], onDelete: Cascade)
  InvestmentTransactionDetailsLots_InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_ClosingInvestmentTransactionDetailsID_NN_FK InvestmentTransactionDetailsLots[] @relation("InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_ClosingInvestmentTransactionDetailsID_NN_FK")
  InvestmentTransactionDetailsLots_InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_OpeningInvestmentTransactionDetailsID_NN_FK InvestmentTransactionDetailsLots[] @relation("InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_OpeningInvestmentTransactionDetailsID_NN_FK")
  ScheduledTransactions_InvestmentTransactionDetailsToScheduledTransactions_InvestmentTransactionDetailsID_UK_FK                              ScheduledTransactions?             @relation("InvestmentTransactionDetailsToScheduledTransactions_InvestmentTransactionDetailsID_UK_FK")
  TransactionRuleTransactions_InvestmentTransactionDetailsToTransactionRuleTransactions_InvestmentTransactionDetailsID_UK_FK                  TransactionRuleTransactions?       @relation("InvestmentTransactionDetailsToTransactionRuleTransactions_InvestmentTransactionDetailsID_UK_FK")
  Transactions_InvestmentTransactionDetailsToTransactions_InvestmentTransactionDetailsID_UK_FK                                                Transactions?                      @relation("InvestmentTransactionDetailsToTransactions_InvestmentTransactionDetailsID_UK_FK")
}

model InvestmentTransactionDetailsLots {
  OpeningInvestmentTransactionDetailsID_NN_FK                                                                                             String
  ClosingInvestmentTransactionDetailsID_NN_FK                                                                                             String
  DateAcquired                                                                                                                            Float?
  DateRelinquished                                                                                                                        Float?
  Units                                                                                                                                   Float?
  CostBasis                                                                                                                               Float?
  SalesProceeds                                                                                                                           Float?
  InvestmentTransactionDetails_InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_ClosingInvestmentTransactionDetailsID_NN_FK InvestmentTransactionDetails @relation("InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_ClosingInvestmentTransactionDetailsID_NN_FK", fields: [ClosingInvestmentTransactionDetailsID_NN_FK], references: [InvestmentTransactionDetailsID_PK], onDelete: Cascade)
  InvestmentTransactionDetails_InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_OpeningInvestmentTransactionDetailsID_NN_FK InvestmentTransactionDetails @relation("InvestmentTransactionDetailsToInvestmentTransactionDetailsLots_OpeningInvestmentTransactionDetailsID_NN_FK", fields: [OpeningInvestmentTransactionDetailsID_NN_FK], references: [InvestmentTransactionDetailsID_PK], onDelete: Cascade)

  @@id([OpeningInvestmentTransactionDetailsID_NN_FK, ClosingInvestmentTransactionDetailsID_NN_FK])
}

model LoanAccountDetails {
  LoanAccountDetailsID_PK                                                                      String                 @id
  AccountID_NN_UK_FK                                                                           String                 @unique(map: "sqlite_autoindex_LoanAccountDetails_2")
  PaymentAccountID_FK                                                                          String?
  ScheduledTransactionID_UK_FK                                                                 String?                @unique(map: "sqlite_autoindex_LoanAccountDetails_3")
  TypeNumber                                                                                   Int?
  AmortizationTypeNumber                                                                       Int?
  BehaviorTypeNumber                                                                           Int?
  InitialLoanAmount                                                                            Float?
  NumberOfPeriods                                                                              Int?
  InterestRate                                                                                 Float?
  CompoundingTypeNumber                                                                        Int?
  DayCountConventionTypeNumber                                                                 Int?
  RoundingTypeNumber                                                                           Int?
  InitialLoanDate                                                                              Float?
  FirstPaymentDate                                                                             Float?
  DateIntervalTypeNumber                                                                       Int?
  HasOfferedToSetupSchedule                                                                    Int?
  MiscValues                                                                                   Bytes?
  Accounts_AccountsToLoanAccountDetails_AccountID_NN_UK_FK                                     Accounts               @relation("AccountsToLoanAccountDetails_AccountID_NN_UK_FK", fields: [AccountID_NN_UK_FK], references: [AccountID_PK], onDelete: Cascade)
  Accounts_AccountsToLoanAccountDetails_PaymentAccountID_FK                                    Accounts?              @relation("AccountsToLoanAccountDetails_PaymentAccountID_FK", fields: [PaymentAccountID_FK], references: [AccountID_PK])
  ScheduledTransactions_LoanAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions ScheduledTransactions? @relation("LoanAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions", fields: [ScheduledTransactionID_UK_FK], references: [ScheduledTransactionID_PK])
  Accounts_Accounts_LoanAccountDetailsID_UK_FKToLoanAccountDetails                             Accounts?              @relation("Accounts_LoanAccountDetailsID_UK_FKToLoanAccountDetails")
  LoanPaymentSegments                                                                          LoanPaymentSegments[]
  LoanPayments                                                                                 LoanPayments[]
  ScheduledTransactions_LoanAccountDetailsToScheduledTransactions_LoanAccountDetailsID_UK_FK   ScheduledTransactions? @relation("LoanAccountDetailsToScheduledTransactions_LoanAccountDetailsID_UK_FK")
}

model LoanPaymentSegments {
  LoanPaymentSegmentID_PK    String                   @id
  LoanAccountDetailsID_NN_FK String
  InitialPrincipalBalance    Float?
  FirstPaymentPeriodNumber   Int?
  LastPaymentPeriodNumber    Int?
  FirstPaymentDate           Float?
  InterestRate               Float?
  PrincipalAmount            Float?
  InterestAmount             Float?
  OtherAmounts               Float?
  TotalPayment               Float?
  CalculatePaymentAmount     Int?
  LoanAccountDetails         LoanAccountDetails       @relation(fields: [LoanAccountDetailsID_NN_FK], references: [LoanAccountDetailsID_PK], onDelete: Cascade)
  LoanPayments               LoanPayments[]
  LoanTransactionDetails     LoanTransactionDetails[]
}

model LoanPayments {
  LoanPaymentID_PK           String                   @id
  LoanAccountDetailsID_NN_FK String
  LoanPaymentSegmentID_NN_FK String
  InitialPrincipalBalance    Float?
  PaymentPeriodNumber        Int?
  PaymentDate                Float?
  InterestRate               Float?
  PrincipalAmount            Float?
  InterestAmount             Float?
  OtherAmounts               Float?
  TotalPayment               Float?
  CalculatePaymentAmount     Int?
  LoanAccountDetails         LoanAccountDetails       @relation(fields: [LoanAccountDetailsID_NN_FK], references: [LoanAccountDetailsID_PK], onDelete: Cascade)
  LoanPaymentSegments        LoanPaymentSegments      @relation(fields: [LoanPaymentSegmentID_NN_FK], references: [LoanPaymentSegmentID_PK], onDelete: Cascade)
  LoanTransactionDetails     LoanTransactionDetails[]
}

model LoanTransactionDetails {
  LoanTransactionDetailsID_PK                                                                        String                       @id
  LoanPaymentSegmentID_FK                                                                            String?
  LoanPaymentID_FK                                                                                   String?
  TransactionID_UK_FK                                                                                String?                      @unique(map: "sqlite_autoindex_LoanTransactionDetails_2")
  ScheduledTransactionID_UK_FK                                                                       String?                      @unique(map: "sqlite_autoindex_LoanTransactionDetails_3")
  PayeeID_FK                                                                                         String?
  TransactionTypeID_FK                                                                               String?
  CategoryID_FK                                                                                      String?
  Position                                                                                           Int?
  TypeNumber                                                                                         Int?
  Memo                                                                                               String?
  Amount                                                                                             Float?
  Categories                                                                                         Categories?                  @relation(fields: [CategoryID_FK], references: [CategoryID_PK])
  LoanPayments                                                                                       LoanPayments?                @relation(fields: [LoanPaymentID_FK], references: [LoanPaymentID_PK], onDelete: Cascade)
  LoanPaymentSegments                                                                                LoanPaymentSegments?         @relation(fields: [LoanPaymentSegmentID_FK], references: [LoanPaymentSegmentID_PK], onDelete: Cascade)
  Payees                                                                                             Payees?                      @relation(fields: [PayeeID_FK], references: [PayeeID_PK])
  ScheduledTransactions_LoanTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions   ScheduledTransactions?       @relation("LoanTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions", fields: [ScheduledTransactionID_UK_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)
  Transactions_LoanTransactionDetails_TransactionID_UK_FKToTransactions                              Transactions?                @relation("LoanTransactionDetails_TransactionID_UK_FKToTransactions", fields: [TransactionID_UK_FK], references: [TransactionID_PK], onDelete: Cascade)
  TransactionTypes                                                                                   TransactionTypes?            @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK])
  LoanTransactionDetailsTags                                                                         LoanTransactionDetailsTags[]
  ScheduledTransactions_LoanTransactionDetailsToScheduledTransactions_LoanTransactionDetailsID_UK_FK ScheduledTransactions?       @relation("LoanTransactionDetailsToScheduledTransactions_LoanTransactionDetailsID_UK_FK")
  Transactions_LoanTransactionDetailsToTransactions_LoanTransactionDetailsID_UK_FK                   Transactions?                @relation("LoanTransactionDetailsToTransactions_LoanTransactionDetailsID_UK_FK")
}

model LoanTransactionDetailsTags {
  LoanTransactionDetailsID_NN_FK String
  TagID_NN_FK                    String
  LoanTransactionDetails         LoanTransactionDetails @relation(fields: [LoanTransactionDetailsID_NN_FK], references: [LoanTransactionDetailsID_PK], onDelete: Cascade)
  Tags                           Tags                   @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)

  @@id([LoanTransactionDetailsID_NN_FK, TagID_NN_FK])
}

model Locations {
  LocationID_PK                                 String        @id
  PayeeID_NN_FK                                 String
  WebsiteID_UK_FK                               String?       @unique(map: "sqlite_autoindex_Locations_2")
  Position                                      Int?
  TypeNumber                                    Int?
  Favorite                                      Int?
  Name                                          String?
  ShortName                                     String?
  Info                                          String?
  ColorString                                   String?
  AlternateColorString                          String?
  TintColorString                               String?
  AlternateTintColorString                      String?
  ImageData                                     Bytes?
  AlternateImageData                            Bytes?
  LocationNumber                                String?
  Latitude                                      Float?
  Longitude                                     Float?
  GooglePlaceID                                 String?
  OtherPlaceID                                  String?
  Address1                                      String?
  Address2                                      String?
  Address3                                      String?
  City                                          String?
  State                                         String?
  ZipCode                                       String?
  CountryCode                                   String?
  TimeZoneName                                  String?
  Phone                                         String?
  Fax                                           String?
  Email                                         String?
  Payees                                        Payees        @relation(fields: [PayeeID_NN_FK], references: [PayeeID_PK], onDelete: Cascade)
  Websites_Locations_WebsiteID_UK_FKToWebsites  Websites?     @relation("Locations_WebsiteID_UK_FKToWebsites", fields: [WebsiteID_UK_FK], references: [WebsiteID_PK])
  Attachments                                   Attachments[]
  Notes                                         Notes[]
  Websites_LocationsToWebsites_LocationID_UK_FK Websites?     @relation("LocationsToWebsites_LocationID_UK_FK")
}

model Notes {
  NoteID_PK                 String                 @id
  LocationID_FK             String?
  EntityID_FK               String?
  CreditScoreID_FK          String?
  AccountGroupID_FK         String?
  AccountID_FK              String?
  TransactionID_FK          String?
  FlagID_FK                 String?
  PayeeID_FK                String?
  TransactionTypeID_FK      String?
  CategoryID_FK             String?
  TagID_FK                  String?
  SecurityID_FK             String?
  SecurityGroupID_FK        String?
  SecurityGoalID_FK         String?
  SecurityAssetClassID_FK   String?
  SecuritySectorID_FK       String?
  SecurityIndustryID_FK     String?
  SecurityExchangeID_FK     String?
  SecurityFundCategoryID_FK String?
  SecurityFundFamilyID_FK   String?
  SecurityCustomLabelID_FK  String?
  InvestmentPortfolioID_FK  String?
  ScheduledTransactionID_FK String?
  ExchangeRateSetID_FK      String?
  StatementID_FK            String?
  ReportID_FK               String?
  BudgetID_FK               String?
  Position                  Int?
  TypeNumber                Int?
  LayoutTypeNumber          Int?
  CreationDate              Float?
  ModifiedDate              Float?
  PriorityNumber            Int?
  Name                      String?
  ShortName                 String?
  Info                      String?
  Note                      String?
  NoteTextAttributes        Bytes?
  AccountGroups             AccountGroups?         @relation(fields: [AccountGroupID_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Accounts                  Accounts?              @relation(fields: [AccountID_FK], references: [AccountID_PK], onDelete: Cascade)
  Budgets                   Budgets?               @relation(fields: [BudgetID_FK], references: [BudgetID_PK], onDelete: Cascade)
  Categories                Categories?            @relation(fields: [CategoryID_FK], references: [CategoryID_PK], onDelete: Cascade)
  CreditScores              CreditScores?          @relation(fields: [CreditScoreID_FK], references: [CreditScoreID_PK], onDelete: Cascade)
  Entities                  Entities?              @relation(fields: [EntityID_FK], references: [EntityID_PK], onDelete: Cascade)
  ExchangeRateSets          ExchangeRateSets?      @relation(fields: [ExchangeRateSetID_FK], references: [ExchangeRateSetID_PK], onDelete: Cascade)
  Flags                     Flags?                 @relation(fields: [FlagID_FK], references: [FlagID_PK], onDelete: Cascade)
  InvestmentPortfolios      InvestmentPortfolios?  @relation(fields: [InvestmentPortfolioID_FK], references: [InvestmentPortfolioID_PK])
  Locations                 Locations?             @relation(fields: [LocationID_FK], references: [LocationID_PK], onDelete: Cascade)
  Payees                    Payees?                @relation(fields: [PayeeID_FK], references: [PayeeID_PK], onDelete: Cascade)
  Reports                   Reports?               @relation(fields: [ReportID_FK], references: [ReportID_PK], onDelete: Cascade)
  ScheduledTransactions     ScheduledTransactions? @relation(fields: [ScheduledTransactionID_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)
  SecurityAssetClasses      SecurityAssetClasses?  @relation(fields: [SecurityAssetClassID_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)
  SecurityCustomLabels      SecurityCustomLabels?  @relation(fields: [SecurityCustomLabelID_FK], references: [SecurityCustomLabelID_PK])
  SecurityExchanges         SecurityExchanges?     @relation(fields: [SecurityExchangeID_FK], references: [SecurityExchangeID_PK])
  fundCategories            fundCategories?        @relation(fields: [SecurityFundCategoryID_FK], references: [SecurityFundCategoryID_PK], onDelete: Cascade)
  SecurityFundFamilies      SecurityFundFamilies?  @relation(fields: [SecurityFundFamilyID_FK], references: [SecurityFundFamilyID_PK], onDelete: Cascade)
  SecurityGoals             SecurityGoals?         @relation(fields: [SecurityGoalID_FK], references: [SecurityGoalID_PK], onDelete: Cascade)
  SecurityGroups            SecurityGroups?        @relation(fields: [SecurityGroupID_FK], references: [SecurityGroupID_PK], onDelete: Cascade)
  Securities                Securities?            @relation(fields: [SecurityID_FK], references: [SecurityID_PK], onDelete: Cascade)
  SecurityIndustries        SecurityIndustries?    @relation(fields: [SecurityIndustryID_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)
  SecuritySectors           SecuritySectors?       @relation(fields: [SecuritySectorID_FK], references: [SecuritySectorID_PK], onDelete: Cascade)
  Statements                Statements?            @relation(fields: [StatementID_FK], references: [StatementID_PK], onDelete: Cascade)
  Tags                      Tags?                  @relation(fields: [TagID_FK], references: [TagID_PK], onDelete: Cascade)
  Transactions              Transactions?          @relation(fields: [TransactionID_FK], references: [TransactionID_PK], onDelete: Cascade)
  TransactionTypes          TransactionTypes?      @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK], onDelete: Cascade)
  Attachments               Attachments[]
}

model ObjectMatches {
  ObjectMatchID_PK                  String            @id
  ParentID_FK                       String?
  Position                          Int?
  TransactionRuleID_FK              String?
  ReportID_FK                       String?
  TypeNumber                        Int?
  CombinationTypeNumber             Int?
  ClassTypeNumber                   Int?
  ClassPropertyTypeNumber           Int?
  ObjectTypeSpecific                Int?
  ObjectTypeNumber                  Int?
  ObjectOptionTypeSpecific          Int?
  ObjectOptionTypeNumber            Int?
  ObjectOptionTypeTypeNumber        Int?
  GenericMatchingTypeNumber         Int?
  StringMatchingTypeNumber          Int?
  StringValue                       String?
  StringValue1                      String?
  StringValue2                      String?
  NumberMatchingTypeNumber          Int?
  NumberValue                       Float?
  NumberValue1                      Float?
  NumberValue2                      Float?
  TreatStringValuesAsNumbers        Int?
  TreatNumberValuesAsAbsoluteValues Int?
  TaxSpecific                       Int?
  TaxSpecificTypeNumber             Int?
  ObjectMatches                     ObjectMatches?    @relation("ObjectMatchesToObjectMatches_ParentID_FK", fields: [ParentID_FK], references: [ObjectMatchID_PK], onDelete: Cascade)
  Reports                           Reports?          @relation(fields: [ReportID_FK], references: [ReportID_PK], onDelete: Cascade)
  TransactionRules                  TransactionRules? @relation(fields: [TransactionRuleID_FK], references: [TransactionRuleID_PK], onDelete: Cascade)
  other_ObjectMatches               ObjectMatches[]   @relation("ObjectMatchesToObjectMatches_ParentID_FK")
}

model Payees {
  PayeeID_PK                                                        String                        @id
  EntityID_UK_FK                                                    String?                       @unique(map: "sqlite_autoindex_Payees_2")
  AccountID_UK_FK                                                   String?                       @unique(map: "sqlite_autoindex_Payees_3")
  TransactionRuleID_UK_FK                                           String?                       @unique(map: "sqlite_autoindex_Payees_4")
  WebsiteID_UK_FK                                                   String?                       @unique(map: "sqlite_autoindex_Payees_5")
  TypeNumber                                                        Int?
  IncludeInLists                                                    Int?
  IncludeInReports                                                  Int?
  Favorite                                                          Int?
  Name                                                              String?
  ShortName                                                         String?
  Info                                                              String?
  ColorString                                                       String?
  AlternateColorString                                              String?
  TintColorString                                                   String?
  AlternateTintColorString                                          String?
  ImageData                                                         Bytes?
  AlternateImageData                                                Bytes?
  IdentifierTypeNumber                                              Int?
  Identifier                                                        String?
  Accounts_AccountsToPayees_AccountID_UK_FK                         Accounts?                     @relation("AccountsToPayees_AccountID_UK_FK", fields: [AccountID_UK_FK], references: [AccountID_PK])
  Entities_EntitiesToPayees_EntityID_UK_FK                          Entities?                     @relation("EntitiesToPayees_EntityID_UK_FK", fields: [EntityID_UK_FK], references: [EntityID_PK])
  TransactionRules_Payees_TransactionRuleID_UK_FKToTransactionRules TransactionRules?             @relation("Payees_TransactionRuleID_UK_FKToTransactionRules", fields: [TransactionRuleID_UK_FK], references: [TransactionRuleID_PK])
  Websites_Payees_WebsiteID_UK_FKToWebsites                         Websites?                     @relation("Payees_WebsiteID_UK_FKToWebsites", fields: [WebsiteID_UK_FK], references: [WebsiteID_PK])
  Accounts_Accounts_DefaultPayeeID_FKToPayees                       Accounts[]                    @relation("Accounts_DefaultPayeeID_FKToPayees")
  Accounts_Accounts_PayeeID_NN_UK_FKToPayees                        Accounts?                     @relation("Accounts_PayeeID_NN_UK_FKToPayees")
  Attachments                                                       Attachments[]
  Entities_Entities_PayeeID_NN_UK_FKToPayees                        Entities?                     @relation("Entities_PayeeID_NN_UK_FKToPayees")
  LoanTransactionDetails                                            LoanTransactionDetails[]
  Locations                                                         Locations[]
  Notes                                                             Notes[]
  ReportForecastDetails                                             ReportForecastDetails[]
  ReportGoalDetails                                                 ReportGoalDetails[]
  ReportsPayees                                                     ReportsPayees[]
  ScheduledTransactions                                             ScheduledTransactions[]
  TransactionRuleTransactions                                       TransactionRuleTransactions[]
  TransactionRules_PayeesToTransactionRules_PayeeID_UK_FK           TransactionRules?             @relation("PayeesToTransactionRules_PayeeID_UK_FK")
  Transactions                                                      Transactions[]
  Websites_PayeesToWebsites_PayeeID_UK_FK                           Websites?                     @relation("PayeesToWebsites_PayeeID_UK_FK")
}

model ReportColumnDetails {
  ReportColumnDetailsID_PK                                         String   @id
  ReportID_NN_UK_FK                                                String   @unique(map: "sqlite_autoindex_ReportColumnDetails_2")
  ColumnWidthTypeNumber                                            Int?
  Column1Name                                                      String?
  Column1Width                                                     Int?
  Column2Name                                                      String?
  Column2Width                                                     Int?
  Column3Name                                                      String?
  Column3Width                                                     Int?
  Column4Name                                                      String?
  Column4Width                                                     Int?
  Column5Name                                                      String?
  Column5Width                                                     Int?
  Column6Name                                                      String?
  Column6Width                                                     Int?
  Column7Name                                                      String?
  Column7Width                                                     Int?
  Column8Name                                                      String?
  Column8Width                                                     Int?
  Column9Name                                                      String?
  Column9Width                                                     Int?
  Column10Name                                                     String?
  Column10Width                                                    Int?
  Column11Name                                                     String?
  Column11Width                                                    Int?
  Column12Name                                                     String?
  Column12Width                                                    Int?
  Column13Name                                                     String?
  Column13Width                                                    Int?
  Column14Name                                                     String?
  Column14Width                                                    Int?
  Column15Name                                                     String?
  Column15Width                                                    Int?
  Column16Name                                                     String?
  Column16Width                                                    Int?
  Column17Name                                                     String?
  Column17Width                                                    Int?
  Column18Name                                                     String?
  Column18Width                                                    Int?
  Column19Name                                                     String?
  Column19Width                                                    Int?
  Column20Name                                                     String?
  Column20Width                                                    Int?
  Column21Name                                                     String?
  Column21Width                                                    Int?
  Column22Name                                                     String?
  Column22Width                                                    Int?
  Column23Name                                                     String?
  Column23Width                                                    Int?
  Column24Name                                                     String?
  Column24Width                                                    Int?
  Column25Name                                                     String?
  Column25Width                                                    Int?
  Column26Name                                                     String?
  Column26Width                                                    Int?
  Column27Name                                                     String?
  Column27Width                                                    Int?
  Column28Name                                                     String?
  Column28Width                                                    Int?
  Column29Name                                                     String?
  Column29Width                                                    Int?
  Column30Name                                                     String?
  Column30Width                                                    Int?
  Column31Name                                                     String?
  Column31Width                                                    Int?
  Column32Name                                                     String?
  Column32Width                                                    Int?
  Column33Name                                                     String?
  Column33Width                                                    Int?
  Column34Name                                                     String?
  Column34Width                                                    Int?
  Column35Name                                                     String?
  Column35Width                                                    Int?
  Column36Name                                                     String?
  Column36Width                                                    Int?
  Column37Name                                                     String?
  Column37Width                                                    Int?
  Column38Name                                                     String?
  Column38Width                                                    Int?
  Column39Name                                                     String?
  Column39Width                                                    Int?
  Column40Name                                                     String?
  Column40Width                                                    Int?
  Reports_ReportColumnDetails_ReportID_NN_UK_FKToReports           Reports  @relation("ReportColumnDetails_ReportID_NN_UK_FKToReports", fields: [ReportID_NN_UK_FK], references: [ReportID_PK], onDelete: Cascade)
  Reports_ReportColumnDetailsToReports_ReportColumnDetailsID_UK_FK Reports? @relation("ReportColumnDetailsToReports_ReportColumnDetailsID_UK_FK")
}

model ReportForecastDetails {
  ReportForecastDetailsID_PK   String                @id
  ReportID_NN_FK               String
  EntityID_FK                  String?
  CreditScoreID_FK             String?
  AccountGroupID_FK            String?
  AccountID_FK                 String?
  PayeeID_FK                   String?
  TransactionTypeID_FK         String?
  CategoryID_FK                String?
  TagID_FK                     String?
  SecurityTypeID_FK            String?
  SecurityID_FK                String?
  SecurityGroupID_FK           String?
  SecurityGoalID_FK            String?
  SecurityAssetClassID_FK      String?
  SecuritySectorID_FK          String?
  SecurityIndustryID_FK        String?
  SecurityExchangeID_FK        String?
  SecurityFundCategoryID_FK    String?
  SecurityFundFamilyID_FK      String?
  SecurityCustomLabelID_FK     String?
  InvestmentPortfolioID_FK     String?
  Position                     Int?
  TypeNumber                   Int?
  BaseAmount                   Float?
  ChangeTypeNumber             Int?
  ChangeDateIntervalTypeNumber Int?
  ChangeAmount                 Float?
  StartDate                    Float?
  EndDate                      Float?
  ExpectedInflation            Float?
  MiscValues                   Bytes?
  AccountGroups                AccountGroups?        @relation(fields: [AccountGroupID_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Accounts                     Accounts?             @relation(fields: [AccountID_FK], references: [AccountID_PK], onDelete: Cascade)
  Categories                   Categories?           @relation(fields: [CategoryID_FK], references: [CategoryID_PK], onDelete: Cascade)
  CreditScores                 CreditScores?         @relation(fields: [CreditScoreID_FK], references: [CreditScoreID_PK], onDelete: Cascade)
  Entities                     Entities?             @relation(fields: [EntityID_FK], references: [EntityID_PK], onDelete: Cascade)
  InvestmentPortfolios         InvestmentPortfolios? @relation(fields: [InvestmentPortfolioID_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  Payees                       Payees?               @relation(fields: [PayeeID_FK], references: [PayeeID_PK], onDelete: Cascade)
  Reports                      Reports               @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityAssetClasses         SecurityAssetClasses? @relation(fields: [SecurityAssetClassID_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)
  SecurityCustomLabels         SecurityCustomLabels? @relation(fields: [SecurityCustomLabelID_FK], references: [SecurityCustomLabelID_PK], onDelete: Cascade)
  SecurityExchanges            SecurityExchanges?    @relation(fields: [SecurityExchangeID_FK], references: [SecurityExchangeID_PK], onDelete: Cascade)
  fundCategories               fundCategories?       @relation(fields: [SecurityFundCategoryID_FK], references: [SecurityFundCategoryID_PK], onDelete: Cascade)
  SecurityFundFamilies         SecurityFundFamilies? @relation(fields: [SecurityFundFamilyID_FK], references: [SecurityFundFamilyID_PK], onDelete: Cascade)
  SecurityGoals                SecurityGoals?        @relation(fields: [SecurityGoalID_FK], references: [SecurityGoalID_PK], onDelete: Cascade)
  SecurityGroups               SecurityGroups?       @relation(fields: [SecurityGroupID_FK], references: [SecurityGroupID_PK], onDelete: Cascade)
  Securities                   Securities?           @relation(fields: [SecurityID_FK], references: [SecurityID_PK], onDelete: Cascade)
  SecurityIndustries           SecurityIndustries?   @relation(fields: [SecurityIndustryID_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)
  SecuritySectors              SecuritySectors?      @relation(fields: [SecuritySectorID_FK], references: [SecuritySectorID_PK], onDelete: Cascade)
  SecurityTypes                SecurityTypes?        @relation(fields: [SecurityTypeID_FK], references: [SecurityTypeID_PK], onDelete: Cascade)
  Tags                         Tags?                 @relation(fields: [TagID_FK], references: [TagID_PK], onDelete: Cascade)
  TransactionTypes             TransactionTypes?     @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK], onDelete: Cascade)
}

model ReportGoalDetails {
  ReportGoalDetailsID_PK            String                @id
  ReportID_NN_FK                    String
  EntityID_FK                       String?
  CreditScoreID_FK                  String?
  AccountGroupID_FK                 String?
  AccountID_FK                      String?
  PayeeID_FK                        String?
  TransactionTypeID_FK              String?
  CategoryID_FK                     String?
  TagID_FK                          String?
  SecurityTypeID_FK                 String?
  SecurityID_FK                     String?
  SecurityGroupID_FK                String?
  SecurityGoalID_FK                 String?
  SecuritySectorID_FK               String?
  SecurityAssetClassID_FK           String?
  SecurityIndustryID_FK             String?
  SecurityExchangeID_FK             String?
  SecurityFundCategoryID_FK         String?
  SecurityFundFamilyID_FK           String?
  SecurityCustomLabelID_FK          String?
  InvestmentPortfolioID_FK          String?
  Position                          Int?
  TypeNumber                        Int?
  BaseAmount                        Float?
  ChangeTypeNumber                  Int?
  ChangeDateIntervalTypeNumber      Int?
  ChangeAmount                      Float?
  StartDate                         Float?
  EndDate                           Float?
  ExpectedInflation                 Float?
  AcceptableMarginOfErrorTypeNumber Int?
  AcceptableMarginOfErrorAmount     Float?
  MiscValues                        Bytes?
  AccountGroups                     AccountGroups?        @relation(fields: [AccountGroupID_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Accounts                          Accounts?             @relation(fields: [AccountID_FK], references: [AccountID_PK], onDelete: Cascade)
  Categories                        Categories?           @relation(fields: [CategoryID_FK], references: [CategoryID_PK], onDelete: Cascade)
  CreditScores                      CreditScores?         @relation(fields: [CreditScoreID_FK], references: [CreditScoreID_PK], onDelete: Cascade)
  Entities                          Entities?             @relation(fields: [EntityID_FK], references: [EntityID_PK], onDelete: Cascade)
  InvestmentPortfolios              InvestmentPortfolios? @relation(fields: [InvestmentPortfolioID_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  Payees                            Payees?               @relation(fields: [PayeeID_FK], references: [PayeeID_PK], onDelete: Cascade)
  Reports                           Reports               @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityAssetClasses              SecurityAssetClasses? @relation(fields: [SecurityAssetClassID_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)
  SecurityCustomLabels              SecurityCustomLabels? @relation(fields: [SecurityCustomLabelID_FK], references: [SecurityCustomLabelID_PK], onDelete: Cascade)
  SecurityExchanges                 SecurityExchanges?    @relation(fields: [SecurityExchangeID_FK], references: [SecurityExchangeID_PK], onDelete: Cascade)
  fundCategories                    fundCategories?       @relation(fields: [SecurityFundCategoryID_FK], references: [SecurityFundCategoryID_PK], onDelete: Cascade)
  SecurityFundFamilies              SecurityFundFamilies? @relation(fields: [SecurityFundFamilyID_FK], references: [SecurityFundFamilyID_PK], onDelete: Cascade)
  SecurityGoals                     SecurityGoals?        @relation(fields: [SecurityGoalID_FK], references: [SecurityGoalID_PK], onDelete: Cascade)
  SecurityGroups                    SecurityGroups?       @relation(fields: [SecurityGroupID_FK], references: [SecurityGroupID_PK], onDelete: Cascade)
  Securities                        Securities?           @relation(fields: [SecurityID_FK], references: [SecurityID_PK], onDelete: Cascade)
  SecurityIndustries                SecurityIndustries?   @relation(fields: [SecurityIndustryID_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)
  SecuritySectors                   SecuritySectors?      @relation(fields: [SecuritySectorID_FK], references: [SecuritySectorID_PK], onDelete: Cascade)
  SecurityTypes                     SecurityTypes?        @relation(fields: [SecurityTypeID_FK], references: [SecurityTypeID_PK], onDelete: Cascade)
  Tags                              Tags?                 @relation(fields: [TagID_FK], references: [TagID_PK], onDelete: Cascade)
  TransactionTypes                  TransactionTypes?     @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK], onDelete: Cascade)
}

model ReportGroups {
  ReportGroupID_PK         String         @id
  ParentID_FK              String?
  Position                 Int?
  TypeNumber               Int?
  IncludeInSidebar         Int?
  IncludeInLists           Int?
  IncludeInReports         Int?
  Favorite                 Int?
  Name                     String?
  ShortName                String?
  Info                     String?
  ColorString              String?
  AlternateColorString     String?
  TintColorString          String?
  AlternateTintColorString String?
  ImageData                Bytes?
  AlternateImageData       Bytes?
  Subtitle                 String?
  ReportGroups             ReportGroups?  @relation("ReportGroupsToReportGroups_ParentID_FK", fields: [ParentID_FK], references: [ReportGroupID_PK], onDelete: Cascade)
  other_ReportGroups       ReportGroups[] @relation("ReportGroupsToReportGroups_ParentID_FK")
  Reports                  Reports[]
}

model Reports {
  ReportID_PK                                                                  String                          @id
  ReportGroupID_FK                                                             String?
  ReportColumnDetailsID_UK_FK                                                  String?                         @unique(map: "sqlite_autoindex_Reports_2")
  ExchangeRateSetID_FK                                                         String?
  Position                                                                     Int?
  TypeNumber                                                                   Int?
  OrientationTypeNumber                                                        Int?
  LayoutTypeNumber                                                             Int?
  ColorSchemeTypeNumber                                                        Int?
  GraphTypeNumber                                                              Int?
  FormatTypeNumber                                                             Int?
  DateRangeTypeNumber                                                          Int?
  UseCurrentDate                                                               Int?
  Date                                                                         Float?
  StartDate                                                                    Float?
  EndDate                                                                      Float?
  DateIntervalTypeNumber                                                       Int?
  DateIntervalComparisonTypeNumber                                             Int?
  ComparisonDateRangeTypeNumber                                                Int?
  ComparisonUseCurrentDate                                                     Int?
  ComparisonDate                                                               Float?
  ComparisonStartDate                                                          Float?
  ComparisonEndDate                                                            Float?
  ComparisonDateIntervalTypeNumber                                             Int?
  GroupingTypeNumber                                                           Int?
  SubgroupingTypeNumber                                                        Int?
  CurrencyCode                                                                 String?
  IncludeInSidebar                                                             Int?
  IncludeInLists                                                               Int?
  IncludeInReports                                                             Int?
  IncludePendingTransactions                                                   Int?
  Favorite                                                                     Int?
  Name                                                                         String?
  ShortName                                                                    String?
  Info                                                                         String?
  IncludeEntitiesTypeNumber                                                    Int?
  IncludeCreditScoresTypeNumber                                                Int?
  IncludeAccountGroupsTypeNumber                                               Int?
  IncludeAccountsTypeNumber                                                    Int?
  IncludeFlagsTypeNumber                                                       Int?
  IncludePayeesTypeNumber                                                      Int?
  IncludeTransactionTypesTypeNumber                                            Int?
  IncludeCategoriesTypeNumber                                                  Int?
  IncludeTagsTypeNumber                                                        Int?
  IncludeSecurityTypesTypeNumber                                               Int?
  IncludeSecuritiesTypeNumber                                                  Int?
  IncludeSecurityGroupsTypeNumber                                              Int?
  IncludeSecurityGoalsTypeNumber                                               Int?
  IncludeSecurityAssetClassesTypeNumber                                        Int?
  IncludeSecuritySectorsTypeNumber                                             Int?
  IncludeSecurityIndustriesTypeNumber                                          Int?
  IncludeSecurityExchangesTypeNumber                                           Int?
  IncludeSecurityFundCategoriesTypeNumber                                      Int?
  IncludeSecurityFundFamiliesTypeNumber                                        Int?
  IncludeSecurityCustomLabelsTypeNumber                                        Int?
  IncludeInvestmentPortfoliosTypeNumber                                        Int?
  IncludeScheduledTransactionsTypeNumber                                       Int?
  IncludeOtherEntityListing                                                    Int?
  IncludeOtherCreditScoreListing                                               Int?
  IncludeOtherAccountGroupListing                                              Int?
  IncludeOtherAccountListing                                                   Int?
  IncludeOtherFlagListing                                                      Int?
  IncludeOtherPayeeListing                                                     Int?
  IncludeOtherTransactionTypeListing                                           Int?
  IncludeOtherCategoryListing                                                  Int?
  IncludeOtherIncomeCategoryListing                                            Int?
  IncludeOtherExpensesCategoryListing                                          Int?
  IncludeOtherTagListing                                                       Int?
  IncludeOtherSecurityTypeListing                                              Int?
  IncludeOtherSecurityListing                                                  Int?
  IncludeOtherSecurityGroupListing                                             Int?
  IncludeOtherSecurityGoalListing                                              Int?
  IncludeOtherSecurityAssetClassListing                                        Int?
  IncludeOtherSecuritySectorListing                                            Int?
  IncludeOtherSecurityIndustryListing                                          Int?
  IncludeOtherSecurityExchangeListing                                          Int?
  IncludeOtherSecurityFundCategoryListing                                      Int?
  IncludeOtherSecurityFundFamilyListing                                        Int?
  IncludeOtherSecurityCustomLabelListing                                       Int?
  IncludeOtherInvestmentPortfolioListing                                       Int?
  IncludeNoEntityListing                                                       Int?
  IncludeNoCreditScoreListing                                                  Int?
  IncludeNoAccountGroupListing                                                 Int?
  IncludeNoAccountListing                                                      Int?
  IncludeNoFlagListing                                                         Int?
  IncludeNoPayeeListing                                                        Int?
  IncludeNoTransactionTypeListing                                              Int?
  IncludeNoCategoryListing                                                     Int?
  IncludeNoIncomeCategoryListing                                               Int?
  IncludeNoExpensesCategoryListing                                             Int?
  IncludeNoTagListing                                                          Int?
  IncludeNoSecurityTypeListing                                                 Int?
  IncludeNoSecurityListing                                                     Int?
  IncludeNoSecurityGroupListing                                                Int?
  IncludeNoSecurityGoalListing                                                 Int?
  IncludeNoSecurityAssetClassListing                                           Int?
  IncludeNoSecuritySectorListing                                               Int?
  IncludeNoSecurityIndustryListing                                             Int?
  IncludeNoSecurityExchangeListing                                             Int?
  IncludeNoSecurityFundCategoryListing                                         Int?
  IncludeNoSecurityFundFamilyListing                                           Int?
  IncludeNoSecurityCustomLabelListing                                          Int?
  IncludeNoInvestmentPortfolioListing                                          Int?
  IncludeDefaultPortfolioListing                                               Int?
  IncludeBalanceAdjustmentsTypeNumber                                          Int?
  IncludeTransfersTypeNumber                                                   Int?
  IncludeTransactionOriginTypeNumber                                           Int?
  IncludeTransactionAmountTypeNumber                                           Int?
  IncludeTransactionStatusTypeNumber                                           Int?
  IncludeItemsPastTodayTypeNumber                                              Int?
  IncludeTotalAmountTypeNumber                                                 Int?
  IncludeTotal                                                                 Int?
  IncludeIncomeTotal                                                           Int?
  IncludeExpensesTotal                                                         Int?
  OverallParametersCombinationTypeNumber                                       Int?
  ObjectMatchesCombinationTypeNumber                                           Int?
  ScalingFactor                                                                Float?
  FontName                                                                     String?
  FontSize                                                                     Float?
  RowHeight                                                                    Float?
  HeadingColorString                                                           String?
  AlternatingRowColorString                                                    String?
  ShowAlternatingRowColor                                                      Int?
  ConstrainGraphXAxisToZero                                                    Int?
  ConstrainGraphYAxisToZero                                                    Int?
  FlipGraphDefaultAxis                                                         Int?
  NumberOfRowsValuesCanExpandInto                                              Int?
  ShowItemsWithShortNames                                                      Int?
  ShowItemsWithoutValues                                                       Int?
  ShowRowInfoAcrossTwoLines                                                    Int?
  ShowAmountsWithoutDecimals                                                   Int?
  ShowInvestmentPositionDetails                                                Int?
  ShowTransactionSplitDetails                                                  Int?
  ShowOtherDetails                                                             Int?
  IncludeColumnsTypeNumber                                                     Int?
  ItemSortingTypeNumber                                                        Int?
  TransactionSortingTypeNumber                                                 Int?
  SecuritySortingTypeNumber                                                    Int?
  InvestmentPositionSortingTypeNumber                                          Int?
  MiscValues                                                                   Bytes?
  ExchangeRateSets                                                             ExchangeRateSets?               @relation(fields: [ExchangeRateSetID_FK], references: [ExchangeRateSetID_PK])
  ReportColumnDetails_ReportColumnDetailsToReports_ReportColumnDetailsID_UK_FK ReportColumnDetails?            @relation("ReportColumnDetailsToReports_ReportColumnDetailsID_UK_FK", fields: [ReportColumnDetailsID_UK_FK], references: [ReportColumnDetailsID_PK])
  ReportGroups                                                                 ReportGroups?                   @relation(fields: [ReportGroupID_FK], references: [ReportGroupID_PK])
  Attachments                                                                  Attachments[]
  Notes                                                                        Notes[]
  ObjectMatches                                                                ObjectMatches[]
  ReportColumnDetails_ReportColumnDetails_ReportID_NN_UK_FKToReports           ReportColumnDetails?            @relation("ReportColumnDetails_ReportID_NN_UK_FKToReports")
  ReportForecastDetails                                                        ReportForecastDetails[]
  ReportGoalDetails                                                            ReportGoalDetails[]
  ReportsAccountGroups                                                         ReportsAccountGroups[]
  ReportsAccounts                                                              ReportsAccounts[]
  ReportsCategories                                                            ReportsCategories[]
  ReportsCreditScores                                                          ReportsCreditScores[]
  ReportsEntities                                                              ReportsEntities[]
  ReportsFlags                                                                 ReportsFlags[]
  ReportsInvestmentPortfolios                                                  ReportsInvestmentPortfolios[]
  ReportsPayees                                                                ReportsPayees[]
  ReportsScheduledTransactions                                                 ReportsScheduledTransactions[]
  ReportsSecurities                                                            ReportsSecurities[]
  ReportsSecurityAssetClasses                                                  ReportsSecurityAssetClasses[]
  ReportsSecurityCustomLabels                                                  ReportsSecurityCustomLabels[]
  ReportsSecurityExchanges                                                     ReportsSecurityExchanges[]
  ReportsSecurityFundCategories                                                ReportsSecurityFundCategories[]
  ReportsSecurityFundFamilies                                                  ReportsSecurityFundFamilies[]
  ReportsSecurityGoals                                                         ReportsSecurityGoals[]
  ReportsSecurityGroups                                                        ReportsSecurityGroups[]
  ReportsSecurityIndustries                                                    ReportsSecurityIndustries[]
  ReportsSecuritySectors                                                       ReportsSecuritySectors[]
  ReportsSecurityTypes                                                         ReportsSecurityTypes[]
  ReportsTags                                                                  ReportsTags[]
  ReportsTransactionTypes                                                      ReportsTransactionTypes[]
  ReportsTransactions                                                          ReportsTransactions[]
}

model ReportsAccountGroups {
  ReportID_NN_FK       String
  AccountGroupID_NN_FK String
  AccountGroups        AccountGroups @relation(fields: [AccountGroupID_NN_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Reports              Reports       @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, AccountGroupID_NN_FK])
}

model ReportsAccounts {
  ReportID_NN_FK  String
  AccountID_NN_FK String
  Accounts        Accounts @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  Reports         Reports  @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, AccountID_NN_FK])
}

model ReportsCategories {
  ReportID_NN_FK   String
  CategoryID_NN_FK String
  Categories       Categories @relation(fields: [CategoryID_NN_FK], references: [CategoryID_PK], onDelete: Cascade)
  Reports          Reports    @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, CategoryID_NN_FK])
}

model ReportsCreditScores {
  ReportID_NN_FK      String
  CreditScoreID_NN_FK String
  CreditScores        CreditScores @relation(fields: [CreditScoreID_NN_FK], references: [CreditScoreID_PK], onDelete: Cascade)
  Reports             Reports      @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, CreditScoreID_NN_FK])
}

model ReportsEntities {
  ReportID_NN_FK String
  EntityID_NN_FK String
  Entities       Entities @relation(fields: [EntityID_NN_FK], references: [EntityID_PK], onDelete: Cascade)
  Reports        Reports  @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, EntityID_NN_FK])
}

model ReportsFlags {
  ReportID_NN_FK String
  FlagID_NN_FK   String
  Flags          Flags   @relation(fields: [FlagID_NN_FK], references: [FlagID_PK], onDelete: Cascade)
  Reports        Reports @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, FlagID_NN_FK])
}

model ReportsInvestmentPortfolios {
  ReportID_NN_FK              String
  InvestmentPortfolioID_NN_FK String
  InvestmentPortfolios        InvestmentPortfolios @relation(fields: [InvestmentPortfolioID_NN_FK], references: [InvestmentPortfolioID_PK], onDelete: Cascade)
  Reports                     Reports              @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, InvestmentPortfolioID_NN_FK])
}

model ReportsPayees {
  ReportID_NN_FK String
  PayeeID_NN_FK  String
  Payees         Payees  @relation(fields: [PayeeID_NN_FK], references: [PayeeID_PK], onDelete: Cascade)
  Reports        Reports @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, PayeeID_NN_FK])
}

model ReportsScheduledTransactions {
  ReportID_NN_FK               String
  ScheduledTransactionID_NN_FK String
  Reports                      Reports               @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  ScheduledTransactions        ScheduledTransactions @relation(fields: [ScheduledTransactionID_NN_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, ScheduledTransactionID_NN_FK])
}

model ReportsSecurities {
  ReportID_NN_FK   String
  SecurityID_NN_FK String
  Reports          Reports    @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  Securities       Securities @relation(fields: [SecurityID_NN_FK], references: [SecurityID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityID_NN_FK])
}

model ReportsSecurityAssetClasses {
  ReportID_NN_FK             String
  SecurityAssetClassID_NN_FK String
  Reports                    Reports              @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityAssetClasses       SecurityAssetClasses @relation(fields: [SecurityAssetClassID_NN_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityAssetClassID_NN_FK])
}

model ReportsSecurityCustomLabels {
  ReportID_NN_FK              String
  SecurityCustomLabelID_NN_FK String
  Reports                     Reports              @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityCustomLabels        SecurityCustomLabels @relation(fields: [SecurityCustomLabelID_NN_FK], references: [SecurityCustomLabelID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityCustomLabelID_NN_FK])
}

model ReportsSecurityExchanges {
  ReportID_NN_FK           String
  SecurityExchangeID_NN_FK String
  Reports                  Reports           @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityExchanges        SecurityExchanges @relation(fields: [SecurityExchangeID_NN_FK], references: [SecurityExchangeID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityExchangeID_NN_FK])
}

model ReportsSecurityFundCategories {
  ReportID_NN_FK               String
  SecurityFundCategoryID_NN_FK String
  Reports                      Reports        @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  fundCategories               fundCategories @relation(fields: [SecurityFundCategoryID_NN_FK], references: [SecurityFundCategoryID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityFundCategoryID_NN_FK])
}

model ReportsSecurityFundFamilies {
  ReportID_NN_FK             String
  SecurityFundFamilyID_NN_FK String
  Reports                    Reports              @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityFundFamilies       SecurityFundFamilies @relation(fields: [SecurityFundFamilyID_NN_FK], references: [SecurityFundFamilyID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityFundFamilyID_NN_FK])
}

model ReportsSecurityGoals {
  ReportID_NN_FK       String
  SecurityGoalID_NN_FK String
  Reports              Reports       @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityGoals        SecurityGoals @relation(fields: [SecurityGoalID_NN_FK], references: [SecurityGoalID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityGoalID_NN_FK])
}

model ReportsSecurityGroups {
  ReportID_NN_FK        String
  SecurityGroupID_NN_FK String
  Reports               Reports        @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityGroups        SecurityGroups @relation(fields: [SecurityGroupID_NN_FK], references: [SecurityGroupID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityGroupID_NN_FK])
}

model ReportsSecurityIndustries {
  ReportID_NN_FK           String
  SecurityIndustryID_NN_FK String
  Reports                  Reports            @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityIndustries       SecurityIndustries @relation(fields: [SecurityIndustryID_NN_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityIndustryID_NN_FK])
}

model ReportsSecuritySectors {
  ReportID_NN_FK         String
  SecuritySectorID_NN_FK String
  Reports                Reports         @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecuritySectors        SecuritySectors @relation(fields: [SecuritySectorID_NN_FK], references: [SecuritySectorID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecuritySectorID_NN_FK])
}

model ReportsSecurityTypes {
  ReportID_NN_FK       String
  SecurityTypeID_NN_FK String
  Reports              Reports       @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  SecurityTypes        SecurityTypes @relation(fields: [SecurityTypeID_NN_FK], references: [SecurityTypeID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, SecurityTypeID_NN_FK])
}

model ReportsTags {
  ReportID_NN_FK String
  TagID_NN_FK    String
  Reports        Reports @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  Tags           Tags    @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, TagID_NN_FK])
}

model ReportsTransactionTypes {
  ReportID_NN_FK          String
  TransactionTypeID_NN_FK String
  Reports                 Reports          @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  TransactionTypes        TransactionTypes @relation(fields: [TransactionTypeID_NN_FK], references: [TransactionTypeID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, TransactionTypeID_NN_FK])
}

model ReportsTransactions {
  ReportID_NN_FK      String
  TransactionID_NN_FK String
  Reports             Reports      @relation(fields: [ReportID_NN_FK], references: [ReportID_PK], onDelete: Cascade)
  Transactions        Transactions @relation(fields: [TransactionID_NN_FK], references: [TransactionID_PK], onDelete: Cascade)

  @@id([ReportID_NN_FK, TransactionID_NN_FK])
}

model ScheduledTransactions {
  ScheduledTransactionID_PK                                                                                             String                         @id
  ParentID_FK                                                                                                           String?
  Position                                                                                                              Int?
  LoanAccountDetailsID_UK_FK                                                                                            String?                        @unique(map: "sqlite_autoindex_ScheduledTransactions_2")
  GoalAccountDetailsID_UK_FK                                                                                            String?                        @unique(map: "sqlite_autoindex_ScheduledTransactions_3")
  AccountID_FK                                                                                                          String?
  AccountUserID_FK                                                                                                      String?
  FlagID_FK                                                                                                             String?
  PayeeID_FK                                                                                                            String?
  TransactionTypeID_FK                                                                                                  String?
  CategoryID_FK                                                                                                         String?
  InvestmentTransactionDetailsID_UK_FK                                                                                  String?                        @unique(map: "sqlite_autoindex_ScheduledTransactions_4")
  LoanTransactionDetailsID_UK_FK                                                                                        String?                        @unique(map: "sqlite_autoindex_ScheduledTransactions_5")
  TypeNumber                                                                                                            Int?
  Name                                                                                                                  String?
  ShortName                                                                                                             String?
  Info                                                                                                                  String?
  CreationDate                                                                                                          Float?
  ModifiedDate                                                                                                          Float?
  Active                                                                                                                Int?
  DateIntervalTypeNumber                                                                                                Int?
  StartDate                                                                                                             Float?
  EndDate                                                                                                               Float?
  LastDate                                                                                                              Float?
  DateTypeNumber                                                                                                        Int?
  PostTypeNumber                                                                                                        Int?
  PostToPendingDateTypeNumber                                                                                           Int?
  DaysInAdvanceToPostToPending                                                                                          Int?
  PostToAccountDateTypeNumber                                                                                           Int?
  DaysInAdvanceToPostToAccount                                                                                          Int?
  PostToAccountStatusNumber                                                                                             Int?
  IncludeInCalendar                                                                                                     Int?
  EventCalendarIdentifier                                                                                               String?
  EventCalendarItemExternalIdentifier                                                                                   String?
  EventAlarmTypeNumber                                                                                                  Int?
  IncludeInReminders                                                                                                    Int?
  RemindersCalendarIdentifier                                                                                           String?
  ReminderCalendarItemExternalIdentifier                                                                                String?
  ReminderAlarmTypeNumber                                                                                               Int?
  Memo                                                                                                                  String?
  ApplyNextCheckNumber                                                                                                  Int?
  CheckNumber                                                                                                           String?
  TransactionNumber                                                                                                     String?
  AmountTypeNumber                                                                                                      Int?
  Amount                                                                                                                Float?
  PercentAmount                                                                                                         Float?
  MiscValues                                                                                                            Bytes?
  Accounts                                                                                                              Accounts?                      @relation(fields: [AccountID_FK], references: [AccountID_PK])
  Entities                                                                                                              Entities?                      @relation(fields: [AccountUserID_FK], references: [EntityID_PK])
  Categories                                                                                                            Categories?                    @relation(fields: [CategoryID_FK], references: [CategoryID_PK])
  Flags                                                                                                                 Flags?                         @relation(fields: [FlagID_FK], references: [FlagID_PK])
  GoalAccountDetails_GoalAccountDetailsToScheduledTransactions_GoalAccountDetailsID_UK_FK                               GoalAccountDetails?            @relation("GoalAccountDetailsToScheduledTransactions_GoalAccountDetailsID_UK_FK", fields: [GoalAccountDetailsID_UK_FK], references: [GoalAccountDetailsID_PK], onDelete: Cascade)
  InvestmentTransactionDetails_InvestmentTransactionDetailsToScheduledTransactions_InvestmentTransactionDetailsID_UK_FK InvestmentTransactionDetails?  @relation("InvestmentTransactionDetailsToScheduledTransactions_InvestmentTransactionDetailsID_UK_FK", fields: [InvestmentTransactionDetailsID_UK_FK], references: [InvestmentTransactionDetailsID_PK])
  LoanAccountDetails_LoanAccountDetailsToScheduledTransactions_LoanAccountDetailsID_UK_FK                               LoanAccountDetails?            @relation("LoanAccountDetailsToScheduledTransactions_LoanAccountDetailsID_UK_FK", fields: [LoanAccountDetailsID_UK_FK], references: [LoanAccountDetailsID_PK], onDelete: Cascade)
  LoanTransactionDetails_LoanTransactionDetailsToScheduledTransactions_LoanTransactionDetailsID_UK_FK                   LoanTransactionDetails?        @relation("LoanTransactionDetailsToScheduledTransactions_LoanTransactionDetailsID_UK_FK", fields: [LoanTransactionDetailsID_UK_FK], references: [LoanTransactionDetailsID_PK])
  ScheduledTransactions                                                                                                 ScheduledTransactions?         @relation("ScheduledTransactionsToScheduledTransactions_ParentID_FK", fields: [ParentID_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)
  Payees                                                                                                                Payees?                        @relation(fields: [PayeeID_FK], references: [PayeeID_PK])
  TransactionTypes                                                                                                      TransactionTypes?              @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK])
  Attachments                                                                                                           Attachments[]
  BudgetsScheduledTransactions                                                                                          BudgetsScheduledTransactions[]
  GoalAccountDetails_GoalAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions                             GoalAccountDetails?            @relation("GoalAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions")
  InvestmentTransactionDetails_InvestmentTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions         InvestmentTransactionDetails?  @relation("InvestmentTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions")
  LoanAccountDetails_LoanAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions                             LoanAccountDetails?            @relation("LoanAccountDetails_ScheduledTransactionID_UK_FKToScheduledTransactions")
  LoanTransactionDetails_LoanTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions                     LoanTransactionDetails?        @relation("LoanTransactionDetails_ScheduledTransactionID_UK_FKToScheduledTransactions")
  Notes                                                                                                                 Notes[]
  ReportsScheduledTransactions                                                                                          ReportsScheduledTransactions[]
  other_ScheduledTransactions                                                                                           ScheduledTransactions[]        @relation("ScheduledTransactionsToScheduledTransactions_ParentID_FK")
  ScheduledTransactionsTags                                                                                             ScheduledTransactionsTags[]
  Transactions                                                                                                          Transactions[]
}

model ScheduledTransactionsTags {
  ScheduledTransactionID_NN_FK String
  TagID_NN_FK                  String
  ScheduledTransactions        ScheduledTransactions @relation(fields: [ScheduledTransactionID_NN_FK], references: [ScheduledTransactionID_PK], onDelete: Cascade)
  Tags                         Tags                  @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)

  @@id([ScheduledTransactionID_NN_FK, TagID_NN_FK])
}

model Securities {
  SecurityID_PK                                      String                           @id
  SecurityTypeID_NN_FK                               String
  UnderlyingSecurityID_FK                            String?
  AccountID_UK_FK                                    String?                          @unique(map: "sqlite_autoindex_Securities_2")
  SecurityGroupID_FK                                 String?
  SecurityGoalID_FK                                  String?
  SecurityExchangeID_FK                              String?
  SecurityFundCategoryID_FK                          String?
  SecurityFundFamilyID_FK                            String?
  SecurityCustomLabelID_FK                           String?
  WebsiteID_UK_FK                                    String?                          @unique(map: "sqlite_autoindex_Securities_3")
  Position                                           Int?
  BehaviorTypeNumber                                 Int?
  CurrencyCode                                       String?
  IncludeInLists                                     Int?
  IncludeInReports                                   Int?
  IncludeInWatchList                                 Int?
  Favorite                                           Int?
  Name                                               String?
  ShortName                                          String?
  Info                                               String?
  ColorString                                        String?
  AlternateColorString                               String?
  TintColorString                                    String?
  AlternateTintColorString                           String?
  ImageData                                          Bytes?
  AlternateImageData                                 Bytes?
  IdentifierTypeNumber                               Int?
  Identifier                                         String?
  Symbol                                             String?
  DataSourceTypeNumber                               Int?
  DataSourceIdentifier                               String?
  YahooSymbol                                        String?
  GoogleSymbol                                       String?
  MorningstarSymbol                                  String?
  OtherWebsite1Symbol                                String?
  OtherWebsite2Symbol                                String?
  TaxFree                                            Int?
  DefaultLotTrackingTypeNumber                       Int?
  MinimumFractionDigits                              Int?
  MaximumFractionDigits                              Int?
  UnitPrice                                          Float?
  UnitPriceAsOfDate                                  Float?
  PreviousUnitPrice                                  Float?
  ChangeInUnitPrice                                  Float?
  PercentChangeInUnitPrice                           Float?
  LowAlertUnitPricePoint                             Float?
  HighAlertUnitPricePoint                            Float?
  ImportUnitPrice                                    Int?
  ImportOtherInfo                                    Int?
  ImportHistoricalPrices                             Int?
  DownloadUnitPrice                                  Int?
  DownloadOtherInfo                                  Int?
  DownloadHistoricalPrices                           Int?
  LastUnitPriceDownloadDate                          Float?
  LastOtherInfoDownloadDate                          Float?
  LastHistoricalPriceDownloadDate                    Float?
  DateOfMostRecentDownloadedHistoricalQuote          Float?
  AdjustedCloseOfMostRecentDownloadedHistoricalQuote Float?
  Open                                               Float?
  Bid                                                Float?
  BidSize                                            Float?
  Ask                                                Float?
  AskSize                                            Float?
  DaysLow                                            Float?
  DaysHigh                                           Float?
  FiftyTwoWeekLow                                    Float?
  FiftyTwoWeekHigh                                   Float?
  Volume                                             Float?
  AverageVolume                                      Float?
  MarketCapTypeNumber                                Int?
  MarketCap                                          Float?
  Dividend                                           Float?
  DividendYield                                      Float?
  PriceEarningsRatio                                 Float?
  OneYearForwardPriceEarningsRatio                   Float?
  EarningsPerShare                                   Float?
  OneYearTargetEstimate                              Float?
  PriceShareRatio                                    Float?
  PriceBookRatio                                     Float?
  PegFiveYearExpected                                Float?
  TotalExpenseRatio                                  Float?
  LongTermDebtEquityRatio                            Float?
  PriceFreeCashFlowRatio                             Float?
  NetProfitMargin                                    Float?
  ReturnOnEquity                                     Float?
  YearToDateReturn                                   Float?
  ThreeYearAverageReturn                             Float?
  FiveYearAverageReturn                              Float?
  Beta1Year                                          Float?
  Beta2Year                                          Float?
  Beta3Year                                          Float?
  Beta5Year                                          Float?
  FiftyDayMovingAverage                              Float?
  TwoHundredDayMovingAverage                         Float?
  ExpectedReturn                                     Float?
  StandardDeviation                                  Float?
  InceptionDate                                      Float?
  NetAssets                                          Float?
  NetAssetValue                                      Float?
  TurnoverRatio                                      Float?
  BackLoad                                           Float?
  FundRatingTypeNumber                               Int?
  FundRiskRatingTypeNumber                           Int?
  RankInCategory                                     Float?
  PercentRankInCategory                              Float?
  IssueDate                                          Float?
  MaturityDate                                       Float?
  ParValue                                           Float?
  BondIssuerTypeNumber                               Int?
  BondPayoutTypeNumber                               Int?
  CouponRate                                         Float?
  CouponFrequencyTypeNumber                          Int?
  CallDate                                           Float?
  CallTypeNumber                                     Int?
  CallUnitPrice                                      Float?
  CurrentYield                                       Float?
  YieldToCall                                        Float?
  YieldToMaturity                                    Float?
  BondRatingTypeNumber                               Int?
  FloatingRateTypeNumber                             Int?
  FloatingRateSpread                                 Float?
  OriginalPrincipalAmount                            Float?
  InflationIndexRatio                                Float?
  CurrentPoolFactor                                  Float?
  OptionTypeNumber                                   Int?
  OptionStyleNumber                                  Int?
  SharesPerContract                                  Float?
  ExpirationDate                                     Float?
  Strike                                             Float?
  ContractLow                                        Float?
  ContractHigh                                       Float?
  OpenInterest                                       Float?
  MiscValues                                         Bytes?
  Accounts_AccountsToSecurities_AccountID_UK_FK      Accounts?                        @relation("AccountsToSecurities_AccountID_UK_FK", fields: [AccountID_UK_FK], references: [AccountID_PK], onDelete: Cascade)
  SecurityCustomLabels                               SecurityCustomLabels?            @relation(fields: [SecurityCustomLabelID_FK], references: [SecurityCustomLabelID_PK])
  SecurityExchanges                                  SecurityExchanges?               @relation(fields: [SecurityExchangeID_FK], references: [SecurityExchangeID_PK])
  fundCategories                                     fundCategories?                  @relation(fields: [SecurityFundCategoryID_FK], references: [SecurityFundCategoryID_PK])
  SecurityFundFamilies                               SecurityFundFamilies?            @relation(fields: [SecurityFundFamilyID_FK], references: [SecurityFundFamilyID_PK])
  SecurityGoals                                      SecurityGoals?                   @relation(fields: [SecurityGoalID_FK], references: [SecurityGoalID_PK])
  SecurityGroups                                     SecurityGroups?                  @relation(fields: [SecurityGroupID_FK], references: [SecurityGroupID_PK])
  SecurityTypes                                      SecurityTypes                    @relation(fields: [SecurityTypeID_NN_FK], references: [SecurityTypeID_PK], onDelete: Cascade)
  Securities                                         Securities?                      @relation("SecuritiesToSecurities_UnderlyingSecurityID_FK", fields: [UnderlyingSecurityID_FK], references: [SecurityID_PK])
  Websites_Securities_WebsiteID_UK_FKToWebsites      Websites?                        @relation("Securities_WebsiteID_UK_FKToWebsites", fields: [WebsiteID_UK_FK], references: [WebsiteID_PK])
  Accounts_Accounts_SecurityID_UK_FKToSecurities     Accounts?                        @relation("Accounts_SecurityID_UK_FKToSecurities")
  Attachments                                        Attachments[]
  HistoricalPrices                                   HistoricalPrices[]
  InvestmentAccountDetails                           InvestmentAccountDetails[]
  InvestmentPortfoliosSecurities                     InvestmentPortfoliosSecurities[]
  InvestmentTransactionDetails                       InvestmentTransactionDetails[]
  Notes                                              Notes[]
  ReportForecastDetails                              ReportForecastDetails[]
  ReportGoalDetails                                  ReportGoalDetails[]
  ReportsSecurities                                  ReportsSecurities[]
  other_Securities                                   Securities[]                     @relation("SecuritiesToSecurities_UnderlyingSecurityID_FK")
  SecuritiesAssetClasses                             SecuritiesAssetClasses[]
  SecuritiesIndustries                               SecuritiesIndustries[]
  Websites_SecuritiesToWebsites_SecurityID_UK_FK     Websites?                        @relation("SecuritiesToWebsites_SecurityID_UK_FK")
}

model SecuritiesAssetClasses {
  SecurityID_NN_FK           String
  SecurityAssetClassID_NN_FK String
  Percent                    Float?
  SecurityAssetClasses       SecurityAssetClasses @relation(fields: [SecurityAssetClassID_NN_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)
  Securities                 Securities           @relation(fields: [SecurityID_NN_FK], references: [SecurityID_PK], onDelete: Cascade)

  @@id([SecurityID_NN_FK, SecurityAssetClassID_NN_FK])
}

model SecuritiesIndustries {
  SecurityID_NN_FK         String
  SecurityIndustryID_NN_FK String
  Percent                  Float?
  Securities               Securities         @relation(fields: [SecurityID_NN_FK], references: [SecurityID_PK], onDelete: Cascade)
  SecurityIndustries       SecurityIndustries @relation(fields: [SecurityIndustryID_NN_FK], references: [SecurityIndustryID_PK], onDelete: Cascade)

  @@id([SecurityID_NN_FK, SecurityIndustryID_NN_FK])
}

model SecurityAssetClasses {
  SecurityAssetClassID_PK                  String                                     @id
  ParentID_FK                              String?
  Position                                 Int?
  TypeNumber                               Int?
  IncludeInLists                           Int?
  IncludeInReports                         Int?
  Favorite                                 Int?
  Name                                     String?
  ShortName                                String?
  Info                                     String?
  ColorString                              String?
  AlternateColorString                     String?
  TintColorString                          String?
  AlternateTintColorString                 String?
  ImageData                                Bytes?
  AlternateImageData                       Bytes?
  SecurityAssetClasses                     SecurityAssetClasses?                      @relation("SecurityAssetClassesToSecurityAssetClasses_ParentID_FK", fields: [ParentID_FK], references: [SecurityAssetClassID_PK], onDelete: Cascade)
  Attachments                              Attachments[]
  InvestmentPortfoliosSecurityAssetClasses InvestmentPortfoliosSecurityAssetClasses[]
  Notes                                    Notes[]
  ReportForecastDetails                    ReportForecastDetails[]
  ReportGoalDetails                        ReportGoalDetails[]
  ReportsSecurityAssetClasses              ReportsSecurityAssetClasses[]
  SecuritiesAssetClasses                   SecuritiesAssetClasses[]
  other_SecurityAssetClasses               SecurityAssetClasses[]                     @relation("SecurityAssetClassesToSecurityAssetClasses_ParentID_FK")
}

model SecurityCustomLabels {
  SecurityCustomLabelID_PK                 String                                     @id
  ParentID_FK                              String?
  Position                                 Int?
  TypeNumber                               Int?
  IncludeInLists                           Int?
  IncludeInReports                         Int?
  Favorite                                 Int?
  Name                                     String?
  ShortName                                String?
  Info                                     String?
  ColorString                              String?
  AlternateColorString                     String?
  TintColorString                          String?
  AlternateTintColorString                 String?
  ImageData                                Bytes?
  AlternateImageData                       Bytes?
  SecurityCustomLabels                     SecurityCustomLabels?                      @relation("SecurityCustomLabelsToSecurityCustomLabels_ParentID_FK", fields: [ParentID_FK], references: [SecurityCustomLabelID_PK], onDelete: Cascade)
  Attachments                              Attachments[]
  InvestmentPortfoliosSecurityCustomLabels InvestmentPortfoliosSecurityCustomLabels[]
  Notes                                    Notes[]
  ReportForecastDetails                    ReportForecastDetails[]
  ReportGoalDetails                        ReportGoalDetails[]
  ReportsSecurityCustomLabels              ReportsSecurityCustomLabels[]
  Securities                               Securities[]
  other_SecurityCustomLabels               SecurityCustomLabels[]                     @relation("SecurityCustomLabelsToSecurityCustomLabels_ParentID_FK")
}

model SecurityExchanges {
  SecurityExchangeID_PK                 String                                  @id
  Position                              Int?
  TypeNumber                            Int?
  CurrencyCode                          String?
  IncludeInLists                        Int?
  IncludeInReports                      Int?
  Favorite                              Int?
  Name                                  String?
  ShortName                             String?
  Info                                  String?
  ColorString                           String?
  AlternateColorString                  String?
  TintColorString                       String?
  AlternateTintColorString              String?
  ImageData                             Bytes?
  AlternateImageData                    Bytes?
  CountryCode                           String?
  TimeZoneName                          String?
  OpeningBellHour                       Int?
  OpeningBellMinute                     Int?
  ClosingBellHour                       Int?
  ClosingBellMinute                     Int?
  Attachments                           Attachments[]
  InvestmentPortfoliosSecurityExchanges InvestmentPortfoliosSecurityExchanges[]
  Notes                                 Notes[]
  ReportForecastDetails                 ReportForecastDetails[]
  ReportGoalDetails                     ReportGoalDetails[]
  ReportsSecurityExchanges              ReportsSecurityExchanges[]
  Securities                            Securities[]
}

model SecurityFundFamilies {
  SecurityFundFamilyID_PK                  String                                     @id
  Position                                 Int?
  TypeNumber                               Int?
  IncludeInLists                           Int?
  IncludeInReports                         Int?
  Favorite                                 Int?
  Name                                     String?
  ShortName                                String?
  Info                                     String?
  ColorString                              String?
  AlternateColorString                     String?
  TintColorString                          String?
  AlternateTintColorString                 String?
  ImageData                                Bytes?
  AlternateImageData                       Bytes?
  Attachments                              Attachments[]
  InvestmentPortfoliosSecurityFundFamilies InvestmentPortfoliosSecurityFundFamilies[]
  Notes                                    Notes[]
  ReportForecastDetails                    ReportForecastDetails[]
  ReportGoalDetails                        ReportGoalDetails[]
  ReportsSecurityFundFamilies              ReportsSecurityFundFamilies[]
  Securities                               Securities[]
}

model SecurityGoals {
  SecurityGoalID_PK                 String                              @id
  ParentID_FK                       String?
  Position                          Int?
  TypeNumber                        Int?
  IncludeInLists                    Int?
  IncludeInReports                  Int?
  Favorite                          Int?
  Name                              String?
  ShortName                         String?
  Info                              String?
  ColorString                       String?
  AlternateColorString              String?
  TintColorString                   String?
  AlternateTintColorString          String?
  ImageData                         Bytes?
  AlternateImageData                Bytes?
  SecurityGoals                     SecurityGoals?                      @relation("SecurityGoalsToSecurityGoals_ParentID_FK", fields: [ParentID_FK], references: [SecurityGoalID_PK], onDelete: Cascade)
  Attachments                       Attachments[]
  InvestmentPortfoliosSecurityGoals InvestmentPortfoliosSecurityGoals[]
  Notes                             Notes[]
  ReportForecastDetails             ReportForecastDetails[]
  ReportGoalDetails                 ReportGoalDetails[]
  ReportsSecurityGoals              ReportsSecurityGoals[]
  Securities                        Securities[]
  other_SecurityGoals               SecurityGoals[]                     @relation("SecurityGoalsToSecurityGoals_ParentID_FK")
}

model SecurityGroups {
  SecurityGroupID_PK                 String                               @id
  ParentID_FK                        String?
  Position                           Int?
  TypeNumber                         Int?
  IncludeInLists                     Int?
  IncludeInReports                   Int?
  Favorite                           Int?
  Name                               String?
  ShortName                          String?
  Info                               String?
  ColorString                        String?
  AlternateColorString               String?
  TintColorString                    String?
  AlternateTintColorString           String?
  ImageData                          Bytes?
  AlternateImageData                 Bytes?
  SecurityGroups                     SecurityGroups?                      @relation("SecurityGroupsToSecurityGroups_ParentID_FK", fields: [ParentID_FK], references: [SecurityGroupID_PK], onDelete: Cascade)
  Attachments                        Attachments[]
  InvestmentPortfoliosSecurityGroups InvestmentPortfoliosSecurityGroups[]
  Notes                              Notes[]
  ReportForecastDetails              ReportForecastDetails[]
  ReportGoalDetails                  ReportGoalDetails[]
  ReportsSecurityGroups              ReportsSecurityGroups[]
  Securities                         Securities[]
  other_SecurityGroups               SecurityGroups[]                     @relation("SecurityGroupsToSecurityGroups_ParentID_FK")
}

model SecurityIndustries {
  SecurityIndustryID_PK                  String                                   @id
  SecuritySectorID_NN_FK                 String
  Position                               Int?
  TypeNumber                             Int?
  IncludeInLists                         Int?
  IncludeInReports                       Int?
  Favorite                               Int?
  Name                                   String?
  ShortName                              String?
  Info                                   String?
  ColorString                            String?
  AlternateColorString                   String?
  TintColorString                        String?
  AlternateTintColorString               String?
  ImageData                              Bytes?
  AlternateImageData                     Bytes?
  YahooSymbol                            String?
  OtherWebsite1Symbol                    String?
  OtherWebsite2Symbol                    String?
  PercentChangeInUnitPrice               Float?
  MarketCap                              Float?
  DividendYield                          Float?
  PriceEarningsRatio                     Float?
  PriceBookRatio                         Float?
  LongTermDebtEquityRatio                Float?
  PriceFreeCashFlowRatio                 Float?
  NetProfitMargin                        Float?
  ReturnOnEquity                         Float?
  SecuritySectors                        SecuritySectors                          @relation(fields: [SecuritySectorID_NN_FK], references: [SecuritySectorID_PK], onDelete: Cascade)
  Attachments                            Attachments[]
  InvestmentPortfoliosSecurityIndustries InvestmentPortfoliosSecurityIndustries[]
  Notes                                  Notes[]
  ReportForecastDetails                  ReportForecastDetails[]
  ReportGoalDetails                      ReportGoalDetails[]
  ReportsSecurityIndustries              ReportsSecurityIndustries[]
  SecuritiesIndustries                   SecuritiesIndustries[]
}

model SecuritySectors {
  SecuritySectorID_PK                 String                                @id
  Position                            Int?
  TypeNumber                          Int?
  IncludeInLists                      Int?
  IncludeInReports                    Int?
  Favorite                            Int?
  Name                                String?
  ShortName                           String?
  Info                                String?
  ColorString                         String?
  AlternateColorString                String?
  TintColorString                     String?
  AlternateTintColorString            String?
  ImageData                           Bytes?
  AlternateImageData                  Bytes?
  YahooSymbol                         String?
  OtherWebsite1Symbol                 String?
  OtherWebsite2Symbol                 String?
  PercentChangeInUnitPrice            Float?
  MarketCap                           Float?
  DividendYield                       Float?
  PriceEarningsRatio                  Float?
  PriceBookRatio                      Float?
  LongTermDebtEquityRatio             Float?
  PriceFreeCashFlowRatio              Float?
  NetProfitMargin                     Float?
  ReturnOnEquity                      Float?
  Attachments                         Attachments[]
  InvestmentPortfoliosSecuritySectors InvestmentPortfoliosSecuritySectors[]
  Notes                               Notes[]
  ReportForecastDetails               ReportForecastDetails[]
  ReportGoalDetails                   ReportGoalDetails[]
  ReportsSecuritySectors              ReportsSecuritySectors[]
  SecurityIndustries                  SecurityIndustries[]
}

model SecurityTypes {
  SecurityTypeID_PK                 String                              @id
  ParentID_FK                       String?
  Position                          Int?
  TypeNumber                        Int?
  IncludeInLists                    Int?
  IncludeInReports                  Int?
  Favorite                          Int?
  Name                              String?
  ShortName                         String?
  Info                              String?
  ColorString                       String?
  AlternateColorString              String?
  TintColorString                   String?
  AlternateTintColorString          String?
  ImageData                         Bytes?
  AlternateImageData                Bytes?
  SecurityTypes                     SecurityTypes?                      @relation("SecurityTypesToSecurityTypes_ParentID_FK", fields: [ParentID_FK], references: [SecurityTypeID_PK], onDelete: Cascade)
  InvestmentPortfoliosSecurityTypes InvestmentPortfoliosSecurityTypes[]
  ReportForecastDetails             ReportForecastDetails[]
  ReportGoalDetails                 ReportGoalDetails[]
  ReportsSecurityTypes              ReportsSecurityTypes[]
  Securities                        Securities[]
  other_SecurityTypes               SecurityTypes[]                     @relation("SecurityTypesToSecurityTypes_ParentID_FK")
}

model Statements {
  StatementID_PK                                String         @id
  AccountID_NN_FK                               String
  ImportID_UK_FK                                String?        @unique(map: "sqlite_autoindex_Statements_2")
  ReconcileTypeNumber                           Int?
  StatusNumber                                  Int?
  Name                                          String?
  ShortName                                     String?
  Info                                          String?
  Date                                          Float?
  Balance                                       Float?
  StartDate                                     Float?
  EndDate                                       Float?
  StartingBalance                               Float?
  EndingBalance                                 Float?
  Accounts                                      Accounts       @relation(fields: [AccountID_NN_FK], references: [AccountID_PK], onDelete: Cascade)
  Imports_ImportsToStatements_ImportID_UK_FK    Imports?       @relation("ImportsToStatements_ImportID_UK_FK", fields: [ImportID_UK_FK], references: [ImportID_PK])
  Attachments                                   Attachments[]
  Imports_Imports_StatementID_UK_FKToStatements Imports?       @relation("Imports_StatementID_UK_FKToStatements")
  Notes                                         Notes[]
  Transactions                                  Transactions[]
}

model Tags {
  TagID_PK                        String                            @id
  ParentID_FK                     String?
  Position                        Int?
  TypeNumber                      Int?
  IncludeInLists                  Int?
  IncludeInReports                Int?
  Favorite                        Int?
  TaxCopyNumber                   Int?
  Name                            String?
  ShortName                       String?
  Info                            String?
  ColorString                     String?
  AlternateColorString            String?
  TintColorString                 String?
  AlternateTintColorString        String?
  ImageData                       Bytes?
  AlternateImageData              Bytes?
  Tags                            Tags?                             @relation("TagsToTags_ParentID_FK", fields: [ParentID_FK], references: [TagID_PK], onDelete: Cascade)
  AccountDefaultsTags             AccountDefaultsTags[]
  Attachments                     Attachments[]
  BudgetsTags                     BudgetsTags[]
  LoanTransactionDetailsTags      LoanTransactionDetailsTags[]
  Notes                           Notes[]
  ReportForecastDetails           ReportForecastDetails[]
  ReportGoalDetails               ReportGoalDetails[]
  ReportsTags                     ReportsTags[]
  ScheduledTransactionsTags       ScheduledTransactionsTags[]
  other_Tags                      Tags[]                            @relation("TagsToTags_ParentID_FK")
  TransactionRuleTransactionsTags TransactionRuleTransactionsTags[]
  TransactionsTags                TransactionsTags[]
}

model TaxCodes {
  TaxCodeID_PK  String       @id
  TypeNumber    Int?
  Code          String?
  Name          String?
  ShortName     String?
  Info          String?
  Copies        Int?
  MultiLineItem Int?
  Sorting       String?
  Sign          String?
  RecordFormat  String?
  Form          String?
  FormLine      String?
  Categories    Categories[]
}

model TransactionLogs {
  TransactionLogID_PK   String  @id
  Version_NN            String
  DeviceID_NN           String
  DeviceName            String?
  Number_NN             Int
  TimeStamp_NN          Float
  NumberOfObjectChanges Int?

  @@unique([DeviceID_NN, Number_NN, TimeStamp_NN], map: "sqlite_autoindex_TransactionLogs_3")
  @@unique([DeviceID_NN, Number_NN], map: "sqlite_autoindex_TransactionLogs_2")
}

model TransactionRuleTransactions {
  TransactionRuleTransactionID_PK                                                                                             String                            @id
  ParentID_FK                                                                                                                 String?
  Position                                                                                                                    Int?
  TransactionRuleID_UK_FK                                                                                                     String?                           @unique(map: "sqlite_autoindex_TransactionRuleTransactions_2")
  AccountID_FK                                                                                                                String?
  AccountUserID_FK                                                                                                            String?
  FlagID_FK                                                                                                                   String?
  PayeeID_FK                                                                                                                  String?
  TransactionTypeID_FK                                                                                                        String?
  CategoryID_FK                                                                                                               String?
  InvestmentTransactionDetailsID_UK_FK                                                                                        String?                           @unique(map: "sqlite_autoindex_TransactionRuleTransactions_3")
  Memo                                                                                                                        String?
  CheckNumber                                                                                                                 String?
  TransactionNumber                                                                                                           String?
  AmountTypeNumber                                                                                                            Int?
  Amount                                                                                                                      Float?
  PercentAmount                                                                                                               Float?
  StatusNumber                                                                                                                Int?
  ClearAccount                                                                                                                Int?
  ClearAccountUser                                                                                                            Int?
  ClearFlag                                                                                                                   Int?
  ClearPayee                                                                                                                  Int?
  ClearTransactionType                                                                                                        Int?
  ClearCategory                                                                                                               Int?
  ClearTags                                                                                                                   Int?
  ClearInvestmentTransactionDetails                                                                                           Int?
  ClearSecurity                                                                                                               Int?
  ClearUnits                                                                                                                  Int?
  ClearUnitPrice                                                                                                              Int?
  ClearCommission                                                                                                             Int?
  ClearMemo                                                                                                                   Int?
  ClearCheckNumber                                                                                                            Int?
  ClearTransactionNumber                                                                                                      Int?
  ClearAmount                                                                                                                 Int?
  ClearStatus                                                                                                                 Int?
  Accounts                                                                                                                    Accounts?                         @relation(fields: [AccountID_FK], references: [AccountID_PK])
  Entities                                                                                                                    Entities?                         @relation(fields: [AccountUserID_FK], references: [EntityID_PK])
  Categories                                                                                                                  Categories?                       @relation(fields: [CategoryID_FK], references: [CategoryID_PK])
  Flags                                                                                                                       Flags?                            @relation(fields: [FlagID_FK], references: [FlagID_PK])
  InvestmentTransactionDetails_InvestmentTransactionDetailsToTransactionRuleTransactions_InvestmentTransactionDetailsID_UK_FK InvestmentTransactionDetails?     @relation("InvestmentTransactionDetailsToTransactionRuleTransactions_InvestmentTransactionDetailsID_UK_FK", fields: [InvestmentTransactionDetailsID_UK_FK], references: [InvestmentTransactionDetailsID_PK])
  TransactionRuleTransactions                                                                                                 TransactionRuleTransactions?      @relation("TransactionRuleTransactionsToTransactionRuleTransactions_ParentID_FK", fields: [ParentID_FK], references: [TransactionRuleTransactionID_PK], onDelete: Cascade)
  Payees                                                                                                                      Payees?                           @relation(fields: [PayeeID_FK], references: [PayeeID_PK])
  TransactionRules_TransactionRuleTransactions_TransactionRuleID_UK_FKToTransactionRules                                      TransactionRules?                 @relation("TransactionRuleTransactions_TransactionRuleID_UK_FKToTransactionRules", fields: [TransactionRuleID_UK_FK], references: [TransactionRuleID_PK], onDelete: Cascade)
  TransactionTypes                                                                                                            TransactionTypes?                 @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK])
  InvestmentTransactionDetails_InvestmentTransactionDetails_TransactionRuleTransactionID_UK_FKToTransactionRuleTransactions   InvestmentTransactionDetails?     @relation("InvestmentTransactionDetails_TransactionRuleTransactionID_UK_FKToTransactionRuleTransactions")
  other_TransactionRuleTransactions                                                                                           TransactionRuleTransactions[]     @relation("TransactionRuleTransactionsToTransactionRuleTransactions_ParentID_FK")
  TransactionRuleTransactionsTags                                                                                             TransactionRuleTransactionsTags[]
  TransactionRules_TransactionRuleTransactionsToTransactionRules_TransactionRuleTransactionID_NN_UK_FK                        TransactionRules?                 @relation("TransactionRuleTransactionsToTransactionRules_TransactionRuleTransactionID_NN_UK_FK")
}

model TransactionRuleTransactionsTags {
  TransactionRuleTransactionID_NN_FK String
  TagID_NN_FK                        String
  Tags                               Tags                        @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)
  TransactionRuleTransactions        TransactionRuleTransactions @relation(fields: [TransactionRuleTransactionID_NN_FK], references: [TransactionRuleTransactionID_PK], onDelete: Cascade)

  @@id([TransactionRuleTransactionID_NN_FK, TagID_NN_FK])
}

model TransactionRules {
  TransactionRuleID_PK                                                                                            String                       @id
  TransactionRuleTransactionID_NN_UK_FK                                                                           String                       @unique(map: "sqlite_autoindex_TransactionRules_2")
  PayeeID_UK_FK                                                                                                   String?                      @unique(map: "sqlite_autoindex_TransactionRules_3")
  Position                                                                                                        Int?
  TypeNumber                                                                                                      Int?
  ActivationTypeNumber                                                                                            Int?
  UpdatingTypeNumber                                                                                              Int?
  ApplicationTypeNumber                                                                                           Int?
  PriorityTypeNumber                                                                                              Int?
  Name                                                                                                            String?
  ShortName                                                                                                       String?
  Info                                                                                                            String?
  OverallParametersCombinationTypeNumber                                                                          Int?
  ObjectMatchesCombinationTypeNumber                                                                              Int?
  Payees_PayeesToTransactionRules_PayeeID_UK_FK                                                                   Payees?                      @relation("PayeesToTransactionRules_PayeeID_UK_FK", fields: [PayeeID_UK_FK], references: [PayeeID_PK], onDelete: Cascade)
  TransactionRuleTransactions_TransactionRuleTransactionsToTransactionRules_TransactionRuleTransactionID_NN_UK_FK TransactionRuleTransactions  @relation("TransactionRuleTransactionsToTransactionRules_TransactionRuleTransactionID_NN_UK_FK", fields: [TransactionRuleTransactionID_NN_UK_FK], references: [TransactionRuleTransactionID_PK], onDelete: Cascade)
  ObjectMatches                                                                                                   ObjectMatches[]
  Payees_Payees_TransactionRuleID_UK_FKToTransactionRules                                                         Payees?                      @relation("Payees_TransactionRuleID_UK_FKToTransactionRules")
  TransactionRuleTransactions_TransactionRuleTransactions_TransactionRuleID_UK_FKToTransactionRules               TransactionRuleTransactions? @relation("TransactionRuleTransactions_TransactionRuleID_UK_FKToTransactionRules")
}

model TransactionTypes {
  TransactionTypeID_PK        String                        @id
  TypeNumber                  Int?
  AmountRestrictionTypeNumber Int?
  SharesAffectTypeNumber      Int?
  IncludeInLists              Int?
  IncludeInReports            Int?
  Favorite                    Int?
  Name                        String?
  ShortName                   String?
  Info                        String?
  ColorString                 String?
  AlternateColorString        String?
  TintColorString             String?
  AlternateTintColorString    String?
  ImageData                   Bytes?
  AlternateImageData          Bytes?
  Accounts                    Accounts[]
  Attachments                 Attachments[]
  LoanTransactionDetails      LoanTransactionDetails[]
  Notes                       Notes[]
  ReportForecastDetails       ReportForecastDetails[]
  ReportGoalDetails           ReportGoalDetails[]
  ReportsTransactionTypes     ReportsTransactionTypes[]
  ScheduledTransactions       ScheduledTransactions[]
  TransactionRuleTransactions TransactionRuleTransactions[]
  Transactions                Transactions[]
}

model Transactions {
  TransactionID_PK                                                                                             String                        @id
  ParentID_FK                                                                                                  String?
  Position                                                                                                     Int?
  AccountID_FK                                                                                                 String?
  AccountUserID_FK                                                                                             String?
  FlagID_FK                                                                                                    String?
  PayeeID_FK                                                                                                   String?
  TransactionTypeID_FK                                                                                         String?
  CategoryID_FK                                                                                                String?
  InvestmentTransactionDetailsID_UK_FK                                                                         String?                       @unique(map: "sqlite_autoindex_Transactions_2")
  LoanTransactionDetailsID_UK_FK                                                                               String?                       @unique(map: "sqlite_autoindex_Transactions_3")
  LinkedTransferID_UK_FK                                                                                       String?                       @unique(map: "sqlite_autoindex_Transactions_4")
  ScheduledTransactionID_FK                                                                                    String?
  ImportedTransactionID_UK_FK                                                                                  String?                       @unique(map: "sqlite_autoindex_Transactions_5")
  StatementID_FK                                                                                               String?
  OriginNumber                                                                                                 Int?
  UniqueID                                                                                                     String?
  OriginalCurrencyCode                                                                                         String?
  OriginalCurrencyRate                                                                                         Float?
  CreationDate                                                                                                 Float?
  ModifiedDate                                                                                                 Float?
  Date                                                                                                         Float?
  ClearedDate                                                                                                  Float?
  Memo                                                                                                         String?
  CheckNumber                                                                                                  String?
  NeedToPrintCheck                                                                                             Int?
  TransactionNumber                                                                                            String?
  Amount                                                                                                       Float?
  AmountAppliedToBalance                                                                                       Float?
  StatusNumber                                                                                                 Int?
  Accounts                                                                                                     Accounts?                     @relation(fields: [AccountID_FK], references: [AccountID_PK], onDelete: Cascade)
  Entities                                                                                                     Entities?                     @relation(fields: [AccountUserID_FK], references: [EntityID_PK])
  Categories                                                                                                   Categories?                   @relation(fields: [CategoryID_FK], references: [CategoryID_PK])
  Flags                                                                                                        Flags?                        @relation(fields: [FlagID_FK], references: [FlagID_PK])
  ImportedTransactions_ImportedTransactionsToTransactions_ImportedTransactionID_UK_FK                          ImportedTransactions?         @relation("ImportedTransactionsToTransactions_ImportedTransactionID_UK_FK", fields: [ImportedTransactionID_UK_FK], references: [ImportedTransactionID_PK])
  InvestmentTransactionDetails_InvestmentTransactionDetailsToTransactions_InvestmentTransactionDetailsID_UK_FK InvestmentTransactionDetails? @relation("InvestmentTransactionDetailsToTransactions_InvestmentTransactionDetailsID_UK_FK", fields: [InvestmentTransactionDetailsID_UK_FK], references: [InvestmentTransactionDetailsID_PK])
  Transactions_TransactionsToTransactions_LinkedTransferID_UK_FK                                               Transactions?                 @relation("TransactionsToTransactions_LinkedTransferID_UK_FK", fields: [LinkedTransferID_UK_FK], references: [TransactionID_PK])
  LoanTransactionDetails_LoanTransactionDetailsToTransactions_LoanTransactionDetailsID_UK_FK                   LoanTransactionDetails?       @relation("LoanTransactionDetailsToTransactions_LoanTransactionDetailsID_UK_FK", fields: [LoanTransactionDetailsID_UK_FK], references: [LoanTransactionDetailsID_PK])
  Transactions_TransactionsToTransactions_ParentID_FK                                                          Transactions?                 @relation("TransactionsToTransactions_ParentID_FK", fields: [ParentID_FK], references: [TransactionID_PK], onDelete: Cascade)
  Payees                                                                                                       Payees?                       @relation(fields: [PayeeID_FK], references: [PayeeID_PK])
  ScheduledTransactions                                                                                        ScheduledTransactions?        @relation(fields: [ScheduledTransactionID_FK], references: [ScheduledTransactionID_PK])
  Statements                                                                                                   Statements?                   @relation(fields: [StatementID_FK], references: [StatementID_PK])
  TransactionTypes                                                                                             TransactionTypes?             @relation(fields: [TransactionTypeID_FK], references: [TransactionTypeID_PK])
  Attachments                                                                                                  Attachments[]
  ImportedTransactions_ImportedTransactions_TransactionID_UK_FKToTransactions                                  ImportedTransactions?         @relation("ImportedTransactions_TransactionID_UK_FKToTransactions")
  InvestmentTransactionDetails_InvestmentTransactionDetails_TransactionID_UK_FKToTransactions                  InvestmentTransactionDetails? @relation("InvestmentTransactionDetails_TransactionID_UK_FKToTransactions")
  LoanTransactionDetails_LoanTransactionDetails_TransactionID_UK_FKToTransactions                              LoanTransactionDetails?       @relation("LoanTransactionDetails_TransactionID_UK_FKToTransactions")
  Notes                                                                                                        Notes[]
  ReportsTransactions                                                                                          ReportsTransactions[]
  other_Transactions_TransactionsToTransactions_LinkedTransferID_UK_FK                                         Transactions?                 @relation("TransactionsToTransactions_LinkedTransferID_UK_FK")
  other_Transactions_TransactionsToTransactions_ParentID_FK                                                    Transactions[]                @relation("TransactionsToTransactions_ParentID_FK")
  TransactionsTags                                                                                             TransactionsTags[]
}

model TransactionsTags {
  TransactionID_NN_FK String
  TagID_NN_FK         String
  Tags                Tags         @relation(fields: [TagID_NN_FK], references: [TagID_PK], onDelete: Cascade)
  Transactions        Transactions @relation(fields: [TransactionID_NN_FK], references: [TransactionID_PK], onDelete: Cascade)

  @@id([TransactionID_NN_FK, TagID_NN_FK])
}

model Websites {
  WebsiteID_PK                                               String         @id
  LocationID_UK_FK                                           String?        @unique(map: "sqlite_autoindex_Websites_2")
  AccountGroupID_UK_FK                                       String?        @unique(map: "sqlite_autoindex_Websites_3")
  AccountID_UK_FK                                            String?        @unique(map: "sqlite_autoindex_Websites_4")
  PayeeID_UK_FK                                              String?        @unique(map: "sqlite_autoindex_Websites_5")
  SecurityID_UK_FK                                           String?        @unique(map: "sqlite_autoindex_Websites_6")
  Position                                                   Int?
  TypeNumber                                                 Int?
  Favorite                                                   Int?
  Name                                                       String?
  ShortName                                                  String?
  Info                                                       String?
  ColorString                                                String?
  AlternateColorString                                       String?
  TintColorString                                            String?
  AlternateTintColorString                                   String?
  ImageData                                                  Bytes?
  AlternateImageData                                         Bytes?
  URL                                                        String?
  AccountGroups_AccountGroupsToWebsites_AccountGroupID_UK_FK AccountGroups? @relation("AccountGroupsToWebsites_AccountGroupID_UK_FK", fields: [AccountGroupID_UK_FK], references: [AccountGroupID_PK], onDelete: Cascade)
  Accounts_AccountsToWebsites_AccountID_UK_FK                Accounts?      @relation("AccountsToWebsites_AccountID_UK_FK", fields: [AccountID_UK_FK], references: [AccountID_PK], onDelete: Cascade)
  Locations_LocationsToWebsites_LocationID_UK_FK             Locations?     @relation("LocationsToWebsites_LocationID_UK_FK", fields: [LocationID_UK_FK], references: [LocationID_PK], onDelete: Cascade)
  Payees_PayeesToWebsites_PayeeID_UK_FK                      Payees?        @relation("PayeesToWebsites_PayeeID_UK_FK", fields: [PayeeID_UK_FK], references: [PayeeID_PK], onDelete: Cascade)
  Securities_SecuritiesToWebsites_SecurityID_UK_FK           Securities?    @relation("SecuritiesToWebsites_SecurityID_UK_FK", fields: [SecurityID_UK_FK], references: [SecurityID_PK], onDelete: Cascade)
  AccountGroups_AccountGroups_WebsiteID_UK_FKToWebsites      AccountGroups? @relation("AccountGroups_WebsiteID_UK_FKToWebsites")
  Accounts_Accounts_WebsiteID_UK_FKToWebsites                Accounts?      @relation("Accounts_WebsiteID_UK_FKToWebsites")
  Locations_Locations_WebsiteID_UK_FKToWebsites              Locations?     @relation("Locations_WebsiteID_UK_FKToWebsites")
  Payees_Payees_WebsiteID_UK_FKToWebsites                    Payees?        @relation("Payees_WebsiteID_UK_FKToWebsites")
  Securities_Securities_WebsiteID_UK_FKToWebsites            Securities?    @relation("Securities_WebsiteID_UK_FKToWebsites")
}

model fundCategories {
  SecurityFundCategoryID_PK                  String                                       @id
  Position                                   Int?
  TypeNumber                                 Int?
  IncludeInLists                             Int?
  IncludeInReports                           Int?
  Favorite                                   Int?
  Name                                       String?
  ShortName                                  String?
  Info                                       String?
  ColorString                                String?
  AlternateColorString                       String?
  TintColorString                            String?
  AlternateTintColorString                   String?
  ImageData                                  Bytes?
  AlternateImageData                         Bytes?
  Attachments                                Attachments[]
  InvestmentPortfoliosSecurityFundCategories InvestmentPortfoliosSecurityFundCategories[]
  Notes                                      Notes[]
  ReportForecastDetails                      ReportForecastDetails[]
  ReportGoalDetails                          ReportGoalDetails[]
  ReportsSecurityFundCategories              ReportsSecurityFundCategories[]
  Securities                                 Securities[]
}
<svg id="mermaid-0" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="55" style="max-width: 324.328125px;" viewBox="0 0 324.328125 55"><style>#mermaid-0 {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#000000;}#mermaid-0 .error-icon{fill:#552222;}#mermaid-0 .error-text{fill:#552222;stroke:#552222;}#mermaid-0 .edge-thickness-normal{stroke-width:2px;}#mermaid-0 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-0 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-0 .marker{fill:#000000;stroke:#000000;}#mermaid-0 .marker.cross{stroke:#000000;}#mermaid-0 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-0 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#000000;}#mermaid-0 .cluster-label text{fill:#333;}#mermaid-0 .cluster-label span{color:#333;}#mermaid-0 .label text,#mermaid-0 span{fill:#000000;color:#000000;}#mermaid-0 .node rect,#mermaid-0 .node circle,#mermaid-0 .node ellipse,#mermaid-0 .node polygon,#mermaid-0 .node path{fill:#cde498;stroke:#13540c;stroke-width:1px;}#mermaid-0 .node .label{text-align:center;}#mermaid-0 .node.clickable{cursor:pointer;}#mermaid-0 .arrowheadPath{fill:green;}#mermaid-0 .edgePath .path{stroke:#000000;stroke-width:2.0px;}#mermaid-0 .flowchart-link{stroke:#000000;fill:none;}#mermaid-0 .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-0 .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-0 .cluster rect{fill:#cdffb2;stroke:#6eaa49;stroke-width:1px;}#mermaid-0 .cluster text{fill:#333;}#mermaid-0 .cluster span{color:#333;}#mermaid-0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(78.1578947368, 58.4615384615%, 84.5098039216%);border:1px solid #6eaa49;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-0 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}</style><g><g class="output"><g class="clusters"></g><g class="edgePaths"></g><g class="edgeLabels"></g><g class="nodes"><g class="node default" id="flowchart-a-2" transform="translate(162.1640625,27.5)" style="opacity: 1;"><rect rx="0" ry="0" x="-154.1640625" y="-19.5" width="308.328125" height="39" class="label-container" style="fill:#faa;"></rect><g class="label" transform="translate(0,0)"><g transform="translate(-144.1640625,-9.5)"><foreignObject width="288.328125" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;">Maximum text size in diagram exceeded</div></foreignObject></g></g></g></g></g></g></svg>

Seems this is configurable: https://stackoverflow.com/a/63168255

keonik commented 2 years ago

@janpio I tried to write a test with your schema and it was throwing unrelated issues when it came to parsing the data model into a string before getting to mermaid cli. If the prisma-erd-generator@next version fixes your issues let me know.

janpio commented 2 years ago

With prisma-erd-generator@next I can indeed generate an ERD. Has a lot of unnecessary whitespace around it, but there is a graph.

keonik commented 2 years ago

@janpio included in v0.8.1.

keonik commented 2 years ago

@all-contributors please add @janpio for finding a bug

allcontributors[bot] commented 2 years ago

@keonik

I've put up a pull request to add @janpio! :tada:

fullstackzach commented 1 year ago

I still get this error on "prisma-erd-generator": "^1.11.0" and "@mermaid-js/mermaid-cli": "^10.3.1",. I looked at #50 and saw that the size was hard-coded

Is there a way to override this and increase it even more with a mermaid config?

EDIT: I used tableOnly to see if I could get an erd to generate. I was able to generate one, but it is so large its not usable when browsing the svg in chrome.

We have multiple schemas in Prisma. I think what I really need is a way to only generate an ERD for a particular schema, then generate multiple erd diagrams so they can be viewed separately

keonik commented 1 year ago

Is the problem the size of the SVG?

keonik commented 1 year ago

if its just text size you can configure it in the mermaid config

/** @type {import('mermaid').MermaidConfig} */
const config = {
    deterministicIds: true,
    maxTextSize: 90000,
    er: {
        /**
         * When this flag is set to `true`, the height and width is set to 100%
         * and is then scaled with the available space.
         * If set to `false`, the absolute space required is used.
         *
         */
        useMaxWidth: true,
    },
    theme: process.env.THEME,
};

module.exports = config;

In the example above you could also play around with the useMaxWidth flag and use that to play with width/height if its more a scale issue