- Remove .bmad-core/ and web-bundles/ (AI tool configs) - Remove tmp-home/ directories and cache files - Move test scripts to scripts/ directory - Move design file to docs/ directory - Remove duplicate AGENTS.md (content in CLAUDE.md) - Remove duplicate sample-app-config.toml - Update .gitignore with missing entries - Fix hardcoded credentials in check-migrations.js - Update IMPLEMENTATION_SUMMARY.md date 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
const { Client } = require('pg');
|
|
|
|
async function checkMigrations() {
|
|
const connectionString = process.env.DATABASE_URL;
|
|
if (!connectionString) {
|
|
console.error('Error: DATABASE_URL environment variable is not set');
|
|
console.log('Usage: DATABASE_URL=postgresql://user:pass@host:port/db node check-migrations.js');
|
|
process.exit(1);
|
|
}
|
|
|
|
const client = new Client({ connectionString });
|
|
|
|
try {
|
|
await client.connect();
|
|
console.log('Connected to database');
|
|
|
|
// Check existing migrations
|
|
const result = await client.query(
|
|
'SELECT * FROM pgmigrations ORDER BY run_on'
|
|
);
|
|
|
|
console.log('Existing migrations:');
|
|
result.rows.forEach(row => console.log(` - ${row.name} (run on ${row.run_on})`));
|
|
|
|
// Mark missing migrations as complete
|
|
const migrations = [
|
|
'1754714100000_create-camera-management-tables',
|
|
'1754714200000_create-weather-tables',
|
|
'1754714300000_create-subscription-tables',
|
|
'1755011659504_add-missing-device-columns'
|
|
];
|
|
|
|
for (const migration of migrations) {
|
|
const exists = result.rows.some(row => row.name === migration);
|
|
if (\!exists) {
|
|
await client.query(
|
|
'INSERT INTO pgmigrations (name, run_on) VALUES ($1, NOW())',
|
|
[migration]
|
|
);
|
|
console.log(`Added migration ${migration}`);
|
|
} else {
|
|
console.log(`Migration ${migration} already exists`);
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
await client.end();
|
|
console.log('Disconnected from database');
|
|
}
|
|
}
|
|
|
|
checkMigrations();
|