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
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
/**
|
|
* Make schedule_entries.scheduled_start / scheduled_end optional for ad-hoc entries.
|
|
*
|
|
* Ad-hoc entries behave like personal to-dos and may have no scheduled time.
|
|
* A CHECK constraint still requires times for every other work_item_type so
|
|
* real calendar entries can't be created without a time.
|
|
*
|
|
* schedule_entries is a Citus-distributed table; ALTER COLUMN / ADD CONSTRAINT
|
|
* propagate to all shards automatically.
|
|
*
|
|
* @param { import("knex").Knex } knex
|
|
*/
|
|
exports.up = async function (knex) {
|
|
await knex.raw(`ALTER TABLE schedule_entries ALTER COLUMN scheduled_start DROP NOT NULL;`);
|
|
await knex.raw(`ALTER TABLE schedule_entries ALTER COLUMN scheduled_end DROP NOT NULL;`);
|
|
|
|
await knex.raw(`ALTER TABLE schedule_entries DROP CONSTRAINT IF EXISTS schedule_entries_times_required_check;`);
|
|
await knex.raw(`
|
|
ALTER TABLE schedule_entries
|
|
ADD CONSTRAINT schedule_entries_times_required_check
|
|
CHECK (
|
|
work_item_type = 'ad_hoc'
|
|
OR (scheduled_start IS NOT NULL AND scheduled_end IS NOT NULL)
|
|
);
|
|
`);
|
|
};
|
|
|
|
/**
|
|
* @param { import("knex").Knex } knex
|
|
*/
|
|
exports.down = async function (knex) {
|
|
await knex.raw(`ALTER TABLE schedule_entries DROP CONSTRAINT IF EXISTS schedule_entries_times_required_check;`);
|
|
|
|
// Backfill any null times before restoring NOT NULL (e.g. time-less ad-hoc entries).
|
|
await knex('schedule_entries').whereNull('scheduled_start').update({ scheduled_start: knex.fn.now() });
|
|
await knex('schedule_entries').whereNull('scheduled_end').update({ scheduled_end: knex.fn.now() });
|
|
|
|
await knex.raw(`ALTER TABLE schedule_entries ALTER COLUMN scheduled_start SET NOT NULL;`);
|
|
await knex.raw(`ALTER TABLE schedule_entries ALTER COLUMN scheduled_end SET NOT NULL;`);
|
|
};
|