@dbos-inc/dbos-sdk 0.8.45-preview → 0.8.45-preview.g56ba028de5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/packages/dbos-cloud/cli.js +12 -0
- package/dist/packages/dbos-cloud/cli.js.map +1 -1
- package/dist/packages/dbos-cloud/userdb.d.ts +2 -0
- package/dist/packages/dbos-cloud/userdb.d.ts.map +1 -1
- package/dist/packages/dbos-cloud/userdb.js +173 -1
- package/dist/packages/dbos-cloud/userdb.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +0 -14
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/system_database.d.ts +0 -2
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +11 -26
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/utils.d.ts +0 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -26
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/examples/hello/start_postgres_docker.sh +1 -1
- package/package.json +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/cli.js +12 -0
- package/packages/dbos-cloud/dist/packages/dbos-cloud/cli.js.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.d.ts +2 -0
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.js +173 -1
- package/packages/dbos-cloud/dist/packages/dbos-cloud/userdb.js.map +1 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.js +0 -14
- package/packages/dbos-cloud/dist/src/dbos-runtime/cli.js.map +1 -1
- package/packages/dbos-cloud/dist/src/system_database.d.ts +0 -2
- package/packages/dbos-cloud/dist/src/system_database.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/src/system_database.js +11 -26
- package/packages/dbos-cloud/dist/src/system_database.js.map +1 -1
- package/packages/dbos-cloud/dist/src/utils.d.ts +0 -1
- package/packages/dbos-cloud/dist/src/utils.d.ts.map +1 -1
- package/packages/dbos-cloud/dist/src/utils.js +1 -26
- package/packages/dbos-cloud/dist/src/utils.js.map +1 -1
- package/packages/dbos-cloud/package.json +1 -1
- package/packages/dbos-openapi/package.json +1 -1
- package/dist/src/dbos-runtime/migrate.d.ts +0 -3
- package/dist/src/dbos-runtime/migrate.d.ts.map +0 -1
- package/dist/src/dbos-runtime/migrate.js +0 -175
- package/dist/src/dbos-runtime/migrate.js.map +0 -1
- package/migrations/20240123182943_schema.js +0 -8
- package/migrations/20240123183021_tables.js +0 -48
- package/migrations/20240123183025_indexes.js +0 -14
- package/migrations/20240123183030_triggers.js +0 -39
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.d.ts +0 -3
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.d.ts.map +0 -1
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.js +0 -175
- package/packages/dbos-cloud/dist/src/dbos-runtime/migrate.js.map +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/dbos-runtime/migrate.ts"],"names":[],"mappings":"AASA,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAiF/C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CA4B1C"}
|
@@ -1,175 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.rollbackMigration = exports.migrate = void 0;
|
4
|
-
const child_process_1 = require("child_process");
|
5
|
-
const logs_1 = require("../telemetry/logs");
|
6
|
-
const user_database_1 = require("../user_database");
|
7
|
-
const config_1 = require("./config");
|
8
|
-
const utils_1 = require("../utils");
|
9
|
-
const pg_1 = require("pg");
|
10
|
-
const user_db_schema_1 = require("../../schemas/user_db_schema");
|
11
|
-
const system_database_1 = require("../system_database");
|
12
|
-
async function migrate() {
|
13
|
-
const logger = new logs_1.GlobalLogger();
|
14
|
-
// Read the configuration YAML file
|
15
|
-
const configFile = (0, config_1.loadConfigFile)(config_1.dbosConfigFilePath);
|
16
|
-
if (!configFile) {
|
17
|
-
logger.error(`Failed to parse ${config_1.dbosConfigFilePath}`);
|
18
|
-
return 1;
|
19
|
-
}
|
20
|
-
const userDBName = configFile.database.user_database;
|
21
|
-
logger.info(`Creating database ${userDBName} if it does not already exist`);
|
22
|
-
const createDB = `createdb -h ${configFile.database.hostname} -p ${configFile.database.port} ${userDBName} -U ${configFile.database.username} -ew ${userDBName}`;
|
23
|
-
try {
|
24
|
-
process.env.PGPASSWORD = configFile.database.password;
|
25
|
-
const createDBOutput = (0, child_process_1.execSync)(createDB, { env: process.env }).toString();
|
26
|
-
if (createDBOutput.includes(`database "${userDBName}" already exists`)) {
|
27
|
-
logger.info(`Database ${userDBName} already exists`);
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
logger.info(createDBOutput);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
catch (e) {
|
34
|
-
if (e instanceof Error) {
|
35
|
-
if (e.message.includes(`database "${userDBName}" already exists`)) {
|
36
|
-
logger.info(`Database ${userDBName} already exists`);
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
logger.error(`Error creating database: ${e.message}`);
|
40
|
-
return 1;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
logger.error(e);
|
45
|
-
return 1;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
const dbType = configFile.database.user_dbclient || user_database_1.UserDatabaseName.KNEX;
|
49
|
-
const migrationScript = `node_modules/.bin/${dbType}`;
|
50
|
-
const migrationCommands = configFile.database.migrate;
|
51
|
-
try {
|
52
|
-
migrationCommands?.forEach((cmd) => {
|
53
|
-
const command = `node ${migrationScript} ${cmd}`;
|
54
|
-
logger.info(`Executing migration command: ${command}`);
|
55
|
-
const migrateCommandOutput = (0, child_process_1.execSync)(command).toString();
|
56
|
-
logger.info(migrateCommandOutput);
|
57
|
-
});
|
58
|
-
}
|
59
|
-
catch (e) {
|
60
|
-
logger.error("Error running migration");
|
61
|
-
if (e instanceof Error) {
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
63
|
-
const stderr = e.stderr;
|
64
|
-
if (stderr && Buffer.isBuffer(stderr) && stderr.length > 0) {
|
65
|
-
logger.error(`Standard Error: ${stderr.toString().trim()}`);
|
66
|
-
}
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
68
|
-
const stdout = e.stdout;
|
69
|
-
if (stdout && Buffer.isBuffer(stdout) && stdout.length > 0) {
|
70
|
-
logger.error(`Standard Output: ${stdout.toString().trim()}`);
|
71
|
-
}
|
72
|
-
if (e.message) {
|
73
|
-
logger.error(e.message);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
else {
|
77
|
-
logger.error(e);
|
78
|
-
}
|
79
|
-
return 1;
|
80
|
-
}
|
81
|
-
logger.info("Creating DBOS tables and system database.");
|
82
|
-
try {
|
83
|
-
await createDBOSTables(configFile);
|
84
|
-
}
|
85
|
-
catch (e) {
|
86
|
-
if (e instanceof Error) {
|
87
|
-
logger.error(`Error creating DBOS system database: ${e.message}`);
|
88
|
-
}
|
89
|
-
else {
|
90
|
-
logger.error(e);
|
91
|
-
}
|
92
|
-
return 1;
|
93
|
-
}
|
94
|
-
return 0;
|
95
|
-
}
|
96
|
-
exports.migrate = migrate;
|
97
|
-
function rollbackMigration() {
|
98
|
-
const logger = new logs_1.GlobalLogger();
|
99
|
-
// read the yaml file
|
100
|
-
const configFile = (0, config_1.loadConfigFile)(config_1.dbosConfigFilePath);
|
101
|
-
if (!configFile) {
|
102
|
-
logger.error(`failed to parse ${config_1.dbosConfigFilePath}`);
|
103
|
-
return 1;
|
104
|
-
}
|
105
|
-
let dbType = configFile.database.user_dbclient;
|
106
|
-
if (dbType == undefined) {
|
107
|
-
dbType = "knex";
|
108
|
-
}
|
109
|
-
const rollbackcommands = configFile.database.rollback;
|
110
|
-
try {
|
111
|
-
rollbackcommands?.forEach((cmd) => {
|
112
|
-
const command = "npx " + dbType + " " + cmd;
|
113
|
-
logger.info("Executing " + command);
|
114
|
-
(0, child_process_1.execSync)(command);
|
115
|
-
});
|
116
|
-
}
|
117
|
-
catch (e) {
|
118
|
-
logger.error("Error rolling back migration. ");
|
119
|
-
return 1;
|
120
|
-
}
|
121
|
-
return 0;
|
122
|
-
}
|
123
|
-
exports.rollbackMigration = rollbackMigration;
|
124
|
-
// Create DBOS system DB and tables.
|
125
|
-
// TODO: replace this with knex to manage schema.
|
126
|
-
async function createDBOSTables(configFile) {
|
127
|
-
const logger = new logs_1.GlobalLogger();
|
128
|
-
const userPoolConfig = {
|
129
|
-
host: configFile.database.hostname,
|
130
|
-
port: configFile.database.port,
|
131
|
-
user: configFile.database.username,
|
132
|
-
password: configFile.database.password,
|
133
|
-
connectionTimeoutMillis: configFile.database.connectionTimeoutMillis || 3000,
|
134
|
-
database: configFile.database.user_database,
|
135
|
-
};
|
136
|
-
if (configFile.database.ssl_ca) {
|
137
|
-
userPoolConfig.ssl = { ca: [(0, utils_1.readFileSync)(configFile.database.ssl_ca)], rejectUnauthorized: true };
|
138
|
-
}
|
139
|
-
const systemPoolConfig = { ...userPoolConfig };
|
140
|
-
systemPoolConfig.database = `${userPoolConfig.database}_dbos_sys`;
|
141
|
-
const pgUserClient = new pg_1.Client(userPoolConfig);
|
142
|
-
await pgUserClient.connect();
|
143
|
-
// Create DBOS table/schema in user DB.
|
144
|
-
const schemaExists = await pgUserClient.query(`SELECT EXISTS (SELECT FROM information_schema.schemata WHERE schema_name = 'dbos')`);
|
145
|
-
if (!schemaExists.rows[0].exists) {
|
146
|
-
await pgUserClient.query(user_db_schema_1.createUserDBSchema);
|
147
|
-
await pgUserClient.query(user_db_schema_1.userDBSchema);
|
148
|
-
}
|
149
|
-
// Create the DBOS system database.
|
150
|
-
const dbExists = await pgUserClient.query(`SELECT EXISTS (SELECT FROM pg_database WHERE datname = '${systemPoolConfig.database}')`);
|
151
|
-
if (!dbExists.rows[0].exists) {
|
152
|
-
await pgUserClient.query(`CREATE DATABASE ${systemPoolConfig.database}`);
|
153
|
-
}
|
154
|
-
// Load the DBOS system schema.
|
155
|
-
const pgSystemClient = new pg_1.Client(systemPoolConfig);
|
156
|
-
await pgSystemClient.connect();
|
157
|
-
try {
|
158
|
-
await (0, system_database_1.migrateSystemDatabase)(systemPoolConfig);
|
159
|
-
}
|
160
|
-
catch (e) {
|
161
|
-
const tableExists = await pgSystemClient.query(`SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'dbos' AND table_name = 'operation_outputs')`);
|
162
|
-
if (tableExists.rows[0].exists) {
|
163
|
-
// If the table has been created by someone else. Ignore the error.
|
164
|
-
logger.warn(`System tables creation failed, may conflict with concurrent tasks: ${e.message}`);
|
165
|
-
}
|
166
|
-
else {
|
167
|
-
throw e;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
finally {
|
171
|
-
await pgSystemClient.end();
|
172
|
-
await pgUserClient.end();
|
173
|
-
}
|
174
|
-
}
|
175
|
-
//# sourceMappingURL=migrate.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/dbos-runtime/migrate.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,4CAAiD;AACjD,oDAAoD;AACpD,qCAA0E;AAC1E,oCAAwC;AACxC,2BAAwC;AACxC,iEAAgF;AAChF,wDAA2E;AAEpE,KAAK,UAAU,OAAO;IAC3B,MAAM,MAAM,GAAG,IAAI,mBAAY,EAAE,CAAC;IAElC,mCAAmC;IACnC,MAAM,UAAU,GAA2B,IAAA,uBAAc,EAAC,2BAAkB,CAAC,CAAC;IAC9E,IAAI,CAA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mE;YACnE,MAAM,CAAC,IAAI,CAAC,sEAAuE,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5G,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,cAAc,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
return knex.schema.withSchema('dbos')
|
3
|
-
.createTable('operation_outputs', function(table) {
|
4
|
-
table.text('workflow_uuid').notNullable();
|
5
|
-
table.integer('function_id').notNullable();
|
6
|
-
table.text('output');
|
7
|
-
table.text('error');
|
8
|
-
table.primary(['workflow_uuid', 'function_id']);
|
9
|
-
})
|
10
|
-
.createTable('workflow_inputs', function(table) {
|
11
|
-
table.text('workflow_uuid').primary().notNullable();
|
12
|
-
table.text('inputs').notNullable();
|
13
|
-
})
|
14
|
-
.createTable('workflow_status', function(table) {
|
15
|
-
table.text('workflow_uuid').primary();
|
16
|
-
table.text('status');
|
17
|
-
table.text('name');
|
18
|
-
table.text('authenticated_user');
|
19
|
-
table.text('assumed_role');
|
20
|
-
table.text('authenticated_roles');
|
21
|
-
table.text('request');
|
22
|
-
table.text('output');
|
23
|
-
table.text('error');
|
24
|
-
table.text('executor_id');
|
25
|
-
})
|
26
|
-
.createTable('notifications', function(table) {
|
27
|
-
table.text('destination_uuid').notNullable();
|
28
|
-
table.text('topic');
|
29
|
-
table.text('message').notNullable();
|
30
|
-
table.bigInteger('created_at_epoch_ms').notNullable().defaultTo(knex.raw('(EXTRACT(EPOCH FROM now())*1000)::bigint'));
|
31
|
-
})
|
32
|
-
.createTable('workflow_events', function(table) {
|
33
|
-
table.text('workflow_uuid').notNullable();
|
34
|
-
table.text('key').notNullable();
|
35
|
-
table.text('value').notNullable();
|
36
|
-
table.primary(['workflow_uuid', 'key']);
|
37
|
-
});
|
38
|
-
};
|
39
|
-
|
40
|
-
exports.down = function(knex) {
|
41
|
-
return knex.schema.withSchema('dbos')
|
42
|
-
.dropTableIfExists('operation_outputs')
|
43
|
-
.dropTableIfExists('workflow_inputs')
|
44
|
-
.dropTableIfExists('workflow_status')
|
45
|
-
.dropTableIfExists('notifications')
|
46
|
-
.dropTableIfExists('workflow_events');
|
47
|
-
};
|
48
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
exports.up = function(knex) {
|
2
|
-
return knex.schema.withSchema('dbos')
|
3
|
-
.table('notifications', function(table) {
|
4
|
-
table.index(['destination_uuid', 'topic'], 'idx_workflow_topic');
|
5
|
-
});
|
6
|
-
};
|
7
|
-
|
8
|
-
exports.down = function(knex) {
|
9
|
-
return knex.schema.withSchema('dbos')
|
10
|
-
.table('notifications', function(table) {
|
11
|
-
table.dropIndex(['destination_uuid', 'topic'], 'idx_workflow_topic');
|
12
|
-
});
|
13
|
-
};
|
14
|
-
|
@@ -1,39 +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
|
-
};
|
39
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../../../src/dbos-runtime/migrate.ts"],"names":[],"mappings":"AASA,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAiF/C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CA4B1C"}
|
@@ -1,175 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.rollbackMigration = exports.migrate = void 0;
|
4
|
-
const child_process_1 = require("child_process");
|
5
|
-
const logs_1 = require("../telemetry/logs");
|
6
|
-
const user_database_1 = require("../user_database");
|
7
|
-
const config_1 = require("./config");
|
8
|
-
const utils_1 = require("../utils");
|
9
|
-
const pg_1 = require("pg");
|
10
|
-
const user_db_schema_1 = require("../../schemas/user_db_schema");
|
11
|
-
const system_database_1 = require("../system_database");
|
12
|
-
async function migrate() {
|
13
|
-
const logger = new logs_1.GlobalLogger();
|
14
|
-
// Read the configuration YAML file
|
15
|
-
const configFile = (0, config_1.loadConfigFile)(config_1.dbosConfigFilePath);
|
16
|
-
if (!configFile) {
|
17
|
-
logger.error(`Failed to parse ${config_1.dbosConfigFilePath}`);
|
18
|
-
return 1;
|
19
|
-
}
|
20
|
-
const userDBName = configFile.database.user_database;
|
21
|
-
logger.info(`Creating database ${userDBName} if it does not already exist`);
|
22
|
-
const createDB = `createdb -h ${configFile.database.hostname} -p ${configFile.database.port} ${userDBName} -U ${configFile.database.username} -ew ${userDBName}`;
|
23
|
-
try {
|
24
|
-
process.env.PGPASSWORD = configFile.database.password;
|
25
|
-
const createDBOutput = (0, child_process_1.execSync)(createDB, { env: process.env }).toString();
|
26
|
-
if (createDBOutput.includes(`database "${userDBName}" already exists`)) {
|
27
|
-
logger.info(`Database ${userDBName} already exists`);
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
logger.info(createDBOutput);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
catch (e) {
|
34
|
-
if (e instanceof Error) {
|
35
|
-
if (e.message.includes(`database "${userDBName}" already exists`)) {
|
36
|
-
logger.info(`Database ${userDBName} already exists`);
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
logger.error(`Error creating database: ${e.message}`);
|
40
|
-
return 1;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
logger.error(e);
|
45
|
-
return 1;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
const dbType = configFile.database.user_dbclient || user_database_1.UserDatabaseName.KNEX;
|
49
|
-
const migrationScript = `node_modules/.bin/${dbType}`;
|
50
|
-
const migrationCommands = configFile.database.migrate;
|
51
|
-
try {
|
52
|
-
migrationCommands?.forEach((cmd) => {
|
53
|
-
const command = `node ${migrationScript} ${cmd}`;
|
54
|
-
logger.info(`Executing migration command: ${command}`);
|
55
|
-
const migrateCommandOutput = (0, child_process_1.execSync)(command).toString();
|
56
|
-
logger.info(migrateCommandOutput);
|
57
|
-
});
|
58
|
-
}
|
59
|
-
catch (e) {
|
60
|
-
logger.error("Error running migration");
|
61
|
-
if (e instanceof Error) {
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
63
|
-
const stderr = e.stderr;
|
64
|
-
if (stderr && Buffer.isBuffer(stderr) && stderr.length > 0) {
|
65
|
-
logger.error(`Standard Error: ${stderr.toString().trim()}`);
|
66
|
-
}
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
68
|
-
const stdout = e.stdout;
|
69
|
-
if (stdout && Buffer.isBuffer(stdout) && stdout.length > 0) {
|
70
|
-
logger.error(`Standard Output: ${stdout.toString().trim()}`);
|
71
|
-
}
|
72
|
-
if (e.message) {
|
73
|
-
logger.error(e.message);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
else {
|
77
|
-
logger.error(e);
|
78
|
-
}
|
79
|
-
return 1;
|
80
|
-
}
|
81
|
-
logger.info("Creating DBOS tables and system database.");
|
82
|
-
try {
|
83
|
-
await createDBOSTables(configFile);
|
84
|
-
}
|
85
|
-
catch (e) {
|
86
|
-
if (e instanceof Error) {
|
87
|
-
logger.error(`Error creating DBOS system database: ${e.message}`);
|
88
|
-
}
|
89
|
-
else {
|
90
|
-
logger.error(e);
|
91
|
-
}
|
92
|
-
return 1;
|
93
|
-
}
|
94
|
-
return 0;
|
95
|
-
}
|
96
|
-
exports.migrate = migrate;
|
97
|
-
function rollbackMigration() {
|
98
|
-
const logger = new logs_1.GlobalLogger();
|
99
|
-
// read the yaml file
|
100
|
-
const configFile = (0, config_1.loadConfigFile)(config_1.dbosConfigFilePath);
|
101
|
-
if (!configFile) {
|
102
|
-
logger.error(`failed to parse ${config_1.dbosConfigFilePath}`);
|
103
|
-
return 1;
|
104
|
-
}
|
105
|
-
let dbType = configFile.database.user_dbclient;
|
106
|
-
if (dbType == undefined) {
|
107
|
-
dbType = "knex";
|
108
|
-
}
|
109
|
-
const rollbackcommands = configFile.database.rollback;
|
110
|
-
try {
|
111
|
-
rollbackcommands?.forEach((cmd) => {
|
112
|
-
const command = "npx " + dbType + " " + cmd;
|
113
|
-
logger.info("Executing " + command);
|
114
|
-
(0, child_process_1.execSync)(command);
|
115
|
-
});
|
116
|
-
}
|
117
|
-
catch (e) {
|
118
|
-
logger.error("Error rolling back migration. ");
|
119
|
-
return 1;
|
120
|
-
}
|
121
|
-
return 0;
|
122
|
-
}
|
123
|
-
exports.rollbackMigration = rollbackMigration;
|
124
|
-
// Create DBOS system DB and tables.
|
125
|
-
// TODO: replace this with knex to manage schema.
|
126
|
-
async function createDBOSTables(configFile) {
|
127
|
-
const logger = new logs_1.GlobalLogger();
|
128
|
-
const userPoolConfig = {
|
129
|
-
host: configFile.database.hostname,
|
130
|
-
port: configFile.database.port,
|
131
|
-
user: configFile.database.username,
|
132
|
-
password: configFile.database.password,
|
133
|
-
connectionTimeoutMillis: configFile.database.connectionTimeoutMillis || 3000,
|
134
|
-
database: configFile.database.user_database,
|
135
|
-
};
|
136
|
-
if (configFile.database.ssl_ca) {
|
137
|
-
userPoolConfig.ssl = { ca: [(0, utils_1.readFileSync)(configFile.database.ssl_ca)], rejectUnauthorized: true };
|
138
|
-
}
|
139
|
-
const systemPoolConfig = { ...userPoolConfig };
|
140
|
-
systemPoolConfig.database = `${userPoolConfig.database}_dbos_sys`;
|
141
|
-
const pgUserClient = new pg_1.Client(userPoolConfig);
|
142
|
-
await pgUserClient.connect();
|
143
|
-
// Create DBOS table/schema in user DB.
|
144
|
-
const schemaExists = await pgUserClient.query(`SELECT EXISTS (SELECT FROM information_schema.schemata WHERE schema_name = 'dbos')`);
|
145
|
-
if (!schemaExists.rows[0].exists) {
|
146
|
-
await pgUserClient.query(user_db_schema_1.createUserDBSchema);
|
147
|
-
await pgUserClient.query(user_db_schema_1.userDBSchema);
|
148
|
-
}
|
149
|
-
// Create the DBOS system database.
|
150
|
-
const dbExists = await pgUserClient.query(`SELECT EXISTS (SELECT FROM pg_database WHERE datname = '${systemPoolConfig.database}')`);
|
151
|
-
if (!dbExists.rows[0].exists) {
|
152
|
-
await pgUserClient.query(`CREATE DATABASE ${systemPoolConfig.database}`);
|
153
|
-
}
|
154
|
-
// Load the DBOS system schema.
|
155
|
-
const pgSystemClient = new pg_1.Client(systemPoolConfig);
|
156
|
-
await pgSystemClient.connect();
|
157
|
-
try {
|
158
|
-
await (0, system_database_1.migrateSystemDatabase)(systemPoolConfig);
|
159
|
-
}
|
160
|
-
catch (e) {
|
161
|
-
const tableExists = await pgSystemClient.query(`SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'dbos' AND table_name = 'operation_outputs')`);
|
162
|
-
if (tableExists.rows[0].exists) {
|
163
|
-
// If the table has been created by someone else. Ignore the error.
|
164
|
-
logger.warn(`System tables creation failed, may conflict with concurrent tasks: ${e.message}`);
|
165
|
-
}
|
166
|
-
else {
|
167
|
-
throw e;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
finally {
|
171
|
-
await pgSystemClient.end();
|
172
|
-
await pgUserClient.end();
|
173
|
-
}
|
174
|
-
}
|
175
|
-
//# sourceMappingURL=migrate.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../../../src/dbos-runtime/migrate.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,4CAAiD;AACjD,oDAAoD;AACpD,qCAA0E;AAC1E,oCAAwC;AACxC,2BAAwC;AACxC,iEAAgF;AAChF,wDAA2E;AAEpE,KAAK,UAAU,OAAO;IAC3B,MAAM,MAAM,GAAG,IAAI,mBAAY,EAAE,CAAC;IAElC,mCAAmC;IACnC,MAAM,UAAU,GAA2B,IAAA,uBAAc,EAAC,2BAAkB,CAAC,CAAC;IAC9E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,mBAAmB,2BAAkB,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,aAA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