MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / checkMigrationVersion

Function checkMigrationVersion

scripts/migrate.js:318–347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

316};
317
318const checkMigrationVersion = async () => {
319 const client = await pool.connect();
320
321 try {
322 const current = await getCurrentSchemaVersion(client);
323
324 if (!current) {
325 logger.error(`❌ No schema version found in ${migrationTable}. Expected v${EXPECTED_SCHEMA_VERSION}.`);
326 process.exit(1);
327 }
328
329 const currentVersion = Number(current.version);
330 if (currentVersion !== EXPECTED_SCHEMA_VERSION) {
331 logger.error(
332 `❌ Schema drift detected. Expected v${EXPECTED_SCHEMA_VERSION}, found v${currentVersion}.`
333 );
334 process.exit(1);
335 }
336
337 logger.info(
338 `✅ Schema version check passed (v${currentVersion}, label: ${current.label}).`
339 );
340 } catch (error) {
341 logger.error('❌ Migration check failed:', error);
342 process.exit(1);
343 } finally {
344 client.release();
345 await pool.end();
346 }
347};
348
349const printMigrationStatus = async () => {
350 const client = await pool.connect();

Callers 1

migrate.jsFile · 0.85

Calls 2

getCurrentSchemaVersionFunction · 0.85
connectMethod · 0.80

Tested by

no test coverage detected