@dbos-inc/dbos-sdk 2.2.10-preview.g90e74a1e32 → 2.3.9-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/.husky/pre-commit +1 -0
- package/.prettierignore +3 -0
- package/.prettierrc +9 -0
- package/CODE_OF_CONDUCT.md +24 -18
- package/CONTRIBUTING.md +12 -10
- package/README.md +2 -2
- package/compose.yaml +17 -17
- package/dbos-config.schema.json +4 -13
- package/dist/schemas/user_db_schema.d.ts.map +1 -1
- package/dist/schemas/user_db_schema.js.map +1 -1
- package/dist/src/context.d.ts +12 -12
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +9 -9
- package/dist/src/context.js.map +1 -1
- package/dist/src/data_validation.d.ts +1 -1
- package/dist/src/data_validation.d.ts.map +1 -1
- package/dist/src/data_validation.js +14 -8
- package/dist/src/data_validation.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +4 -3
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +152 -141
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts +3 -3
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +80 -39
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/authentication.d.ts +1 -1
- package/dist/src/dbos-runtime/cloudutils/authentication.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/authentication.js +14 -14
- package/dist/src/dbos-runtime/cloudutils/authentication.js.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/cloudutils.d.ts +2 -2
- package/dist/src/dbos-runtime/cloudutils/cloudutils.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/cloudutils.js +32 -32
- package/dist/src/dbos-runtime/cloudutils/cloudutils.js.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/databases.d.ts +2 -2
- package/dist/src/dbos-runtime/cloudutils/databases.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cloudutils/databases.js +25 -21
- package/dist/src/dbos-runtime/cloudutils/databases.js.map +1 -1
- package/dist/src/dbos-runtime/commands.d.ts +1 -1
- package/dist/src/dbos-runtime/commands.js +9 -9
- package/dist/src/dbos-runtime/config.d.ts +7 -7
- package/dist/src/dbos-runtime/config.d.ts.map +1 -1
- package/dist/src/dbos-runtime/config.js +39 -23
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos-runtime/configure.d.ts.map +1 -1
- package/dist/src/dbos-runtime/configure.js.map +1 -1
- package/dist/src/dbos-runtime/db_connection.d.ts.map +1 -1
- package/dist/src/dbos-runtime/db_connection.js +2 -2
- package/dist/src/dbos-runtime/db_connection.js.map +1 -1
- package/dist/src/dbos-runtime/db_wizard.d.ts +1 -1
- package/dist/src/dbos-runtime/db_wizard.d.ts.map +1 -1
- package/dist/src/dbos-runtime/db_wizard.js +18 -18
- package/dist/src/dbos-runtime/db_wizard.js.map +1 -1
- package/dist/src/dbos-runtime/debug.d.ts +3 -3
- package/dist/src/dbos-runtime/debug.d.ts.map +1 -1
- package/dist/src/dbos-runtime/debug.js +7 -12
- package/dist/src/dbos-runtime/debug.js.map +1 -1
- package/dist/src/dbos-runtime/migrate.d.ts +2 -2
- package/dist/src/dbos-runtime/migrate.d.ts.map +1 -1
- package/dist/src/dbos-runtime/migrate.js +14 -10
- package/dist/src/dbos-runtime/migrate.js.map +1 -1
- package/dist/src/dbos-runtime/reset.d.ts +2 -2
- package/dist/src/dbos-runtime/reset.js +2 -2
- package/dist/src/dbos-runtime/reset.js.map +1 -1
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
- package/dist/src/dbos-runtime/runtime.js +4 -4
- package/dist/src/dbos-runtime/runtime.js.map +1 -1
- package/dist/src/dbos-runtime/workflow_management.d.ts +5 -4
- package/dist/src/dbos-runtime/workflow_management.d.ts.map +1 -1
- package/dist/src/dbos-runtime/workflow_management.js +34 -14
- package/dist/src/dbos-runtime/workflow_management.js.map +1 -1
- package/dist/src/dbos.d.ts +23 -23
- package/dist/src/dbos.d.ts.map +1 -1
- package/dist/src/dbos.js +59 -59
- package/dist/src/dbos.js.map +1 -1
- package/dist/src/debugpoint.d.ts.map +1 -1
- package/dist/src/debugpoint.js +4 -4
- package/dist/src/debugpoint.js.map +1 -1
- package/dist/src/decorators.d.ts +8 -8
- package/dist/src/decorators.d.ts.map +1 -1
- package/dist/src/decorators.js +36 -33
- package/dist/src/decorators.js.map +1 -1
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +6 -5
- package/dist/src/error.js.map +1 -1
- package/dist/src/eventreceiver.d.ts +1 -1
- package/dist/src/eventreceiver.d.ts.map +1 -1
- package/dist/src/httpServer/handler.d.ts +8 -8
- package/dist/src/httpServer/handler.d.ts.map +1 -1
- package/dist/src/httpServer/handler.js.map +1 -1
- package/dist/src/httpServer/handlerTypes.d.ts.map +1 -1
- package/dist/src/httpServer/handlerTypes.js.map +1 -1
- package/dist/src/httpServer/middleware.d.ts +9 -9
- package/dist/src/httpServer/middleware.d.ts.map +1 -1
- package/dist/src/httpServer/middleware.js +6 -6
- package/dist/src/httpServer/middleware.js.map +1 -1
- package/dist/src/httpServer/server.d.ts +2 -2
- package/dist/src/httpServer/server.d.ts.map +1 -1
- package/dist/src/httpServer/server.js +27 -33
- package/dist/src/httpServer/server.js.map +1 -1
- package/dist/src/index.d.ts +16 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/kafka/kafka.d.ts.map +1 -1
- package/dist/src/kafka/kafka.js +2 -2
- package/dist/src/kafka/kafka.js.map +1 -1
- package/dist/src/procedure.d.ts +6 -6
- package/dist/src/procedure.d.ts.map +1 -1
- package/dist/src/procedure.js.map +1 -1
- package/dist/src/scheduler/crontab.d.ts.map +1 -1
- package/dist/src/scheduler/crontab.js +54 -33
- package/dist/src/scheduler/crontab.js.map +1 -1
- package/dist/src/scheduler/scheduler.d.ts +3 -3
- package/dist/src/scheduler/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler/scheduler.js +7 -7
- package/dist/src/scheduler/scheduler.js.map +1 -1
- package/dist/src/step.d.ts +4 -4
- package/dist/src/step.d.ts.map +1 -1
- package/dist/src/step.js.map +1 -1
- package/dist/src/system_database.d.ts +20 -13
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +168 -60
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/telemetry/collector.d.ts +3 -3
- package/dist/src/telemetry/exporters.d.ts +1 -1
- package/dist/src/telemetry/exporters.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +5 -5
- package/dist/src/telemetry/logs.d.ts +4 -4
- package/dist/src/telemetry/logs.d.ts.map +1 -1
- package/dist/src/telemetry/logs.js +18 -18
- package/dist/src/telemetry/logs.js.map +1 -1
- package/dist/src/telemetry/traces.d.ts +3 -3
- package/dist/src/telemetry/traces.js +7 -7
- package/dist/src/testing/testing_runtime.d.ts +11 -11
- package/dist/src/testing/testing_runtime.d.ts.map +1 -1
- package/dist/src/testing/testing_runtime.js +15 -8
- package/dist/src/testing/testing_runtime.js.map +1 -1
- package/dist/src/transaction.d.ts +6 -6
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/transaction.js +4 -4
- package/dist/src/transaction.js.map +1 -1
- package/dist/src/user_database.d.ts +4 -4
- package/dist/src/user_database.d.ts.map +1 -1
- package/dist/src/user_database.js +45 -45
- package/dist/src/user_database.js.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +6 -12
- package/dist/src/utils.js.map +1 -1
- package/dist/src/wfqueue.d.ts +1 -1
- package/dist/src/wfqueue.d.ts.map +1 -1
- package/dist/src/wfqueue.js +8 -8
- package/dist/src/wfqueue.js.map +1 -1
- package/dist/src/workflow.d.ts +22 -10
- package/dist/src/workflow.d.ts.map +1 -1
- package/dist/src/workflow.js +19 -18
- package/dist/src/workflow.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/eslint.config.js +29 -27
- package/migrations/20240123182943_schema.js +7 -8
- package/migrations/20240123183021_tables.js +52 -48
- package/migrations/20240123183025_indexes.js +11 -14
- package/migrations/20240123183030_triggers.js +7 -8
- package/migrations/20240124015239_status_timestamp.js +12 -18
- package/migrations/20240201213211_replica_identity.js +8 -11
- package/migrations/20240205223925_foreign_keys.js +40 -18
- package/migrations/20240207192338_executor_id_index.js +8 -10
- package/migrations/20240430090000_tables.js +8 -10
- package/migrations/20240516004341_application_version.js +10 -12
- package/migrations/20240517000000_status_class_config.js +10 -14
- package/migrations/20240621000000_workflow_tries.js +8 -12
- package/migrations/20240924000000_workflowqueue.js +32 -23
- package/migrations/20241009150000_event_dispatch_kv.js +12 -14
- package/migrations/20252101000000_workflow_queues_executor_id.js +7 -9
- package/package.json +9 -2
- package/src/dbos-runtime/cloudutils/README.md +1 -1
package/eslint.config.js
CHANGED
@@ -1,43 +1,45 @@
|
|
1
|
-
const { FlatCompat } = require(
|
2
|
-
const typescriptEslint = require(
|
3
|
-
const typescriptEslintPlugin = require(
|
4
|
-
const typescriptEslintParser = require(
|
5
|
-
const globals = require(
|
6
|
-
const js = require(
|
1
|
+
const { FlatCompat } = require('@eslint/eslintrc');
|
2
|
+
const typescriptEslint = require('typescript-eslint');
|
3
|
+
const typescriptEslintPlugin = require('@typescript-eslint/eslint-plugin');
|
4
|
+
const typescriptEslintParser = require('@typescript-eslint/parser');
|
5
|
+
const globals = require('globals');
|
6
|
+
const js = require('@eslint/js');
|
7
7
|
|
8
8
|
const compat = new FlatCompat({
|
9
|
-
|
10
|
-
|
9
|
+
baseDirectory: __dirname,
|
10
|
+
recommendedConfig: js.configs.recommended,
|
11
11
|
});
|
12
12
|
|
13
13
|
module.exports = typescriptEslint.config(
|
14
14
|
{
|
15
|
-
ignores: [
|
16
|
-
"**/dist/",
|
17
|
-
"**/migrations/*",
|
18
|
-
"packages/create/templates/"
|
19
|
-
]
|
15
|
+
ignores: ['**/dist/', '**/migrations/*', 'packages/create/templates/'],
|
20
16
|
},
|
21
17
|
|
22
18
|
{
|
23
|
-
files: [
|
19
|
+
files: ['**/*.ts'],
|
24
20
|
|
25
|
-
extends: compat.extends(
|
26
|
-
|
21
|
+
extends: compat.extends(
|
22
|
+
'plugin:@typescript-eslint/recommended',
|
23
|
+
'plugin:@typescript-eslint/recommended-type-checked',
|
24
|
+
),
|
25
|
+
plugins: { '@typescript-eslint': typescriptEslintPlugin },
|
27
26
|
|
28
27
|
languageOptions: {
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
parser: typescriptEslintParser,
|
29
|
+
parserOptions: { project: './tsconfig.json' },
|
30
|
+
globals: { ...globals.node },
|
32
31
|
},
|
33
32
|
|
34
33
|
rules: {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
eqeqeq: 'error',
|
35
|
+
'@typescript-eslint/indent': 'off',
|
36
|
+
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
37
|
+
'@typescript-eslint/no-unused-vars': [
|
38
|
+
'error',
|
39
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
|
40
|
+
],
|
41
|
+
'@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
|
42
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
43
|
+
},
|
44
|
+
},
|
43
45
|
);
|
@@ -1,8 +1,7 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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,48 +1,52 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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,14 +1,11 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
});
|
13
|
-
};
|
14
|
-
|
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,5 +1,5 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
1
|
+
exports.up = function (knex) {
|
2
|
+
return knex.raw(`
|
3
3
|
CREATE OR REPLACE FUNCTION dbos.notifications_function() RETURNS TRIGGER AS $$
|
4
4
|
DECLARE
|
5
5
|
payload text := NEW.destination_uuid || '::' || NEW.topic;
|
@@ -26,14 +26,13 @@ exports.up = function(knex) {
|
|
26
26
|
AFTER INSERT ON dbos.workflow_events
|
27
27
|
FOR EACH ROW EXECUTE FUNCTION dbos.workflow_events_function();
|
28
28
|
`);
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
};
|
30
|
+
|
31
|
+
exports.down = function (knex) {
|
32
|
+
return knex.raw(`
|
33
33
|
DROP TRIGGER IF EXISTS dbos_notifications_trigger ON dbos.notifications;
|
34
34
|
DROP FUNCTION IF EXISTS dbos.notifications_function;
|
35
35
|
DROP TRIGGER IF EXISTS dbos_workflow_events_trigger ON dbos.workflow_events;
|
36
36
|
DROP FUNCTION IF EXISTS dbos.workflow_events_function;
|
37
37
|
`);
|
38
|
-
|
39
|
-
|
38
|
+
};
|
@@ -1,22 +1,16 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
table.bigInteger('created_at')
|
6
|
-
.notNullable()
|
7
|
-
.defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
|
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'));
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
.defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
|
13
|
-
});
|
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
|
+
});
|
14
9
|
};
|
15
10
|
|
16
|
-
exports.down = function(knex) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
});
|
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
|
+
});
|
22
16
|
};
|
@@ -1,15 +1,12 @@
|
|
1
|
-
exports.up = async function(knex) {
|
1
|
+
exports.up = async function (knex) {
|
2
2
|
await knex.raw('create extension if not exists "uuid-ossp"');
|
3
|
-
return knex.schema.withSchema('dbos')
|
4
|
-
.
|
5
|
-
|
6
|
-
})
|
7
|
-
|
3
|
+
return knex.schema.withSchema('dbos').table('notifications', function (table) {
|
4
|
+
table.text('message_uuid').primary().defaultTo(knex.raw('uuid_generate_v4()'));
|
5
|
+
});
|
8
6
|
};
|
9
7
|
|
10
|
-
exports.down = function(knex) {
|
11
|
-
return knex.schema.withSchema('dbos')
|
12
|
-
.
|
13
|
-
|
14
|
-
});
|
8
|
+
exports.down = function (knex) {
|
9
|
+
return knex.schema.withSchema('dbos').table('notifications', function (table) {
|
10
|
+
table.dropColumn('message_uuid');
|
11
|
+
});
|
15
12
|
};
|
@@ -2,22 +2,43 @@
|
|
2
2
|
* @param { import("knex").Knex } knex
|
3
3
|
* @returns { Promise<void> }
|
4
4
|
*/
|
5
|
-
exports.up = function(knex) {
|
6
|
-
return knex.schema
|
7
|
-
.
|
5
|
+
exports.up = function (knex) {
|
6
|
+
return knex.schema
|
7
|
+
.withSchema('dbos')
|
8
|
+
.alterTable('workflow_status', function (table) {
|
8
9
|
table.index('created_at');
|
9
10
|
})
|
10
|
-
.alterTable('operation_outputs', function(table) {
|
11
|
-
table
|
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');
|
12
18
|
})
|
13
|
-
.alterTable('workflow_inputs', function(table) {
|
14
|
-
table
|
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');
|
15
26
|
})
|
16
|
-
.alterTable('notifications', function(table) {
|
17
|
-
table
|
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');
|
18
34
|
})
|
19
|
-
.alterTable('workflow_events', function(table) {
|
20
|
-
table
|
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');
|
21
42
|
});
|
22
43
|
};
|
23
44
|
|
@@ -25,21 +46,22 @@ exports.up = function(knex) {
|
|
25
46
|
* @param { import("knex").Knex } knex
|
26
47
|
* @returns { Promise<void> }
|
27
48
|
*/
|
28
|
-
exports.down = function(knex) {
|
29
|
-
return knex.schema
|
30
|
-
.
|
49
|
+
exports.down = function (knex) {
|
50
|
+
return knex.schema
|
51
|
+
.withSchema('dbos')
|
52
|
+
.alterTable('workflow_status', function (table) {
|
31
53
|
table.dropIndex('created_at');
|
32
54
|
})
|
33
|
-
.alterTable('operation_outputs', function(table) {
|
55
|
+
.alterTable('operation_outputs', function (table) {
|
34
56
|
table.dropForeign('workflow_uuid');
|
35
57
|
})
|
36
|
-
.alterTable('workflow_inputs', function(table) {
|
58
|
+
.alterTable('workflow_inputs', function (table) {
|
37
59
|
table.dropForeign('workflow_uuid');
|
38
60
|
})
|
39
|
-
.alterTable('notifications', function(table) {
|
61
|
+
.alterTable('notifications', function (table) {
|
40
62
|
table.dropForeign('destination_uuid');
|
41
63
|
})
|
42
|
-
.alterTable('workflow_events', function(table) {
|
64
|
+
.alterTable('workflow_events', function (table) {
|
43
65
|
table.dropForeign('workflow_uuid');
|
44
66
|
});
|
45
67
|
};
|
@@ -2,20 +2,18 @@
|
|
2
2
|
* @param { import("knex").Knex } knex
|
3
3
|
* @returns { Promise<void> }
|
4
4
|
*/
|
5
|
-
exports.up = function(knex) {
|
6
|
-
return knex.schema.withSchema('dbos')
|
7
|
-
.
|
8
|
-
|
9
|
-
});
|
5
|
+
exports.up = function (knex) {
|
6
|
+
return knex.schema.withSchema('dbos').alterTable('workflow_status', function (table) {
|
7
|
+
table.index('executor_id');
|
8
|
+
});
|
10
9
|
};
|
11
10
|
|
12
11
|
/**
|
13
12
|
* @param { import("knex").Knex } knex
|
14
13
|
* @returns { Promise<void> }
|
15
14
|
*/
|
16
|
-
exports.down = function(knex) {
|
17
|
-
return knex.schema.withSchema('dbos')
|
18
|
-
.
|
19
|
-
|
20
|
-
});
|
15
|
+
exports.down = function (knex) {
|
16
|
+
return knex.schema.withSchema('dbos').alterTable('workflow_status', function (table) {
|
17
|
+
table.dropIndex('executor_id');
|
18
|
+
});
|
21
19
|
};
|
@@ -1,13 +1,11 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
return knex.schema.withSchema('dbos')
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
})
|
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
|
+
});
|
8
7
|
};
|
9
8
|
|
10
|
-
exports.down = function(knex) {
|
11
|
-
return knex.schema.withSchema('dbos')
|
12
|
-
.dropTableIfExists('scheduler_state');
|
9
|
+
exports.down = function (knex) {
|
10
|
+
return knex.schema.withSchema('dbos').dropTableIfExists('scheduler_state');
|
13
11
|
};
|
@@ -2,22 +2,20 @@
|
|
2
2
|
* @param { import("knex").Knex } knex
|
3
3
|
* @returns { Promise<void> }
|
4
4
|
*/
|
5
|
-
exports.up = function(knex) {
|
6
|
-
|
7
|
-
.
|
8
|
-
|
9
|
-
|
10
|
-
})
|
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
|
+
});
|
11
10
|
};
|
12
11
|
|
13
12
|
/**
|
14
13
|
* @param { import("knex").Knex } knex
|
15
14
|
* @returns { Promise<void> }
|
16
15
|
*/
|
17
|
-
exports.down = function(knex) {
|
18
|
-
|
19
|
-
.
|
20
|
-
|
21
|
-
|
22
|
-
})
|
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
|
+
});
|
23
21
|
};
|
@@ -1,18 +1,14 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
table.string('class_name')
|
5
|
-
.defaultTo(null);
|
1
|
+
exports.up = function (knex) {
|
2
|
+
return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
|
3
|
+
table.string('class_name').defaultTo(null);
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
});
|
5
|
+
table.string('config_name').defaultTo(null);
|
6
|
+
});
|
10
7
|
};
|
11
8
|
|
12
|
-
exports.down = function(knex) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
});
|
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
|
+
});
|
18
14
|
};
|
@@ -1,15 +1,11 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
table.bigInteger('recovery_attempts')
|
6
|
-
.defaultTo(0);
|
7
|
-
});
|
1
|
+
exports.up = function (knex) {
|
2
|
+
return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
|
3
|
+
table.bigInteger('recovery_attempts').defaultTo(0);
|
4
|
+
});
|
8
5
|
};
|
9
6
|
|
10
|
-
exports.down = function(knex) {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
});
|
7
|
+
exports.down = function (knex) {
|
8
|
+
return knex.schema.withSchema('dbos').table('workflow_status', function (table) {
|
9
|
+
table.dropColumn('recovery_attempts');
|
10
|
+
});
|
15
11
|
};
|
@@ -1,24 +1,33 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
.
|
21
|
-
|
22
|
-
|
23
|
-
|
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');
|
24
33
|
};
|
@@ -1,17 +1,15 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
return knex.schema.withSchema('dbos')
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
})
|
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
|
+
});
|
12
11
|
};
|
13
12
|
|
14
|
-
exports.down = function(knex) {
|
15
|
-
return knex.schema.withSchema('dbos')
|
16
|
-
.dropTableIfExists('event_dispatch_kv');
|
13
|
+
exports.down = function (knex) {
|
14
|
+
return knex.schema.withSchema('dbos').dropTableIfExists('event_dispatch_kv');
|
17
15
|
};
|