push command fix: apply views at the end
This commit is contained in:
parent
9bf7b8f450
commit
a8a9aac536
25
myt-push.js
25
myt-push.js
|
@ -267,8 +267,7 @@ class Push extends Command {
|
||||||
const gitExists = await fs.pathExists(`${opts.workspace}/.git`);
|
const gitExists = await fs.pathExists(`${opts.workspace}/.git`);
|
||||||
|
|
||||||
let nRoutines = 0;
|
let nRoutines = 0;
|
||||||
let changes = await this.changedRoutines(version.gitCommit);
|
const changes = await this.changedRoutines(version.gitCommit);
|
||||||
changes = this.parseChanges(changes);
|
|
||||||
|
|
||||||
const routines = [];
|
const routines = [];
|
||||||
for (const change of changes)
|
for (const change of changes)
|
||||||
|
@ -397,14 +396,6 @@ class Push extends Command {
|
||||||
await pushConn.end();
|
await pushConn.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
parseChanges(changes) {
|
|
||||||
const routines = [];
|
|
||||||
if (changes)
|
|
||||||
for (const change of changes)
|
|
||||||
routines.push(new Routine(change));
|
|
||||||
return routines;
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateVersion(column, value) {
|
async updateVersion(column, value) {
|
||||||
column = SqlString.escapeId(column, true);
|
column = SqlString.escapeId(column, true);
|
||||||
await this.conn.query(
|
await this.conn.query(
|
||||||
|
@ -478,9 +469,21 @@ class Push extends Command {
|
||||||
await pushChanges(await repoExt.getUnstaged(repo));
|
await pushChanges(await repoExt.getUnstaged(repo));
|
||||||
await pushChanges(await repoExt.getStaged(repo));
|
await pushChanges(await repoExt.getStaged(repo));
|
||||||
|
|
||||||
return changes.sort((a, b) => {
|
const routines = [];
|
||||||
|
for (const change of changes)
|
||||||
|
routines.push(new Routine(change));
|
||||||
|
|
||||||
|
return routines.sort((a, b) => {
|
||||||
if (b.mark != a.mark)
|
if (b.mark != a.mark)
|
||||||
return b.mark == '-' ? 1 : -1;
|
return b.mark == '-' ? 1 : -1;
|
||||||
|
|
||||||
|
if (b.type.name !== a.type.name) {
|
||||||
|
if (b.type.name == 'VIEW')
|
||||||
|
return -1;
|
||||||
|
if (a.type.name == 'VIEW')
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return a.path.localeCompare(b.path);
|
return a.path.localeCompare(b.path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.5.13",
|
"version": "1.5.14",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.5.13",
|
"version": "1.5.14",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sqltools/formatter": "^1.2.5",
|
"@sqltools/formatter": "^1.2.5",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.5.13",
|
"version": "1.5.14",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "MySQL version control",
|
"description": "MySQL version control",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue