forked from khaoss85/mcp-orchestro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapply_migration_012.mjs
More file actions
54 lines (43 loc) · 1.4 KB
/
apply_migration_012.mjs
File metadata and controls
54 lines (43 loc) · 1.4 KB
1
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
49
50
51
52
53
54
#!/usr/bin/env node
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { readFileSync } from 'fs';
async function applyMigration() {
console.log('📦 Applying Migration 012: Project Configuration System\n');
const transport = new StdioClientTransport({
command: 'node',
args: ['dist/server.js'],
});
const client = new Client(
{
name: 'migration-client',
version: '1.0.0',
},
{
capabilities: {},
}
);
try {
await client.connect(transport);
console.log('✅ Connected to MCP server\n');
// Read migration file
const migrationSQL = readFileSync('src/db/migrations/012_project_configuration_system.sql', 'utf-8');
console.log('🔄 Applying migration 012...');
// Note: We need to use execute_sql directly since apply_migration expects a name
// For this complex migration, we'll execute it directly
const result = await client.callTool({
name: 'execute_sql',
arguments: {
query: migrationSQL
},
});
console.log('✅ Migration 012 applied successfully!\n');
console.log('Result:', JSON.parse(result.content[0].text));
} catch (error) {
console.error('❌ Migration failed:', error);
} finally {
await client.close();
process.exit(0);
}
}
applyMigration().catch(console.error);