6204-fixturesByEnvironment #2
18
myt-push.js
18
myt-push.js
|
@ -151,6 +151,21 @@ class Push extends Command {
|
|||
function isUndoScript(script) {
|
||||
return /\.undo\.sql$/.test(script);
|
||||
}
|
||||
function isOtherEnvScript(script, env) {
|
||||
jgallego marked this conversation as resolved
Outdated
|
||||
const splitScript = script.split('.');
|
||||
const envPart = splitScript[splitScript.length - 2];
|
||||
|
||||
if (splitScript.length <= 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!env) {
|
||||
return !!envPart;
|
||||
}
|
||||
|
||||
return envPart && envPart !== env;
|
||||
}
|
||||
|
||||
|
||||
const skipFiles = new Set([
|
||||
'README.md',
|
||||
|
@ -210,6 +225,9 @@ class Push extends Command {
|
|||
if (isUndoScript(script))
|
||||
continue;
|
||||
|
||||
if (isOtherEnvScript(script, opts.env))
|
||||
continue;
|
||||
|
||||
const [[row]] = await conn.query(
|
||||
`SELECT errorNumber FROM versionLog
|
||||
WHERE code = ?
|
||||
|
|
Loading…
Reference in New Issue
No es necesario declarar una función, el código solo se utiliza una vez
Cierto te paso una propuesta de como queda sin funcion, pero creo que es bastante menos legible