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
54 lines
1.9 KiB
JavaScript
54 lines
1.9 KiB
JavaScript
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
exports.up = async function up(knex) {
|
|
await knex.schema.createTable('mobile_auth_otts', (table) => {
|
|
table.uuid('mobile_auth_ott_id').primary().defaultTo(knex.raw('gen_random_uuid()'));
|
|
table.uuid('tenant').notNullable();
|
|
table.uuid('user_id').notNullable();
|
|
table.uuid('session_id').nullable();
|
|
table.text('ott_hash').notNullable().unique();
|
|
table.text('state').notNullable();
|
|
table.timestamp('created_at').notNullable().defaultTo(knex.fn.now());
|
|
table.timestamp('expires_at').notNullable();
|
|
table.timestamp('used_at').nullable();
|
|
table.text('device_id').nullable();
|
|
table.jsonb('metadata').nullable();
|
|
|
|
table.index(['tenant', 'user_id']);
|
|
table.index(['expires_at']);
|
|
table.index(['used_at']);
|
|
});
|
|
|
|
await knex.schema.createTable('mobile_refresh_tokens', (table) => {
|
|
table.uuid('mobile_refresh_token_id').primary().defaultTo(knex.raw('gen_random_uuid()'));
|
|
table.uuid('tenant').notNullable();
|
|
table.uuid('user_id').notNullable();
|
|
table.uuid('api_key_id').nullable();
|
|
table.text('token_hash').notNullable().unique();
|
|
table.timestamp('created_at').notNullable().defaultTo(knex.fn.now());
|
|
table.timestamp('expires_at').notNullable();
|
|
table.timestamp('revoked_at').nullable();
|
|
table.uuid('replaced_by_id').nullable();
|
|
table.timestamp('last_used_at').nullable();
|
|
table.text('device_id').nullable();
|
|
table.jsonb('device').nullable();
|
|
|
|
table.foreign('replaced_by_id').references('mobile_refresh_token_id').inTable('mobile_refresh_tokens');
|
|
table.index(['tenant', 'user_id']);
|
|
table.index(['expires_at']);
|
|
table.index(['revoked_at']);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
exports.down = async function down(knex) {
|
|
await knex.schema.dropTableIfExists('mobile_refresh_tokens');
|
|
await knex.schema.dropTableIfExists('mobile_auth_otts');
|
|
};
|
|
|