PSA/server/migrations/20250307201231_create_workflow_form_registry.cjs
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

48 lines
1.9 KiB
JavaScript

/**
* Migration to create workflow form registry tables
*/
exports.up = async function(knex) {
// Create workflow_form_definitions table
await knex.schema.createTable('workflow_form_definitions', (table) => {
table.string('form_id').primary();
table.string('tenant').notNullable();
table.string('name').notNullable();
table.text('description');
table.string('version', 50).notNullable();
table.string('status', 50).notNullable().defaultTo('active');
table.string('category', 100);
table.string('created_by');
table.timestamp('created_at').notNullable().defaultTo(knex.fn.now());
table.timestamp('updated_at').notNullable().defaultTo(knex.fn.now());
// Add unique constraint for tenant, form_id, and version
table.unique(['tenant', 'form_id', 'version']);
});
// Create workflow_form_schemas table
await knex.schema.createTable('workflow_form_schemas', (table) => {
table.string('schema_id').primary();
table.string('form_id').notNullable();
table.string('tenant').notNullable();
table.jsonb('json_schema').notNullable();
table.jsonb('ui_schema');
table.jsonb('default_values');
table.timestamp('created_at').notNullable().defaultTo(knex.fn.now());
table.timestamp('updated_at').notNullable().defaultTo(knex.fn.now());
// Add foreign key constraint
table.foreign('form_id').references('form_id').inTable('workflow_form_definitions').onDelete('CASCADE');
// Add unique constraint for tenant and form_id
table.unique(['tenant', 'form_id']);
});
// Add workflow_form to the list of tagged entity types if needed
// This is handled in the code by updating the TaggedEntityType type
};
exports.down = async function(knex) {
// Drop tables in reverse order to handle foreign key constraints
await knex.schema.dropTableIfExists('workflow_form_schemas');
await knex.schema.dropTableIfExists('workflow_form_definitions');
};