Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

54 lines
2.4 KiB
Markdown

# Citus Migrations
These migrations are specifically for Citus (distributed PostgreSQL) environments.
## When to Run These Migrations
- **Production**: YES - Run together with base migrations in chronological order
- **Automated Testing (Argo)**: YES - Run together with base migrations in chronological order
- **Local Development**: NO - Skip these unless testing Citus specifically
- **Open Source**: NO - These are EE-only features
## Important: Migration Execution
These migrations use timestamp-based naming (same as main migrations) to ensure proper ordering.
When running in production or test environments:
```bash
# Copy all migrations to a single directory and run in chronological order
cp server/migrations/*.cjs temp_migrations/
cp ee/server/migrations/citus/*.cjs temp_migrations/
# Run migrations from temp_migrations/ in timestamp order
```
## Migration Files
1. `20250805000000_enable_citus_extension.cjs` - Enable Citus extension
2. `20250805000001_create_reference_tables.cjs` - Create reference tables (replicated to all nodes)
3. `20250805000002_distribute_tenant_and_user_tables.cjs` - Distribute foundational tenant/user tables
4. `20250805000003_distribute_company_tables.cjs` - Distribute company-related tables
5. `20250805000004_distribute_billing_and_service_tables.cjs` - Distribute billing and service catalog
6. `20250805000005_distribute_ticket_and_activity_tables.cjs` - Distribute tickets, projects, time tracking
7. `20250805000006_distribute_remaining_tables.cjs` - Distribute remaining tables (invoices, assets, workflows, etc.)
## Features
- **Idempotent**: Each migration checks if tables are already distributed before attempting distribution
- **Safe for partial deployments**: Works with environments that are partially distributed
- **Proper dependency ordering**: Tables are distributed in order of their foreign key dependencies
## Colocation Groups
- **Group 41**: Main distributed tables (tenant-partitioned) - default colocation
- **Group 48**: Reference tables (replicated across all workers)
## Distribution Keys
- Most tables use `tenant` as the distribution column
- Some email-related tables use `tenant_id` as the distribution column
- All distributed tables are colocated with the `tenants` table for efficient JOINs
## Rollback
Each migration includes a `down` function to undistribute tables if needed.
Note: Undistributing tables with large amounts of data can be slow and resource-intensive.