-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.js
More file actions
35 lines (30 loc) · 1.15 KB
/
setup.js
File metadata and controls
35 lines (30 loc) · 1.15 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
import { execSync } from 'child_process';
import { existsSync, mkdirSync } from 'fs';
import { join } from 'path';
console.log('🔧 Setting up ORM Benchmarking Environment...');
// Create databases directory if it doesn't exist
const databasesDir = join(process.cwd(), 'databases');
if (!existsSync(databasesDir)) {
mkdirSync(databasesDir, { recursive: true });
console.log('✅ Created databases directory');
}
// Generate Prisma client
try {
console.log('📦 Generating Prisma client...');
execSync('npx prisma generate', { stdio: 'inherit' });
console.log('✅ Prisma client generated successfully');
} catch (error) {
console.error('❌ Failed to generate Prisma client:', error.message);
process.exit(1);
}
// Push Prisma schema to database
try {
console.log('🗄️ Setting up Prisma database...');
execSync('npx prisma db push', { stdio: 'inherit' });
console.log('✅ Prisma database setup completed');
} catch (error) {
console.error('❌ Failed to setup Prisma database:', error.message);
process.exit(1);
}
console.log('\n🎉 Setup completed successfully!');
console.log('You can now run the benchmark with: npm run benchmark');