refactor: refs #6202 remove blanks
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-05-09 12:02:44 +02:00
parent 74399d5ab6
commit bf0db89286
1 changed files with 0 additions and 7 deletions

View File

@ -3,23 +3,17 @@ const {spawn} = require('child_process');
function watchDatabaseChanges() {
console.log('Watching for changes in db/routines and db/versions');
fs.watch('db', {recursive: true}, (eventType, filename) => {
if (filename.endsWith('.sql')) {
let command;
if (filename.startsWith('routines')) command = 'push';
else if (filename.startsWith('versions')) command = 'run';
if (command) {
const process = spawn('myt', [command]);
process.stdout.on('data', data => console.log(data.toString()));
process.stderr.on('data', data => console.error(`stderr: ${data}`));
process.on('error', error => console.error(`error: ${error.message}`));
process.on('close', () => console.log('Watching for changes in db/routines and db/versions'));
}
}
@ -27,5 +21,4 @@ function watchDatabaseChanges() {
}
if (require.main === module) watchDatabaseChanges();
module.exports = watchDatabaseChanges;