6204-fixturesByEnvironment #2
22
myt-push.js
22
myt-push.js
|
@ -151,21 +151,6 @@ class Push extends Command {
|
|||
function isUndoScript(script) {
|
||||
return /\.undo\.sql$/.test(script);
|
||||
}
|
||||
function isOtherRealmScript(script, realm) {
|
||||
const splitScript = script.split('.');
|
||||
const realmPart = splitScript[splitScript.length - 2];
|
||||
|
||||
if (splitScript.length <= 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!realm) {
|
||||
return !!realmPart;
|
||||
}
|
||||
|
||||
return realmPart && realmPart !== realm;
|
||||
}
|
||||
|
||||
|
||||
jgallego marked this conversation as resolved
Outdated
|
||||
const skipFiles = new Set([
|
||||
'README.md',
|
||||
|
@ -235,13 +220,12 @@ class Push extends Command {
|
|||
continue;
|
||||
|
||||
if (match[1]) {
|
||||
if (skipRealm) {
|
||||
if (skipRealm)
|
||||
jgallego marked this conversation as resolved
Outdated
juan
commented
`/^[0-9]{2}-[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)?\.sql$/`
juan
commented
```
const match = script.match(/^[0-9]{2}-[a-zA-Z0-9_]+(?:\.(?!undo)([a-zA-Z0-9_]+))?(?:\.undo)?\.sql$/);
const skipRealm = match[1] && match[1] !== realm;
```
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!realm) {
|
||||
if (!realm)
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
const [[row]] = await conn.query(
|
||||
`SELECT errorNumber FROM versionLog
|
||||
|
|
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