Compare commits

..

No commits in common. "6758-realms" and "master" have entirely different histories.

6 changed files with 9 additions and 1361 deletions

View File

@ -191,23 +191,6 @@ You can create your local fixture and structure files.
* *dump/fixtures.after.sql*
* *dump/fixtures.local.sql*
### Realms
You can create your local realms folders.
```text
dump
`- realms
|- marvel
| `- 00-spiderman.sql
| `- 01-hulk.sql
`- dc
`- 00-superman.sql
`- 01-batman.sql
`- 02-wonder_woman.sql
`- 03-flash.sql
```
## Versioning commands
### init
@ -296,7 +279,7 @@ Builds and starts local database server container. It only rebuilds the image
when dump have been modified.
```text
$ myt run [-c|--ci] [-r|--random] [-t|--tmpfs] [-n|--network <string>] [--realm <string>]
$ myt run [-c|--ci] [-r|--random] [-t|--tmpfs] [-n|--network <string>]
```
### start

View File

@ -47,7 +47,6 @@ class Run extends Command {
waitingDb: 'Waiting for MySQL init process.',
mockingDate: 'Mocking date functions.',
applyingFixtures: 'Applying fixtures.',
applyingRealms: (realm) => console.log(`Applying '${realm}' realm fixtures.`),
creatingTriggers: 'Creating triggers.'
};
@ -186,19 +185,11 @@ class Run extends Command {
]
for (const file of fixturesFiles) {
if (!await fs.exists(`${dumpDir}/${file}.sql`)) continue;
await execFile(`dump/${file}`)
}
// Apply realms
if(opts.realm) {
this.emit('applyingRealms', opts.realm);
const realmDir = `realms/${opts.realm}`;
let realmFiles = await fs.readdir(`${dumpDir}/${realmDir}`);
realmFiles = realmFiles.map(file => path.parse(file).name);
for (const file of realmFiles) {
await execFile(`${realmDir}/${file}`)
}
await ct.exec(null, 'docker-import.sh',
[`/workspace/dump/${file}`],
'spawn',
true
);
}
// Create triggers
@ -225,14 +216,6 @@ class Run extends Command {
} catch (e) {}
throw err;
}
async function execFile(path){
await ct.exec(null, 'docker-import.sh',
[`/workspace/${path}` ],
'spawn',
true
);
}
}
}

3
myt.js
View File

@ -21,8 +21,7 @@ class Myt {
workspace: 'The base directory of the project',
debug: 'Whether to enable debug mode',
version: 'Display the version number and exit',
help: 'Display this help message',
realm: 'Name of fixture realm to use',
help: 'Display this help message'
}
};

View File

@ -1,6 +1,6 @@
{
"name": "@verdnatura/myt",
"version": "1.6.14",
"version": "1.6.13",
"author": "Verdnatura Levante SL",
"description": "MySQL version control",
"license": "GPL-3.0",

File diff suppressed because it is too large Load Diff

View File

@ -12,4 +12,3 @@ RUN echo "[LOG] Import finished." \
&& rm -rf dump
COPY fixtures.*.sql dump/
COPY realms realms/