Compare commits
No commits in common. "6758-realms" and "master" have entirely different histories.
6758-realm
...
master
19
README.md
19
README.md
|
@ -191,23 +191,6 @@ You can create your local fixture and structure files.
|
||||||
* *dump/fixtures.after.sql*
|
* *dump/fixtures.after.sql*
|
||||||
* *dump/fixtures.local.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
|
## Versioning commands
|
||||||
|
|
||||||
### init
|
### init
|
||||||
|
@ -296,7 +279,7 @@ Builds and starts local database server container. It only rebuilds the image
|
||||||
when dump have been modified.
|
when dump have been modified.
|
||||||
|
|
||||||
```text
|
```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
|
### start
|
||||||
|
|
27
myt-run.js
27
myt-run.js
|
@ -47,7 +47,6 @@ class Run extends Command {
|
||||||
waitingDb: 'Waiting for MySQL init process.',
|
waitingDb: 'Waiting for MySQL init process.',
|
||||||
mockingDate: 'Mocking date functions.',
|
mockingDate: 'Mocking date functions.',
|
||||||
applyingFixtures: 'Applying fixtures.',
|
applyingFixtures: 'Applying fixtures.',
|
||||||
applyingRealms: (realm) => console.log(`Applying '${realm}' realm fixtures.`),
|
|
||||||
creatingTriggers: 'Creating triggers.'
|
creatingTriggers: 'Creating triggers.'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -186,19 +185,11 @@ class Run extends Command {
|
||||||
]
|
]
|
||||||
for (const file of fixturesFiles) {
|
for (const file of fixturesFiles) {
|
||||||
if (!await fs.exists(`${dumpDir}/${file}.sql`)) continue;
|
if (!await fs.exists(`${dumpDir}/${file}.sql`)) continue;
|
||||||
await execFile(`dump/${file}`)
|
await ct.exec(null, 'docker-import.sh',
|
||||||
}
|
[`/workspace/dump/${file}`],
|
||||||
|
'spawn',
|
||||||
// Apply realms
|
true
|
||||||
|
);
|
||||||
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}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create triggers
|
// Create triggers
|
||||||
|
@ -225,14 +216,6 @@ class Run extends Command {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function execFile(path){
|
|
||||||
await ct.exec(null, 'docker-import.sh',
|
|
||||||
[`/workspace/${path}` ],
|
|
||||||
'spawn',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
myt.js
3
myt.js
|
@ -21,8 +21,7 @@ class Myt {
|
||||||
workspace: 'The base directory of the project',
|
workspace: 'The base directory of the project',
|
||||||
debug: 'Whether to enable debug mode',
|
debug: 'Whether to enable debug mode',
|
||||||
version: 'Display the version number and exit',
|
version: 'Display the version number and exit',
|
||||||
help: 'Display this help message',
|
help: 'Display this help message'
|
||||||
realm: 'Name of fixture realm to use',
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.6.14",
|
"version": "1.6.13",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "MySQL version control",
|
"description": "MySQL version control",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
1316
pnpm-lock.yaml
1316
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -12,4 +12,3 @@ RUN echo "[LOG] Import finished." \
|
||||||
&& rm -rf dump
|
&& rm -rf dump
|
||||||
|
|
||||||
COPY fixtures.*.sql dump/
|
COPY fixtures.*.sql dump/
|
||||||
COPY realms realms/
|
|
||||||
|
|
Loading…
Reference in New Issue