- migrate-project-docs-batch.mjs: 60 files across 23 projects - migrate-cf-docs-batch.mjs: ClaudeFramework documentation - migrate-plans-batch.mjs: Session plan files - 017_fix_archives_embedding_dimension.sql: Fix vector dimension - run-migration.js: Node.js migration runner utility Total migrated: 332 files, 8.85MB with semantic embeddings Fixes: CF-277
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Run a specific migration file
|
|
* Usage: node run-migration.js migrations/017_fix_archives_embedding_dimension.sql
|
|
*/
|
|
|
|
import pg from 'pg';
|
|
import { readFileSync } from 'fs';
|
|
import { resolve } from 'path';
|
|
|
|
const { Pool } = pg;
|
|
|
|
// Configuration - Direct WireGuard connection to INFRA VM PostgreSQL
|
|
const config = {
|
|
host: process.env.POSTGRES_HOST || 'infra.agiliton.internal',
|
|
port: 5432,
|
|
database: 'agiliton',
|
|
user: 'agiliton',
|
|
password: 'QtqiwCOAUpQNF6pjzOMAREzUny2bY8V1',
|
|
};
|
|
|
|
async function runMigration(migrationFile) {
|
|
const pool = new Pool(config);
|
|
|
|
try {
|
|
// Read migration SQL
|
|
const sql = readFileSync(resolve(migrationFile), 'utf-8');
|
|
|
|
console.log(`Running migration: ${migrationFile}`);
|
|
console.log('SQL:', sql);
|
|
|
|
// Execute migration
|
|
await pool.query(sql);
|
|
|
|
console.log('Migration completed successfully!');
|
|
} catch (error) {
|
|
console.error('Migration failed:', error);
|
|
process.exit(1);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
// Get migration file from command line
|
|
const migrationFile = process.argv[2];
|
|
if (!migrationFile) {
|
|
console.error('Usage: node run-migration.js <migration-file.sql>');
|
|
process.exit(1);
|
|
}
|
|
|
|
runMigration(migrationFile);
|