commit
32a36cceff
444 files changed
+67186
No files matched your search
@@ -0,0 +1,29 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { query } = require('./db');
|
||||
|
||||
async function runMigration() {
|
||||
try {
|
||||
const migrationPath = path.join(
|
||||
__dirname,
|
||||
'migrations',
|
||||
'add_chicken_count_and_population.sql'
|
||||
);
|
||||
const sql = fs.readFileSync(migrationPath, 'utf8');
|
||||
|
||||
// Split by semicolon and execute each statement
|
||||
const statements = sql.split(';').filter((stmt) => stmt.trim());
|
||||
|
||||
for (const statement of statements) {
|
||||
if (statement.trim()) {
|
||||
await query(statement);
|
||||
}
|
||||
}
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('Migration failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
runMigration();
|
||||
Reference in new issue
Block a user