Pular para o conteúdo principal

Database Overview

Ever Gauzy supports multiple databases and ORMs, providing flexibility for different deployment scenarios.

Supported Databases

DatabaseProductionDevelopmentDefault
PostgreSQL✅ Recommended
MySQL / MariaDB
SQLite⚠️ Demo only
better-sqlite3⚠️ Demo only

Supported ORMs

ORMRoleConfiguration
TypeORMPrimary ORMDB_ORM=typeorm
MikroORMAlternative ORMDB_ORM=mikro-orm
KnexQuery builderAlways available

Database Configuration

Core Environment Variables

# Database type
DB_TYPE=postgres # postgres | mysql | sqlite | better-sqlite3

# ORM selection
DB_ORM=typeorm # typeorm | mikro-orm

# Connection settings
DB_HOST=localhost
DB_PORT=5432
DB_NAME=gauzy
DB_USER=postgres
DB_PASS=your-password
DB_SSL_MODE=false

# Connection pool
DB_POOL_SIZE=40
DB_CONNECTION_TIMEOUT=5000
DB_IDLE_TIMEOUT=10000

# Logging
DB_LOGGING=false # true | false | query | error | schema

SQLite Configuration

For development with SQLite:

DB_TYPE=sqlite
DB_NAME=gauzy.sqlite3

SQLite requires no host, port, user, or password settings.

PostgreSQL Configuration

DB_TYPE=postgres
DB_HOST=localhost
DB_PORT=5432
DB_NAME=gauzy
DB_USER=postgres
DB_PASS=root
DB_SSL_MODE=false

MySQL Configuration

DB_TYPE=mysql
DB_HOST=localhost
DB_PORT=3306
DB_NAME=gauzy
DB_USER=root
DB_PASS=root

Database Schema

The platform has approximately 200+ database tables organized into domains:

Core Tables

TableEntityDescription
tenantTenantMulti-tenant root
userUserUser accounts
roleRoleRole definitions
role_permissionRolePermissionRole-permission mappings
organizationOrganizationOrganizations within tenants

HRM Tables

TableEntityDescription
employeeEmployeeEmployee profiles
time_logTimeLogTime tracking entries
timesheetTimesheetWeekly/monthly timesheets
time_slotTimeSlot10-minute activity slots
screenshotScreenshotActivity screenshots
activityActivityApp/URL activity tracking
time_off_requestTimeOffRequestLeave requests
time_off_policyTimeOffPolicyLeave policies

PM Tables

TableEntityDescription
organization_projectOrganizationProjectProjects
taskTaskTask management
task_statusTaskStatusCustom task statuses
task_priorityTaskPriorityCustom priorities
organization_sprintOrganizationSprintSprint management
organization_project_moduleProjectModuleProject modules

ERP Tables

TableEntityDescription
invoiceInvoiceInvoices and estimates
invoice_itemInvoiceItemInvoice line items
expenseExpenseExpense records
paymentPaymentPayment records
incomeIncomeIncome records

CRM / ATS Tables

TableEntityDescription
organization_contactOrganizationContactContacts/leads
pipelinePipelineSales pipelines
pipeline_stagePipelineStagePipeline stages
candidateCandidateJob candidates
candidate_interviewCandidateInterviewInterview schedule

Integration Tables

TableEntityDescription
integrationIntegrationActive integrations
integration_typeIntegrationTypeAvailable integration types
integration_settingIntegrationSettingIntegration configs
integration_entity_settingIntegrationEntitySettingEntity sync settings

Entity Relationships

Tenant ──┬── Organization ──┬── Employee ──── TimeLog
│ ├── Project ──── Task
│ ├── Contact
│ ├── Invoice
│ └── Expense

├── User ──── Role ──── RolePermission

└── Integration

Database Initialization

Auto-Migration

TypeORM can automatically synchronize the schema:

DB_SYNCHRONIZE=true     # ⚠️ Development only - drops/recreates tables
warning

Never enable DB_SYNCHRONIZE=true in production. Use migrations instead.

Seeding

The platform includes seed data for demo/development:

yarn seed:all           # Seed all demo data
yarn seed:module:all # Seed module-specific data

See Database Seeding for details.