@dbos-inc/dbos-sdk 3.4.4-preview → 3.4.7-preview

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/src/client.d.ts.map +1 -1
  2. package/dist/src/client.js +2 -3
  3. package/dist/src/client.js.map +1 -1
  4. package/dist/src/conductor/conductor.js +15 -15
  5. package/dist/src/conductor/conductor.js.map +1 -1
  6. package/dist/src/database_utils.d.ts +99 -0
  7. package/dist/src/database_utils.d.ts.map +1 -0
  8. package/dist/src/database_utils.js +428 -0
  9. package/dist/src/database_utils.js.map +1 -0
  10. package/dist/src/datasource.d.ts +1 -1
  11. package/dist/src/datasource.d.ts.map +1 -1
  12. package/dist/src/datasource.js +10 -1
  13. package/dist/src/datasource.js.map +1 -1
  14. package/dist/src/dbos-executor.d.ts.map +1 -1
  15. package/dist/src/dbos-executor.js +15 -4
  16. package/dist/src/dbos-executor.js.map +1 -1
  17. package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
  18. package/dist/src/dbos-runtime/cli.js +128 -95
  19. package/dist/src/dbos-runtime/cli.js.map +1 -1
  20. package/dist/src/dbos-runtime/commands.d.ts +1 -1
  21. package/dist/src/dbos-runtime/commands.d.ts.map +1 -1
  22. package/dist/src/dbos-runtime/commands.js +1 -2
  23. package/dist/src/dbos-runtime/commands.js.map +1 -1
  24. package/dist/src/dbos-runtime/config.d.ts +5 -2
  25. package/dist/src/dbos-runtime/config.d.ts.map +1 -1
  26. package/dist/src/dbos-runtime/config.js +48 -25
  27. package/dist/src/dbos-runtime/config.js.map +1 -1
  28. package/dist/src/dbos-runtime/migrate.d.ts +1 -2
  29. package/dist/src/dbos-runtime/migrate.d.ts.map +1 -1
  30. package/dist/src/dbos-runtime/migrate.js +28 -99
  31. package/dist/src/dbos-runtime/migrate.js.map +1 -1
  32. package/dist/src/index.d.ts +1 -1
  33. package/dist/src/index.d.ts.map +1 -1
  34. package/dist/src/index.js +3 -2
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/sysdb_migrations/internal/migrations.d.ts +3 -0
  37. package/dist/src/sysdb_migrations/internal/migrations.d.ts.map +1 -0
  38. package/dist/src/sysdb_migrations/internal/migrations.js +174 -0
  39. package/dist/src/sysdb_migrations/internal/migrations.js.map +1 -0
  40. package/dist/src/sysdb_migrations/migration_runner.d.ts +27 -0
  41. package/dist/src/sysdb_migrations/migration_runner.d.ts.map +1 -0
  42. package/dist/src/sysdb_migrations/migration_runner.js +117 -0
  43. package/dist/src/sysdb_migrations/migration_runner.js.map +1 -0
  44. package/dist/src/system_database.d.ts +4 -4
  45. package/dist/src/system_database.d.ts.map +1 -1
  46. package/dist/src/system_database.js +71 -73
  47. package/dist/src/system_database.js.map +1 -1
  48. package/dist/src/user_database.d.ts +1 -2
  49. package/dist/src/user_database.d.ts.map +1 -1
  50. package/dist/src/user_database.js +23 -33
  51. package/dist/src/user_database.js.map +1 -1
  52. package/dist/src/utils.d.ts +1 -3
  53. package/dist/src/utils.d.ts.map +1 -1
  54. package/dist/src/utils.js +1 -5
  55. package/dist/src/utils.js.map +1 -1
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +4 -2
  58. package/dist/src/dbos-runtime/reset.d.ts +0 -4
  59. package/dist/src/dbos-runtime/reset.d.ts.map +0 -1
  60. package/dist/src/dbos-runtime/reset.js +0 -26
  61. package/dist/src/dbos-runtime/reset.js.map +0 -1
  62. package/migrations/20240123182943_schema.js +0 -7
  63. package/migrations/20240123183021_tables.js +0 -52
  64. package/migrations/20240123183025_indexes.js +0 -11
  65. package/migrations/20240123183030_triggers.js +0 -38
  66. package/migrations/20240124015239_status_timestamp.js +0 -16
  67. package/migrations/20240201213211_replica_identity.js +0 -12
  68. package/migrations/20240205223925_foreign_keys.js +0 -67
  69. package/migrations/20240207192338_executor_id_index.js +0 -19
  70. package/migrations/20240430090000_tables.js +0 -11
  71. package/migrations/20240516004341_application_version.js +0 -21
  72. package/migrations/20240517000000_status_class_config.js +0 -14
  73. package/migrations/20240621000000_workflow_tries.js +0 -11
  74. package/migrations/20240924000000_workflowqueue.js +0 -33
  75. package/migrations/20241009150000_event_dispatch_kv.js +0 -15
  76. package/migrations/20250312171547_function_name_op_outputs.js +0 -22
  77. package/migrations/20250319190617_add_childid_opoutputs.js +0 -22
  78. package/migrations/20252101000000_workflow_queues_executor_id.js +0 -27
  79. package/migrations/20252501190959_queue_dedup_id.js +0 -21
  80. package/migrations/20252505000000_workflow_timeout.js +0 -24
  81. package/migrations/20252512000000_queue_priority.js +0 -22
  82. package/migrations/20252523000000_consolidate_inputs.js +0 -22
  83. package/migrations/20252528000000_consolidate_queues.js +0 -30
  84. package/migrations/20252806000000_streaming.js +0 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbos-inc/dbos-sdk",
3
- "version": "3.4.4-preview",
3
+ "version": "3.4.7-preview",
4
4
  "description": "A Typescript framework built on the database",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,6 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@eslint/js": "^9.22.0",
41
41
  "@prisma/client": "^5.3.1",
42
+ "@testcontainers/postgresql": "^11.5.1",
42
43
  "@types/koa": "^2.15.0",
43
44
  "@types/koa__cors": "^5.0.0",
44
45
  "@types/koa__router": "^12.0.4",
@@ -55,6 +56,7 @@
55
56
  "prettier": "^3.4.2",
56
57
  "prisma": "^5.1.1",
57
58
  "supertest": "^7.0.0",
59
+ "testcontainers": "^11.5.1",
58
60
  "ts-jest": "^29.2.4",
59
61
  "typeorm": "^0.3.17",
60
62
  "typescript": "^5.4.5",
@@ -77,7 +79,7 @@
77
79
  "ajv": "8.13.0",
78
80
  "commander": "12.0.0",
79
81
  "knex": "3.1.0",
80
- "koa": "^2.16.2",
82
+ "koa": "^2.15.4",
81
83
  "pg": "8.11.3",
82
84
  "pg-protocol": "^1.6.1",
83
85
  "reflect-metadata": "^0.2.2",
@@ -1,4 +0,0 @@
1
- import { GlobalLogger } from '../telemetry/logs';
2
- import { ConfigFile } from './config';
3
- export declare function reset(config: ConfigFile, logger: GlobalLogger, cnf: boolean): Promise<number>;
4
- //# sourceMappingURL=reset.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/reset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAwB,MAAM,UAAU,CAAC;AAE5D,wBAAsB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,mBAoBjF"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reset = void 0;
4
- const prompts_1 = require("@inquirer/prompts");
5
- const system_database_1 = require("../system_database");
6
- const config_1 = require("./config");
7
- async function reset(config, logger, cnf) {
8
- if (cnf) {
9
- const userConfirmed = await (0, prompts_1.confirm)({
10
- message: 'This command resets your DBOS system database, deleting metadata about past workflows and steps. Are you sure you want to proceed?',
11
- default: false, // Default value for confirmation
12
- });
13
- if (!userConfirmed) {
14
- console.log('Operation cancelled.');
15
- process.exit(0); // Exit the process if the user cancels
16
- }
17
- }
18
- const sysDbUrl = (0, config_1.getSystemDatabaseUrl)(config);
19
- const url = new URL(sysDbUrl);
20
- const sysDbName = url.pathname.slice(1);
21
- logger.info(`Resetting ${sysDbName} if it exists`);
22
- await system_database_1.PostgresSystemDatabase.dropSystemDB(sysDbUrl);
23
- return 0;
24
- }
25
- exports.reset = reset;
26
- //# sourceMappingURL=reset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/dbos-runtime/reset.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAC5C,wDAA4D;AAC5D,qCAA4D;AAErD,KAAK,UAAU,KAAK,CAAC,MAAkB,EAAE,MAAoB,EAAE,GAAY;IAChF,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,aAAa,GAAG,MAAM,IAAA,iBAAO,EAAC;YAClC,OAAO,EACL,oIAAoI;YACtI,OAAO,EAAE,KAAK,EAAE,iCAAiC;SAClD,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,uCAAuC;QAC1D,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,6BAAoB,EAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,IAAI,CAAC,aAAa,SAAS,eAAe,CAAC,CAAC;IACnD,MAAM,wCAAsB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC;AACX,CAAC;AApBD,sBAoBC"}
@@ -1,7 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.raw('CREATE SCHEMA IF NOT EXISTS dbos');
3
- };
4
-
5
- exports.down = function (knex) {
6
- return knex.raw('DROP SCHEMA IF EXISTS dbos');
7
- };
@@ -1,52 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema
3
- .withSchema('dbos')
4
- .createTable('operation_outputs', function (table) {
5
- table.text('workflow_uuid').notNullable();
6
- table.integer('function_id').notNullable();
7
- table.text('output');
8
- table.text('error');
9
- table.primary(['workflow_uuid', 'function_id']);
10
- })
11
- .createTable('workflow_inputs', function (table) {
12
- table.text('workflow_uuid').primary().notNullable();
13
- table.text('inputs').notNullable();
14
- })
15
- .createTable('workflow_status', function (table) {
16
- table.text('workflow_uuid').primary();
17
- table.text('status');
18
- table.text('name');
19
- table.text('authenticated_user');
20
- table.text('assumed_role');
21
- table.text('authenticated_roles');
22
- table.text('request');
23
- table.text('output');
24
- table.text('error');
25
- table.text('executor_id');
26
- })
27
- .createTable('notifications', function (table) {
28
- table.text('destination_uuid').notNullable();
29
- table.text('topic');
30
- table.text('message').notNullable();
31
- table
32
- .bigInteger('created_at_epoch_ms')
33
- .notNullable()
34
- .defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
35
- })
36
- .createTable('workflow_events', function (table) {
37
- table.text('workflow_uuid').notNullable();
38
- table.text('key').notNullable();
39
- table.text('value').notNullable();
40
- table.primary(['workflow_uuid', 'key']);
41
- });
42
- };
43
-
44
- exports.down = function (knex) {
45
- return knex.schema
46
- .withSchema('dbos')
47
- .dropTableIfExists('operation_outputs')
48
- .dropTableIfExists('workflow_inputs')
49
- .dropTableIfExists('workflow_status')
50
- .dropTableIfExists('notifications')
51
- .dropTableIfExists('workflow_events');
52
- };
@@ -1,11 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema.withSchema('dbos').table('notifications', function (table) {
3
- table.index(['destination_uuid', 'topic'], 'idx_workflow_topic');
4
- });
5
- };
6
-
7
- exports.down = function (knex) {
8
- return knex.schema.withSchema('dbos').table('notifications', function (table) {
9
- table.dropIndex(['destination_uuid', 'topic'], 'idx_workflow_topic');
10
- });
11
- };
@@ -1,38 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.raw(`
3
- CREATE OR REPLACE FUNCTION dbos.notifications_function() RETURNS TRIGGER AS $$
4
- DECLARE
5
- payload text := NEW.destination_uuid || '::' || NEW.topic;
6
- BEGIN
7
- PERFORM pg_notify('dbos_notifications_channel', payload);
8
- RETURN NEW;
9
- END;
10
- $$ LANGUAGE plpgsql;
11
-
12
- CREATE TRIGGER dbos_notifications_trigger
13
- AFTER INSERT ON dbos.notifications
14
- FOR EACH ROW EXECUTE FUNCTION dbos.notifications_function();
15
-
16
- CREATE OR REPLACE FUNCTION dbos.workflow_events_function() RETURNS TRIGGER AS $$
17
- DECLARE
18
- payload text := NEW.workflow_uuid || '::' || NEW.key;
19
- BEGIN
20
- PERFORM pg_notify('dbos_workflow_events_channel', payload);
21
- RETURN NEW;
22
- END;
23
- $$ LANGUAGE plpgsql;
24
-
25
- CREATE TRIGGER dbos_workflow_events_trigger
26
- AFTER INSERT ON dbos.workflow_events
27
- FOR EACH ROW EXECUTE FUNCTION dbos.workflow_events_function();
28
- `);
29
- };
30
-
31
- exports.down = function (knex) {
32
- return knex.raw(`
33
- DROP TRIGGER IF EXISTS dbos_notifications_trigger ON dbos.notifications;
34
- DROP FUNCTION IF EXISTS dbos.notifications_function;
35
- DROP TRIGGER IF EXISTS dbos_workflow_events_trigger ON dbos.workflow_events;
36
- DROP FUNCTION IF EXISTS dbos.workflow_events_function;
37
- `);
38
- };
@@ -1,16 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
3
- // Add CREATED_AT column with default value as current epoch time in milliseconds
4
- table.bigInteger('created_at').notNullable().defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
5
-
6
- // Add UPDATED_AT column with default value as current epoch time in milliseconds
7
- table.bigInteger('updated_at').notNullable().defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
8
- });
9
- };
10
-
11
- exports.down = function (knex) {
12
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
13
- table.dropColumn('created_at');
14
- table.dropColumn('updated_at');
15
- });
16
- };
@@ -1,12 +0,0 @@
1
- exports.up = async function (knex) {
2
- await knex.raw('create extension if not exists "uuid-ossp"');
3
- return knex.schema.withSchema('dbos').table('notifications', function (table) {
4
- table.text('message_uuid').primary().defaultTo(knex.raw('uuid_generate_v4()'));
5
- });
6
- };
7
-
8
- exports.down = function (knex) {
9
- return knex.schema.withSchema('dbos').table('notifications', function (table) {
10
- table.dropColumn('message_uuid');
11
- });
12
- };
@@ -1,67 +0,0 @@
1
- /**
2
- * @param { import("knex").Knex } knex
3
- * @returns { Promise<void> }
4
- */
5
- exports.up = function (knex) {
6
- return knex.schema
7
- .withSchema('dbos')
8
- .alterTable('workflow_status', function (table) {
9
- table.index('created_at');
10
- })
11
- .alterTable('operation_outputs', function (table) {
12
- table
13
- .foreign('workflow_uuid')
14
- .references('workflow_uuid')
15
- .inTable('dbos.workflow_status')
16
- .onDelete('CASCADE')
17
- .onUpdate('CASCADE');
18
- })
19
- .alterTable('workflow_inputs', function (table) {
20
- table
21
- .foreign('workflow_uuid')
22
- .references('workflow_uuid')
23
- .inTable('dbos.workflow_status')
24
- .onDelete('CASCADE')
25
- .onUpdate('CASCADE');
26
- })
27
- .alterTable('notifications', function (table) {
28
- table
29
- .foreign('destination_uuid')
30
- .references('workflow_uuid')
31
- .inTable('dbos.workflow_status')
32
- .onDelete('CASCADE')
33
- .onUpdate('CASCADE');
34
- })
35
- .alterTable('workflow_events', function (table) {
36
- table
37
- .foreign('workflow_uuid')
38
- .references('workflow_uuid')
39
- .inTable('dbos.workflow_status')
40
- .onDelete('CASCADE')
41
- .onUpdate('CASCADE');
42
- });
43
- };
44
-
45
- /**
46
- * @param { import("knex").Knex } knex
47
- * @returns { Promise<void> }
48
- */
49
- exports.down = function (knex) {
50
- return knex.schema
51
- .withSchema('dbos')
52
- .alterTable('workflow_status', function (table) {
53
- table.dropIndex('created_at');
54
- })
55
- .alterTable('operation_outputs', function (table) {
56
- table.dropForeign('workflow_uuid');
57
- })
58
- .alterTable('workflow_inputs', function (table) {
59
- table.dropForeign('workflow_uuid');
60
- })
61
- .alterTable('notifications', function (table) {
62
- table.dropForeign('destination_uuid');
63
- })
64
- .alterTable('workflow_events', function (table) {
65
- table.dropForeign('workflow_uuid');
66
- });
67
- };
@@ -1,19 +0,0 @@
1
- /**
2
- * @param { import("knex").Knex } knex
3
- * @returns { Promise<void> }
4
- */
5
- exports.up = function (knex) {
6
- return knex.schema.withSchema('dbos').alterTable('workflow_status', function (table) {
7
- table.index('executor_id');
8
- });
9
- };
10
-
11
- /**
12
- * @param { import("knex").Knex } knex
13
- * @returns { Promise<void> }
14
- */
15
- exports.down = function (knex) {
16
- return knex.schema.withSchema('dbos').alterTable('workflow_status', function (table) {
17
- table.dropIndex('executor_id');
18
- });
19
- };
@@ -1,11 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema.withSchema('dbos').createTable('scheduler_state', function (table) {
3
- table.text('workflow_fn_name').notNullable();
4
- table.bigInteger('last_run_time').notNullable();
5
- table.primary(['workflow_fn_name']);
6
- });
7
- };
8
-
9
- exports.down = function (knex) {
10
- return knex.schema.withSchema('dbos').dropTableIfExists('scheduler_state');
11
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * @param { import("knex").Knex } knex
3
- * @returns { Promise<void> }
4
- */
5
- exports.up = function (knex) {
6
- return knex.schema.withSchema('dbos').alterTable('workflow_status', function (table) {
7
- table.text('application_version');
8
- table.text('application_id');
9
- });
10
- };
11
-
12
- /**
13
- * @param { import("knex").Knex } knex
14
- * @returns { Promise<void> }
15
- */
16
- exports.down = function (knex) {
17
- return knex.schema.withSchema('dbos').alterTable('workflow_status', function (table) {
18
- table.dropColumn('application_version');
19
- table.dropColumn('application_id');
20
- });
21
- };
@@ -1,14 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
3
- table.string('class_name').defaultTo(null);
4
-
5
- table.string('config_name').defaultTo(null);
6
- });
7
- };
8
-
9
- exports.down = function (knex) {
10
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
11
- table.dropColumn('class_name');
12
- table.dropColumn('config_name');
13
- });
14
- };
@@ -1,11 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
3
- table.bigInteger('recovery_attempts').defaultTo(0);
4
- });
5
- };
6
-
7
- exports.down = function (knex) {
8
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
9
- table.dropColumn('recovery_attempts');
10
- });
11
- };
@@ -1,33 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema
3
- .withSchema('dbos')
4
- .table('workflow_status', function (table) {
5
- table.text('queue_name').defaultTo(null);
6
- })
7
- .createTable('workflow_queue', function (table) {
8
- table.text('queue_name').notNullable();
9
- table.text('workflow_uuid').notNullable();
10
- table
11
- .bigInteger('created_at_epoch_ms')
12
- .notNullable()
13
- .defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
14
- table.bigInteger('started_at_epoch_ms');
15
- table.bigInteger('completed_at_epoch_ms');
16
- table.primary(['workflow_uuid']);
17
- table
18
- .foreign('workflow_uuid')
19
- .references('workflow_uuid')
20
- .inTable('dbos.workflow_status')
21
- .onDelete('CASCADE')
22
- .onUpdate('CASCADE');
23
- });
24
- };
25
-
26
- exports.down = function (knex) {
27
- return knex.schema
28
- .withSchema('dbos')
29
- .table('workflow_status', function (table) {
30
- table.dropColumn('queue_name');
31
- })
32
- .dropTableIfExists('workflow_queue');
33
- };
@@ -1,15 +0,0 @@
1
- exports.up = function (knex) {
2
- return knex.schema.withSchema('dbos').createTable('event_dispatch_kv', function (table) {
3
- table.text('service_name').notNullable();
4
- table.text('workflow_fn_name').notNullable();
5
- table.text('key').notNullable();
6
- table.text('value');
7
- table.decimal('update_seq', 38, 0);
8
- table.decimal('update_time', 38, 15);
9
- table.primary(['service_name', 'workflow_fn_name', 'key']);
10
- });
11
- };
12
-
13
- exports.down = function (knex) {
14
- return knex.schema.withSchema('dbos').dropTableIfExists('event_dispatch_kv');
15
- };
@@ -1,22 +0,0 @@
1
- // Due to a naming issue, this migration is mistakenly applied before 20252101000000_workflow_queues_executor_id.
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').table('operation_outputs', function (table) {
10
- table.text('function_name').notNullable().defaultTo(''); // Function name
11
- });
12
- };
13
-
14
- /**
15
- * @param { import("knex").Knex } knex
16
- * @returns { Promise<void> }
17
- */
18
- exports.down = function (knex) {
19
- return knex.schema.withSchema('dbos').table('operation_outputs', function (table) {
20
- table.dropColumn('function_name');
21
- });
22
- };
@@ -1,22 +0,0 @@
1
- // Due to a naming issue, this migration is mistakenly applied before 20252101000000_workflow_queues_executor_id.
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').table('operation_outputs', function (table) {
10
- table.text('child_workflow_id');
11
- });
12
- };
13
-
14
- /**
15
- * @param { import("knex").Knex } knex
16
- * @returns { Promise<void> }
17
- */
18
- exports.down = function (knex) {
19
- return knex.schema.withSchema('dbos').table('operation_outputs', function (table) {
20
- table.dropColumn('child_workflow_id');
21
- });
22
- };
@@ -1,27 +0,0 @@
1
- // This migration should have been prefixed with 20250121 instead of 20252101.
2
- // Because of this mistake, correctly prefixed migrations that are added in 2025 will be applied in the wrong order.
3
- // For example, 20250312171547_function_name_op_outputs and 20250319190617_add_childid_opoutputs were added after but get applied before this migration.
4
- // Luckily, those two migrations affect the operation_outputs table, so incorrect ordering is less impactful.
5
-
6
- // For the rest of 2025, we need to add 20 to the month field of the prefix so that the migrations are applied in the correct order.
7
- // Example, a migration added on May 1st, 2025 should be prefixed with 20252501.
8
-
9
- /**
10
- * @param { import("knex").Knex } knex
11
- * @returns { Promise<void> }
12
- */
13
- exports.up = function (knex) {
14
- return knex.schema.withSchema('dbos').table('workflow_queue', function (table) {
15
- table.text('executor_id');
16
- });
17
- };
18
-
19
- /**
20
- * @param { import("knex").Knex } knex
21
- * @returns { Promise<void> }
22
- */
23
- exports.down = function (knex) {
24
- return knex.schema.withSchema('dbos').table('workflow_queue', function (table) {
25
- table.dropColumn('executor_id');
26
- });
27
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * @param { import("knex").Knex } knex
3
- * @returns { Promise<void> }
4
- */
5
- exports.up = function (knex) {
6
- return knex.schema.withSchema('dbos').table('workflow_queue', function (table) {
7
- table.text('deduplication_id');
8
- table.unique(['queue_name', 'deduplication_id'], 'workflow_queue_queue_name_deduplication_id_unique');
9
- });
10
- };
11
-
12
- /**
13
- * @param { import("knex").Knex } knex
14
- * @returns { Promise<void> }
15
- */
16
- exports.down = function (knex) {
17
- return knex.schema.withSchema('dbos').table('workflow_queue', function (table) {
18
- table.dropUnique(['queue_name', 'deduplication_id'], 'workflow_queue_queue_name_deduplication_id_unique');
19
- table.dropColumn('deduplication_id');
20
- });
21
- };
@@ -1,24 +0,0 @@
1
- // Due to a naming issue, this migration is named "20252505000000_workflow_timeout" instead of "20250505000000_workflow_timeout".
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
10
- table.bigInteger('workflow_timeout_ms');
11
- table.bigInteger('workflow_deadline_epoch_ms');
12
- });
13
- };
14
-
15
- /**
16
- * @param { import("knex").Knex } knex
17
- * @returns { Promise<void> }
18
- */
19
- exports.down = function (knex) {
20
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
21
- table.dropColumn('workflow_timeout_ms');
22
- table.dropColumn('workflow_deadline_epoch_ms');
23
- });
24
- };
@@ -1,22 +0,0 @@
1
- // Due to a naming issue, this migration is named "20252512000000_queue_priority" instead of "20250512000000_queue_priority".
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').table('workflow_queue', function (table) {
10
- table.integer('priority').notNullable().defaultTo(0);
11
- });
12
- };
13
-
14
- /**
15
- * @param { import("knex").Knex } knex
16
- * @returns { Promise<void> }
17
- */
18
- exports.down = function (knex) {
19
- return knex.schema.withSchema('dbos').table('workflow_queue', function (table) {
20
- table.dropColumn('priority');
21
- });
22
- };
@@ -1,22 +0,0 @@
1
- // Due to a naming issue, this migration is named "20252512000000_queue_priority" instead of "20250512000000_queue_priority".
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
10
- table.text('inputs').nullable();
11
- });
12
- };
13
-
14
- /**
15
- * @param { import("knex").Knex } knex
16
- * @returns { Promise<void> }
17
- */
18
- exports.down = function (knex) {
19
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
20
- table.dropColumn('inputs');
21
- });
22
- };
@@ -1,30 +0,0 @@
1
- // Due to a naming issue, this migration is named "20252528000000_consolidate_queues.js" instead of "20250528000000_consolidate_queues.js".
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
10
- table.bigInteger('started_at_epoch_ms').nullable();
11
- table.text('deduplication_id').nullable();
12
- table.integer('priority').notNullable().defaultTo(0);
13
- table.unique(['queue_name', 'deduplication_id'], { indexName: 'uq_workflow_status_queue_name_dedup_id' });
14
- table.index(['status'], 'workflow_status_status_index');
15
- });
16
- };
17
-
18
- /**
19
- * @param { import("knex").Knex } knex
20
- * @returns { Promise<void> }
21
- */
22
- exports.down = function (knex) {
23
- return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
24
- table.dropIndex(['status'], 'workflow_status_status_index');
25
- table.dropUnique(['queue_name', 'deduplication_id'], 'uq_workflow_status_queue_name_dedup_id');
26
- table.dropColumn('priority');
27
- table.dropColumn('deduplication_id');
28
- table.dropColumn('started_at_epoch_ms');
29
- });
30
- };
@@ -1,30 +0,0 @@
1
- // Due to a naming issue, this migration is named "20252806000000_streaming.js"
2
- // Please see the 20252101000000_workflow_queues_executor_id migration for more details.
3
-
4
- /**
5
- * @param { import("knex").Knex } knex
6
- * @returns { Promise<void> }
7
- */
8
- exports.up = function (knex) {
9
- return knex.schema.withSchema('dbos').createTable('streams', function (table) {
10
- table.text('workflow_uuid').notNullable();
11
- table.text('key').notNullable();
12
- table.text('value').notNullable();
13
- table.integer('offset').notNullable();
14
- table.primary(['workflow_uuid', 'key', 'offset']);
15
- table
16
- .foreign('workflow_uuid')
17
- .references('workflow_uuid')
18
- .inTable('dbos.workflow_status')
19
- .onUpdate('CASCADE')
20
- .onDelete('CASCADE');
21
- });
22
- };
23
-
24
- /**
25
- * @param { import("knex").Knex } knex
26
- * @returns { Promise<void> }
27
- */
28
- exports.down = function (knex) {
29
- return knex.schema.withSchema('dbos').dropTable('streams');
30
- };