Data Model
Source: equa-server/modules/persistence/src/schema.ts (lines 1-2101)
Entity count: 92 entities (90 tables + 2 view entities)
Database: PostgreSQL
Domain Partitioning
Source: Confluence KnowledgeBase — Entity Domain Partitioning (by Christopher Johnson)There are two main entity types: Individuals and Organizations. Intrinsic data is partitioned across domains:
| Domain | Applies To | Purpose | Sample Data |
|---|---|---|---|
| Profile | Individuals + Organizations | Identity and appearance in relation to other entities | Full name, contact info, avatar, government registration |
| Account | Individuals + Organizations | Business relationship between entity and Equa | Billing info, Equa Cash balance, paid feature config |
| Site Access | Individuals only | Authentication, authorization, usage tracking | Username, email, password, enabled/disabled status |
- Organizations: All intrinsic data stored in the
organizationstable (the deprecatedorganization_detailstable previously stored profile data) - Individuals:
userstable (access data),profilestable (profile data, may be renamed touser_profiles), and a planneduser_accountstable for account data
organization foreign keys on business entities. Cross-domain references use standard TypeORM @ManyToOne / @OneToMany relations.
Entity Summary by Domain
Users and Authentication (10 entities)
| Entity | Table | Key Fields |
|---|---|---|
Users | users | id (uuid), email (citext, unique), username, passwordHash, twoFactorSecret, enabled, twoFactorEnabled, emailVerified, acceptedTerms |
Sessions | sessions | id, expires (indexed), user (uuid, indexed), json (text) |
Profiles | profiles | id (uuid), fullName, email, dateOfBirth, phone, website, links (jsonb) |
UserAccounts | user_accounts | id (uuid), pin |
UserStates | user_states | user (uuid), data (jsonb) |
TempPasswords | temp_passwords | user (uuid), passwordHash |
EmailVerifications | email_verifications | user (uuid), code |
Onetimecodes | onetimecodes | user (uuid), code, available |
RegistrationMetadata | registration_metadata | user (uuid), value (jsonb) |
GlobalRolesUsers | global_roles_users | user (uuid), role (GlobalRole int) |
Organizations (7 entities)
| Entity | Table | Key Fields |
|---|---|---|
Organizations | organizations | id (uuid), name, operatingAgreement (Hash), companyType, equityStructure, creator, website, ein |
OrganizationDetailsTable | organization_details | name, companyType, businessAddress, phoneNumber, registrationNumber, startDate |
OrganizationTemplates | organization_templates | organization (uuid), type, content (Hash) |
Members | members | id, fullName, email, organization (uuid), user (uuid), isIndividual, title |
MemberLimits | member_limits | organization, memberLimit |
CompaniesInfo | companies_info | id, email, name, phoneNumber, organizationType, user (unique) |
Addresses | addresses | id, owner (uuid), street1, city, country, postalCode |
Cap Table and Securities (14 entities)
| Entity | Table | Key Fields |
|---|---|---|
Shareholdings | shareholdings | member (uuid), organization (uuid), shares (numeric), securityType (Hash), issueDate, serialNumber, shareholderName |
SecurityTypes | security_types | organization (uuid), shareClass, shareType, certifiedShares, votingShares, price, name |
SecurityDetails | security_details | shareClass, shareType, certifiedShares, fractionalShares, votingShares, sharePricing |
SecurityTypeSeniorityTable | security_type_seniority | securityType (Hash), seniority |
SecurityTypeSharesTable | security_type_shares | securityType (Hash), shares (numeric), boardApprovalDocument |
SharePricingTable | share_pricing_table | pricePerShare, parValue, originalIssuePrice, conversionPrice, conversionRate |
Holdings | holdings | entity (uuid), owner, value (numeric), holdingType, name, issueDate, pricePerUnit |
CapitalChanges | capital_changes | mod (numeric), timestamp, type (uuid), organization (uuid) |
FundingRounds | funding_rounds | id (uuid), organization, number, endDate, totalCommon, totalPreferred, name |
Valuations | valuations | entity, issueDate, value (numeric), units |
Signatures | signatures | id (uuid), shareholding (uuid), signatory (uuid), name, title |
Transfers | transfers | inputs (Hash), outputs (Hash) |
TransferOutputs | transfer_outputs | holding (Hash), owner (uuid), value (numeric) |
Legends | legends | content |
ESOP and Vesting (7 entities)
| Entity | Table | Key Fields |
|---|---|---|
Plans | plans | hash (Hash), organization (uuid), name, boardApprovalDate, termYears, approvedEquities (jsonb) |
PlansSecurities | plans_securities | plan (Hash), security (Hash) |
PlansVestingSchedules | plans_vesting_schedules | plan (Hash), vestingSchedule (Hash) |
Pools | pools | organization (uuid), security (Hash), shares (numeric), pricePerShare, vestingSchedule, name |
Options | options | organization (uuid), security (Hash), member (uuid), shares (numeric), startDate, vestingSchedule |
ContinuousVestingSchedules | continuous_vesting_schedules | durationMonths, frequencyMonths, cliffMonths, cliffAmount |
DiscreteVestingSchedules | discrete_vesting_schedules | events (Hash), entity (uuid), name |
Convertible Instruments (4 entities)
| Entity | Table | Key Fields |
|---|---|---|
ConvertibleInstruments | convertible_instruments | authorizedRaiseAmount, instrumentType, interestRate, maturityDate, valuationMax, conversionDiscount |
InstrumentConversions | instrument_conversions | convertibleInstrument (Hash), shares, valuation |
NoteConversions | note_conversions | conversion, source, destination, sharesOwed, value |
Repayments | repayments | convertibleInstrument (Hash), issueDate |
Agreements and Documents (5 entities)
| Entity | Table | Key Fields |
|---|---|---|
OperatingAgreements | operating_agreements | organization (uuid), timestamp, organizationDetails, plans, shareholdings |
OperatingAgreementsShareholdings | operating_agreements_shareholdings | operatingAgreement (Hash), shareholding (Hash) |
Authorizations | authorizations | organization (uuid), target, authorizationDate, document, note |
LegendMetas | legends_meta | legend (Hash), organization (uuid), name, author (uuid) |
RegisteredAgents | registered_agents | id (uuid), name, address, type (AgentType) |
Files and Data Room (4 entities)
| Entity | Table | Key Fields |
|---|---|---|
Files | files | id (uuid), hash, filename, url, extension, contentType, size, owner (uuid) |
HashedFiles | hashed_files | hash (Hash), size |
DirectoryItems | directory_items | organization (uuid), parentPath, name, type, file (uuid), size |
DataRoomsMembers | data_rooms_members | dataRoomName, member (uuid), permission (uuid) |
Google Drive Integration (4 entities)
| Entity | Table | Key Fields |
|---|---|---|
GoogleDriveConnections | google_drive_connections | id (uuid), organization, accessToken, refreshToken, googleEmail, isActive |
GoogleDriveSyncConfigurations | google_drive_sync_configurations | id (uuid), organization, googleFolderId, targetDataRoomPath, syncEnabled |
GoogleDriveSyncHistory | google_drive_sync_history | id (uuid), organization, status, filesProcessed, filesAdded, filesUpdated |
GoogleDriveSyncedFiles | google_drive_synced_files | id (uuid), googleFileId, localFileId, dataRoomPath, syncStatus |
Roles and Permissions (5 entities)
| Entity | Table | Key Fields |
|---|---|---|
Roles | roles | id (uuid), name, description, owner (uuid), isShared |
Permissions | permissions | id (uuid), name |
PermissionsRoles | permissions_roles | permission (uuid), role (uuid) |
MembersRoles | members_roles | member (uuid), role (uuid) |
OrganizationsRoles | organizations_roles | organization (uuid), role (uuid) |
Referrals and Rewards (4 entities)
| Entity | Table | Key Fields |
|---|---|---|
Referrals | referrals | id, user (uuid), referralLink, equaCash (numeric), noOfReferrals, status |
Rewards | rewards | id, reward (number), type (RewardType), scratched, user (uuid), organization (uuid) |
Invitations | invitations | id, email (citext), user (uuid), organization (uuid), status (InviteStatus) |
UserCoupons | user_coupons | user (uuid), code |
Financial and Blockchain (5 entities)
| Entity | Table | Key Fields |
|---|---|---|
Transactions | transactions | from, to, value (numeric), currency, currencyType, fromType, toType |
BankAccounts | bank_accounts | id (uuid), accountNumber, registeredNumber, bankName |
TaxIds | tax_ids | organization (uuid), name, value |
WalletAddresses | wallet_addresses | address (Hash), entity (Hash), globalName, name |
UserRavenAddresses | user_raven_addresses | user (uuid), address (Hash) |
Activity and Audit (3 entities)
| Entity | Table | Key Fields |
|---|---|---|
Actions | actions | organization (uuid), type (uuid), user (uuid) |
EventLogs | event_logs | id (uuid), type, user (uuid), organization (uuid), data (json) |
Tasks | tasks | entity (uuid), type (TaskType), status (TaskStatus) |
Other (8 entities)
| Entity | Table | Key Fields |
|---|---|---|
Colors | colors | user (uuid), target, value |
Waitlists | wait_lists | id, user (uuid), position |
DomainBlacklists | domain_blacklists | id (uuid), domain |
EmailBlacklists | email_blacklists | id (uuid), email (citext) |
DeletedRecords | deleted_records | key |
ImportRows | import_rows | id (uuid), member, organization, holding, file |
VestingEvents | vesting_events | day, month, year, value (numeric) |
TasksExerciseOption | tasks_exercise_option | id (uuid), option (Hash), shares (numeric) |
View Entities (2)
| Entity | Table | Expression |
|---|---|---|
Groups | View on roles | SELECT * FROM roles |
OperatingAgreementsTransactions | View | Recursive CTE joining operating_agreements and hash_lists |
Entities in allEntities Not Yet Documented Above
The following 10 entities exist in schema.ts allEntities array but are not categorized in the domain tables above:
| Entity | Base Class | Purpose |
|---|---|---|
Blocks | HashedTable | Blockchain/hash block tracking |
Branches | CreatedModifiedDeleted | Entity branch/version tracking |
Changes | HashedTable | Change/diff tracking |
DividendConfigs | HashedTable | Dividend configuration |
EntitiesGroups | CreatedModifiedDeleted | Entity-to-group associations |
EntityAddresses | CreatedModifiedDeleted | Entity physical addresses |
EntityEmails | CreatedModifiedDeleted | Entity email addresses |
HashedAddresses | HashedTable | Hashed address records |
HashLists | Created | Ordered hash list entries |
SerialHashedTable | HashedTable | Abstract base class for serial-keyed hashed tables |
Base Classes
All entities extend one of these base classes which provide common fields:| Base Class | Fields Provided |
|---|---|
HashedTable | hash (Hash, primary key) |
Created | created (timestamp) |
CreatedModified | created, modified (timestamps) |
CreatedModifiedDeleted | created, modified, deleted (timestamps) |
Indexes
| Entity | Column | Type |
|---|---|---|
Sessions | expires | Index |
Sessions | user | Index |
Unique Constraints
| Entity | Column |
|---|---|
Users | email |
CompaniesInfo | user |