diff --git a/README.md b/README.md index 4d5087a..d87fff8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MyVC (MySQL Version Control) +# Myt - MySQL and MariaDB version control using Git Utilities to ease the maintenance of MySQL or MariaDB database versioning using a Git repository. @@ -16,23 +16,23 @@ development, so any help is welcomed! Feel free to contribute. It's recommended to install the package globally. ```text -# npm install -g myvc -$ myvc +# npm install -g myt +$ myt ``` You can also install locally and use the *npx* command to execute it. ```text -$ npm install myvc -$ npx myvc +$ npm install myt +$ npx myt ``` ## How to use -Execute *myvc* with the desired command. +Execute *myt* with the desired command. ```text -$ [npx] myvc [-w|--workspace ] [-r|--remote ] [-d|--debug] +$ [npx] myt [-w|--workspace ] [-r|--remote ] [-d|--debug] [-h|--help] [] ``` @@ -60,10 +60,10 @@ Each command can have its own specific commandline options. First of all you have to initalize the workspace. ```text -$ myvc init +$ myt init ``` -Now you can configure MyVC using *myvc.config.yml* file, located at the root of +Now you can configure Myt using *myt.config.yml* file, located at the root of your workspace. This file should include the project codename and schemas/tables wich are exported when you use *pull* or *dump* commands. @@ -88,7 +88,7 @@ Once the basic configuration is done, routines can be imported from the database into the project, it is recommended to use the *production* remote. ```text -$ myvc pull production +$ myt pull production ``` From now on, you can use the project as if it were a standard git repository @@ -96,7 +96,7 @@ From now on, you can use the project as if it were a standard git repository desired remote. ```text -$ myvc push [] [--commit] +$ myt push [] [--commit] ``` ### Routines @@ -157,7 +157,7 @@ You can create your local fixture and structure files. Initializes an empty workspace. ```text -$ myvc init +$ myt init ``` ### pull @@ -165,7 +165,7 @@ $ myvc init Incorporates database routine changes into workspace. ```text -$ myvc pull [remote] [-f|--force] [-c|--checkout] [-u|--update] [-s|--sums] +$ myt pull [remote] [-f|--force] [-c|--checkout] [-u|--update] [-s|--sums] ``` When *--checkout* option is provided, it does the following before export: @@ -178,7 +178,7 @@ When *--checkout* option is provided, it does the following before export: Applies versions and routine changes into database. ```text -$ myvc push [] [-f|--force] [-c|--commit] [-s|--sums] +$ myt push [] [-f|--force] [-c|--commit] [-s|--sums] ``` Commit is saved into database only if *--commit* option is provided, it @@ -192,7 +192,7 @@ Creates a new version folder, when name is not specified it generates a random name mixing a color with a plant name. ```text -$ myvc version [] +$ myt version [] ``` ### clean @@ -200,7 +200,7 @@ $ myvc version [] Cleans all already applied versions older than *maxOldVersions*. ```text -$ myvc clean +$ myt clean ``` ## Local server commands @@ -211,7 +211,7 @@ Exports database structure and fixtures from remote into hidden files located in *dump* folder. If no remote is specified *production* is used. ```text -$ myvc dump [] +$ myt dump [] ``` ### fixtures @@ -220,7 +220,7 @@ Exports local database fixtures into *dump/fixtures.sql* files. If no remote is specified *local* is used. ```text -$ myvc fixtures [] +$ myt fixtures [] ``` ### run @@ -230,7 +230,7 @@ when fixtures have been modified or when the day on which the image was built is different to today. ```text -$ myvc run [-c|--ci] [-r|--random] +$ myt run [-c|--ci] [-r|--random] ``` ### start @@ -241,7 +241,7 @@ mind that when you do not rebuild the docker you may be using an outdated version of it. ```text -$ myvc start +$ myt start ``` ## Why diff --git a/assets/myvc.default.yml b/assets/myvc.default.yml index a567116..f02ea72 100755 --- a/assets/myvc.default.yml +++ b/assets/myvc.default.yml @@ -1,9 +1,9 @@ -versionSchema: myvc +versionSchema: myt versionDigits: 5 maxOldVersions: 30 schemas: - - myvc + - myt fixtures: - myvc: + myt: - version - versionLog diff --git a/cli.js b/cli.js index 7d4a369..e64eff7 100755 --- a/cli.js +++ b/cli.js @@ -1,4 +1,4 @@ #!/usr/bin/env node -const MyVC = require('./myvc'); -new MyVC().run(); +const Myt = require('./myt'); +new Myt().run(); diff --git a/lib/command.js b/lib/command.js index fe9dfbb..2dd0e6d 100644 --- a/lib/command.js +++ b/lib/command.js @@ -1,7 +1,7 @@ /** - * Base class for MyVC commands. + * Base class for Myt commands. */ -module.exports = class MyVCCommand { +module.exports = class MytCommand { get usage() { return {}; } @@ -10,7 +10,7 @@ module.exports = class MyVCCommand { return {}; } - async run(myvc, opts) { + async run(myt, opts) { throw new Error('run command not defined'); } } diff --git a/lib/exporter-engine.js b/lib/exporter-engine.js index 8a2dbe1..2c996c0 100644 --- a/lib/exporter-engine.js +++ b/lib/exporter-engine.js @@ -4,9 +4,9 @@ const fs = require('fs-extra'); const Exporter = require('./exporter'); module.exports = class ExporterEngine { - constructor(conn, myvcDir) { + constructor(conn, mytDir) { this.conn = conn; - this.pullFile = `${myvcDir}/.pullinfo.json`; + this.pullFile = `${mytDir}/.pullinfo.json`; this.exporters = []; this.exporterMap = {}; } diff --git a/myvc-clean.js b/myt-clean.js similarity index 82% rename from myvc-clean.js rename to myt-clean.js index d0eb9c1..7382db8 100644 --- a/myvc-clean.js +++ b/myt-clean.js @@ -1,5 +1,5 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const fs = require('fs-extra'); @@ -17,15 +17,15 @@ class Clean extends Command { } }; - async run(myvc, opts) { - await myvc.dbConnect(); - const version = await myvc.fetchDbVersion() || {}; + async run(myt, opts) { + await myt.dbConnect(); + const version = await myt.fetchDbVersion() || {}; const number = version.number; const oldVersions = []; const versionDirs = await fs.readdir(opts.versionsDir); for (const versionDir of versionDirs) { - const dirVersion = myvc.parseVersionDir(versionDir); + const dirVersion = myt.parseVersionDir(versionDir); if (!dirVersion) continue; if (parseInt(dirVersion.number) < parseInt(number)) @@ -49,4 +49,4 @@ class Clean extends Command { module.exports = Clean; if (require.main === module) - new MyVC().run(Clean); + new Myt().run(Clean); diff --git a/myvc-dump.js b/myt-dump.js similarity index 77% rename from myvc-dump.js rename to myt-dump.js index 3c8adfa..5fc05af 100644 --- a/myvc-dump.js +++ b/myt-dump.js @@ -1,8 +1,7 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const fs = require('fs-extra'); -const path = require('path'); class Dump extends Command { static usage = { @@ -16,8 +15,8 @@ class Dump extends Command { } }; - async run(myvc, opts) { - const dumpStream = await myvc.initDump('.dump.sql'); + async run(myt, opts) { + const dumpStream = await myt.initDump('.dump.sql'); console.log('Dumping structure.'); let dumpArgs = [ @@ -30,10 +29,10 @@ class Dump extends Command { '--databases' ]; dumpArgs = dumpArgs.concat(opts.schemas); - await myvc.runDump('docker-dump.sh', dumpArgs, dumpStream); + await myt.runDump('docker-dump.sh', dumpArgs, dumpStream); console.log('Dumping fixtures.'); - await myvc.dumpFixtures(dumpStream, opts.fixtures); + await myt.dumpFixtures(dumpStream, opts.fixtures); console.log('Dumping privileges.'); const privs = opts.privileges; @@ -48,14 +47,14 @@ class Dump extends Command { args = args.concat(['mysql'], privs.tables); await dumpStream.write('USE `mysql`;\n', 'utf8'); - await myvc.runDump('mysqldump', args, dumpStream); + await myt.runDump('mysqldump', args, dumpStream); } await dumpStream.end(); console.log('Saving version.'); - await myvc.dbConnect(); - const version = await myvc.fetchDbVersion(); + await myt.dbConnect(); + const version = await myt.fetchDbVersion(); if (version) { await fs.writeFile( `${opts.dumpDir}/.dump.json`, @@ -68,5 +67,5 @@ class Dump extends Command { module.exports = Dump; if (require.main === module) - new MyVC().run(Dump); + new Myt().run(Dump); diff --git a/myvc-fixtures.js b/myt-fixtures.js similarity index 62% rename from myvc-fixtures.js rename to myt-fixtures.js index 49f532c..74009c6 100644 --- a/myvc-fixtures.js +++ b/myt-fixtures.js @@ -1,5 +1,5 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); class Fixtures extends Command { @@ -14,9 +14,9 @@ class Fixtures extends Command { } }; - async run(myvc, opts) { - const dumpStream = await myvc.initDump('fixtures.sql'); - await myvc.dumpFixtures(dumpStream, opts.localFixtures, true); + async run(myt, opts) { + const dumpStream = await myt.initDump('fixtures.sql'); + await myt.dumpFixtures(dumpStream, opts.localFixtures, true); await dumpStream.end(); } } @@ -24,5 +24,5 @@ class Fixtures extends Command { module.exports = Fixtures; if (require.main === module) - new MyVC().run(Fixtures); + new Myt().run(Fixtures); diff --git a/myvc-init.js b/myt-init.js similarity index 78% rename from myvc-init.js rename to myt-init.js index 561a8e7..73f9101 100755 --- a/myvc-init.js +++ b/myt-init.js @@ -1,5 +1,5 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const fs = require('fs-extra'); @@ -8,11 +8,11 @@ class Init extends Command { description: 'Initialize an empty workspace' }; - async run(myvc, opts) { + async run(myt, opts) { const templateDir = `${__dirname}/template`; const templates = await fs.readdir(templateDir); for (let template of templates) { - const dst = `${opts.myvcDir}/${template}`; + const dst = `${opts.mytDir}/${template}`; if (!await fs.pathExists(dst)) await fs.copy(`${templateDir}/${template}`, dst); } @@ -22,4 +22,4 @@ class Init extends Command { module.exports = Init; if (require.main === module) - new MyVC().run(Init); + new Myt().run(Init); diff --git a/myvc-pull.js b/myt-pull.js similarity index 86% rename from myvc-pull.js rename to myt-pull.js index d55fdb1..e139cc1 100755 --- a/myvc-pull.js +++ b/myt-pull.js @@ -1,9 +1,10 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const fs = require('fs-extra'); const nodegit = require('nodegit'); const ExporterEngine = require('./lib/exporter-engine'); + class Pull extends Command { static usage = { description: 'Incorporate database routine changes into workspace', @@ -31,9 +32,9 @@ class Pull extends Command { ] }; - async run(myvc, opts) { - const conn = await myvc.dbConnect(); - const repo = await myvc.openRepo(); + async run(myt, opts) { + const conn = await myt.dbConnect(); + const repo = await myt.openRepo(); if (!opts.force) { async function hasChanges(diff) { @@ -51,14 +52,14 @@ class Pull extends Command { // Check for unstaged changes - const unstagedDiff = await myvc.getUnstaged(repo); + const unstagedDiff = await myt.getUnstaged(repo); if (await hasChanges(unstagedDiff)) throw new Error('You have unstaged changes, save them before pull'); // Check for staged changes - const stagedDiff = await myvc.getStaged(repo); + const stagedDiff = await myt.getStaged(repo); if (await hasChanges(stagedDiff)) throw new Error('You have staged changes, save them before pull'); @@ -67,15 +68,15 @@ class Pull extends Command { // Checkout to remote commit if (opts.checkout) { - const version = await myvc.fetchDbVersion(); + const version = await myt.fetchDbVersion(); if (version && version.gitCommit) { const now = parseInt(new Date().toJSON()); - const branchName = `myvc-pull_${now}`; + const branchName = `myt-pull_${now}`; console.log(`Creating branch '${branchName}' from database commit.`); const commit = await repo.getCommit(version.gitCommit); const branch = await nodegit.Branch.create(repo, - `myvc-pull_${now}`, commit, () => {}); + `myt-pull_${now}`, commit, () => {}); await repo.checkoutBranch(branch); } } @@ -84,7 +85,7 @@ class Pull extends Command { console.log(`Incorporating routine changes.`); - const engine = new ExporterEngine(conn, opts.myvcDir); + const engine = new ExporterEngine(conn, opts.mytDir); await engine.init(); const shaSums = engine.shaSums; @@ -125,4 +126,4 @@ class Pull extends Command { module.exports = Pull; if (require.main === module) - new MyVC().run(Pull); + new Myt().run(Pull); diff --git a/myvc-push.js b/myt-push.js similarity index 94% rename from myvc-push.js rename to myt-push.js index 42d2929..57db880 100644 --- a/myvc-push.js +++ b/myt-push.js @@ -1,5 +1,5 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const fs = require('fs-extra'); const nodegit = require('nodegit'); @@ -32,8 +32,8 @@ class Push extends Command { ] }; - async run(myvc, opts) { - const conn = await myvc.dbConnect(); + async run(myt, opts) { + const conn = await myt.dbConnect(); this.conn = conn; if (opts.remote == 'local') @@ -42,14 +42,14 @@ class Push extends Command { // Obtain exclusive lock const [[row]] = await conn.query( - `SELECT GET_LOCK('myvc_push', 30) getLock`); + `SELECT GET_LOCK('myt_push', 30) getLock`); if (!row.getLock) { let isUsed = 0; if (row.getLock == 0) { const [[row]] = await conn.query( - `SELECT IS_USED_LOCK('myvc_push') isUsed`); + `SELECT IS_USED_LOCK('myt_push') isUsed`); isUsed = row.isUsed; } @@ -57,11 +57,11 @@ class Push extends Command { } async function releaseLock() { - await conn.query(`DO RELEASE_LOCK('myvc_push')`); + await conn.query(`DO RELEASE_LOCK('myt_push')`); } try { - await this.push(myvc, opts, conn); + await this.push(myt, opts, conn); } catch(err) { try { await releaseLock(); @@ -74,12 +74,12 @@ class Push extends Command { await releaseLock(); } - async push(myvc, opts, conn) { - const pushConn = await myvc.createConnection(); + async push(myt, opts, conn) { + const pushConn = await myt.createConnection(); // Get database version - const version = await myvc.fetchDbVersion() || {}; + const version = await myt.fetchDbVersion() || {}; console.log( `Database information:` @@ -148,7 +148,7 @@ class Push extends Command { if (versionDir == 'README.md') continue; - const dirVersion = myvc.parseVersionDir(versionDir); + const dirVersion = myt.parseVersionDir(versionDir); if (!dirVersion) { logVersion('[?????]'.yellow, versionDir, `Wrong directory name.` @@ -214,7 +214,7 @@ class Push extends Command { let err; try { - await myvc.queryFromFile(pushConn, + await myt.queryFromFile(pushConn, `${scriptsDir}/${script}`); } catch (e) { err = e; @@ -258,7 +258,7 @@ class Push extends Command { const gitExists = await fs.pathExists(`${opts.workspace}/.git`); let nRoutines = 0; - let changes = await myvc.changedRoutines(version.gitCommit); + let changes = await myt.changedRoutines(version.gitCommit); changes = this.parseChanges(changes); const routines = []; @@ -283,7 +283,7 @@ class Push extends Command { ); } - const engine = new ExporterEngine(conn, opts.myvcDir); + const engine = new ExporterEngine(conn, opts.mytDir); await engine.init(); async function finalize() { @@ -328,7 +328,7 @@ class Push extends Command { if (change.type.name === 'VIEW') await pushConn.query(`USE ${scapedSchema}`); - await myvc.multiQuery(pushConn, newSql); + await myt.multiQuery(pushConn, newSql); if (change.isRoutine) { await conn.query( @@ -472,4 +472,4 @@ class Routine { module.exports = Push; if (require.main === module) - new MyVC().run(Push); + new Myt().run(Push); diff --git a/myvc-run.js b/myt-run.js similarity index 90% rename from myvc-run.js rename to myt-run.js index b2512d1..fb4a166 100644 --- a/myvc-run.js +++ b/myt-run.js @@ -1,7 +1,7 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); -const Push = require('./myvc-push'); +const Push = require('./myt-push'); const docker = require('./lib/docker'); const fs = require('fs-extra'); const path = require('path'); @@ -33,7 +33,7 @@ class Run extends Command { ] }; - async run(myvc, opts) { + async run(myt, opts) { const dumpDir = opts.dumpDir; const serverDir = path.join(__dirname, 'server'); @@ -47,14 +47,14 @@ class Run extends Command { serverDockerfile = path.join(serverDir, 'Dockerfile.base'); await docker.build(__dirname, { - tag: 'myvc/base', + tag: 'myt/base', file: serverDockerfile }, opts.debug); - // Build myvc server image + // Build myt server image await docker.build(__dirname, { - tag: 'myvc/server', + tag: 'myt/server', file: path.join(serverDir, 'Dockerfile.server') }, opts.debug); @@ -67,7 +67,7 @@ class Run extends Command { const day = pad(today.getDate()); const stamp = `${year}-${month}-${day}`; - await docker.build(opts.myvcDir, { + await docker.build(opts.mytDir, { tag: opts.code, file: path.join(serverDir, 'Dockerfile.dump'), buildArg: `STAMP=${stamp}` @@ -127,7 +127,7 @@ class Run extends Command { commit: true, dbConfig }); - await myvc.runCommand(Push, opts); + await myt.runCommand(Push, opts); // Apply fixtures @@ -138,7 +138,7 @@ class Run extends Command { // Create triggers console.log('Creating triggers.'); - const conn = await myvc.createConnection(); + const conn = await myt.createConnection(); for (const schema of opts.schemas) { const triggersPath = `${opts.routinesDir}/${schema}/triggers`; @@ -147,7 +147,7 @@ class Run extends Command { const triggersDir = await fs.readdir(triggersPath); for (const triggerFile of triggersDir) - await myvc.queryFromFile(conn, `${triggersPath}/${triggerFile}`); + await myt.queryFromFile(conn, `${triggersPath}/${triggerFile}`); } return server; @@ -157,4 +157,4 @@ class Run extends Command { module.exports = Run; if (require.main === module) - new MyVC().run(Run); + new Myt().run(Run); diff --git a/myvc-start.js b/myt-start.js similarity index 87% rename from myvc-start.js rename to myt-start.js index 16617c6..9d13ba4 100644 --- a/myvc-start.js +++ b/myt-start.js @@ -1,9 +1,9 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const Container = require('./lib/docker').Container; const Server = require('./lib/server'); -const Run = require('./myvc-run'); +const Run = require('./myt-run'); /** * Does the minium effort to start the database container, if it doesn't @@ -16,7 +16,7 @@ class Start extends Command { description: 'Start local database server container' }; - async run(myvc, opts) { + async run(myt, opts) { const ct = new Container(opts.code); let status; @@ -26,7 +26,7 @@ class Start extends Command { }); } catch (err) { const run = new Run() - return await run.run(myvc, opts); + return await run.run(myt, opts); } switch (status) { @@ -48,4 +48,4 @@ class Start extends Command { module.exports = Start; if (require.main === module) - new MyVC().run(Start); + new Myt().run(Start); diff --git a/myvc-version.js b/myt-version.js similarity index 96% rename from myvc-version.js rename to myt-version.js index 5044697..34b9551 100644 --- a/myvc-version.js +++ b/myt-version.js @@ -1,5 +1,5 @@ -const MyVC = require('./myvc'); +const Myt = require('./myt'); const Command = require('./lib/command'); const fs = require('fs-extra'); @@ -27,12 +27,12 @@ class Version extends Command { } }; - async run(myvc, opts) { + async run(myt, opts) { let newVersionDir; // Fetch last version number - const conn = await myvc.dbConnect(); + const conn = await myt.dbConnect(); try { await conn.query('START TRANSACTION'); @@ -75,7 +75,7 @@ class Version extends Command { const versionNames = new Set(); const versionDirs = await fs.readdir(opts.versionsDir); for (const versionDir of versionDirs) { - const dirVersion = myvc.parseVersionDir(versionDir); + const dirVersion = myt.parseVersionDir(versionDir); if (!dirVersion) continue; versionNames.add(dirVersion.name); } @@ -216,4 +216,4 @@ const plants = [ module.exports = Version; if (require.main === module) - new MyVC().run(Version); + new Myt().run(Version); diff --git a/myvc.js b/myt.js similarity index 93% rename from myvc.js rename to myt.js index cb20b94..bac2ff0 100755 --- a/myvc.js +++ b/myt.js @@ -13,7 +13,7 @@ const camelToSnake = require('./lib/util').camelToSnake; const docker = require('./lib/docker'); const Command = require('./lib/command'); -class MyVC { +class Myt { get usage() { return { description: 'Utility for database versioning', @@ -51,7 +51,7 @@ class MyVC { async run(CommandClass) { console.log( - 'MyVC (MySQL Version Control)'.green, + 'Myt'.green, `v${packageJson.version}`.magenta ); @@ -72,7 +72,7 @@ class MyVC { if (!/^[a-z]+$/.test(commandName)) throw new Error (`Invalid command name '${commandName}'`); - const commandFile = path.join(__dirname, `myvc-${commandName}.js`); + const commandFile = path.join(__dirname, `myt-${commandName}.js`); if (!await fs.pathExists(commandFile)) throw new Error (`Unknown command '${commandName}'`); @@ -126,7 +126,7 @@ class MyVC { try { depVersion = wsPackageJson .dependencies - .myvc.match(versionRegex); + .myt.match(versionRegex); } catch (e) {} } @@ -137,11 +137,11 @@ class MyVC { depVersion[1] === myVersion[1] && depVersion[2] === myVersion[2]; if (!isSameVersion) - throw new Error(`MyVC version differs a lot from package.json, please run 'npm i' first to install the proper version.`); + throw new Error(`Myt version differs a lot from package.json, please run 'npm i' first to install the proper version.`); const isSameMinor = depVersion[3] === myVersion[3]; if (!isSameMinor) - console.warn(`Warning! MyVC minor version differs from package.json, maybe you shoud run 'npm i' to install the proper version.`.yellow); + console.warn(`Warning! Myt minor version differs from package.json, maybe you shoud run 'npm i' to install the proper version.`.yellow); } // Load method @@ -178,9 +178,9 @@ class MyVC { async load(opts) { // Configuration file - const config = require(`${__dirname}/assets/myvc.default.yml`); + const config = require(`${__dirname}/assets/myt.default.yml`); - const configFile = 'myvc.config.yml'; + const configFile = 'myt.config.yml'; const configPath = path.join(opts.workspace, configFile); if (await fs.pathExists(configPath)) Object.assign(config, require(configPath)); @@ -188,12 +188,12 @@ class MyVC { Object.assign(opts, config); opts.configFile = configFile; - if (!opts.myvcDir) - opts.myvcDir = path.join(opts.workspace, opts.subdir || ''); + if (!opts.mytDir) + opts.mytDir = path.join(opts.workspace, opts.subdir || ''); - opts.routinesDir = path.join(opts.myvcDir, 'routines'); - opts.versionsDir = path.join(opts.myvcDir, 'versions'); - opts.dumpDir = path.join(opts.myvcDir, 'dump'); + opts.routinesDir = path.join(opts.mytDir, 'routines'); + opts.versionsDir = path.join(opts.mytDir, 'versions'); + opts.dumpDir = path.join(opts.mytDir, 'dump'); // Database configuration @@ -201,7 +201,7 @@ class MyVC { let iniFile = 'db.ini'; if (opts.remote) { - iniDir = `${opts.myvcDir}/remotes`; + iniDir = `${opts.mytDir}/remotes`; iniFile = `${opts.remote}.ini`; } const iniPath = path.join(iniDir, iniFile); @@ -226,7 +226,7 @@ class MyVC { }; if (iniConfig.ssl_ca) { dbConfig.ssl = { - ca: await fs.readFile(`${opts.myvcDir}/${iniConfig.ssl_ca}`), + ca: await fs.readFile(`${opts.mytDir}/${iniConfig.ssl_ca}`), rejectUnauthorized: iniConfig.ssl_verify_server_cert != undefined } } @@ -422,7 +422,7 @@ class MyVC { const dumpStream = await fs.createWriteStream(dumpPath); await docker.build(__dirname, { - tag: 'myvc/client', + tag: 'myt/client', file: path.join(__dirname, 'server', 'Dockerfile.client') }, this.opts.debug); @@ -469,15 +469,15 @@ class MyVC { ] }; const commandArgs = [command].concat(myArgs, args); - await docker.run('myvc/client', commandArgs, { + await docker.run('myt/client', commandArgs, { addHost: 'host.docker.internal:host-gateway', - volume: `${this.opts.myvcDir}:/workspace`, + volume: `${this.opts.mytDir}:/workspace`, rm: true }, execOptions); } showHelp(opts, usage, command) { - const prefix = `${'Usage:'.gray} [npx] myvc`; + const prefix = `${'Usage:'.gray} [npx] myt`; if (command) { let log = [prefix, command.blue]; @@ -640,7 +640,7 @@ for (const tokenId in tokens) { tokenIndex.set(token.start[0], token); } -module.exports = MyVC; +module.exports = Myt; if (require.main === module) - new MyVC().run(); + new Myt().run(); diff --git a/package-lock.json b/package-lock.json index 6e1a602..e116fd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "myvc", - "version": "1.5.0", + "name": "@verdnatura/myt", + "version": "1.5.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "myvc", - "version": "1.5.0", + "name": "@verdnatura/myt", + "version": "1.5.2", "license": "GPL-3.0", "dependencies": { "@sqltools/formatter": "^1.2.3", @@ -21,6 +21,7 @@ "sha.js": "^2.4.11" }, "bin": { + "myt": "cli.js", "myv": "cli.js", "myvc": "cli.js" } diff --git a/package.json b/package.json index 3fae1df..1ef9eb2 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,17 @@ { - "name": "myvc", - "version": "1.5.0", + "name": "@verdnatura/myt", + "version": "1.5.2", "author": "Verdnatura Levante SL", - "description": "MySQL Version Control", + "description": "MySQL and MariaDB version control using Git", "license": "GPL-3.0", "bin": { + "myt": "cli.js", "myvc": "cli.js", "myv": "cli.js" }, "repository": { "type": "git", - "url": "https://github.com/verdnatura/myvc.git" + "url": "https://github.com/verdnatura/myt.git" }, "dependencies": { "@sqltools/formatter": "^1.2.3", diff --git a/server/Dockerfile.dump b/server/Dockerfile.dump index c16cab6..7cc9fed 100644 --- a/server/Dockerfile.dump +++ b/server/Dockerfile.dump @@ -1,4 +1,4 @@ -FROM myvc/server +FROM myt/server USER root diff --git a/server/Dockerfile.server b/server/Dockerfile.server index 05dcb40..83c037f 100644 --- a/server/Dockerfile.server +++ b/server/Dockerfile.server @@ -1,4 +1,4 @@ -FROM myvc/base +FROM myt/base USER root ENV MYSQL_ROOT_PASSWORD root diff --git a/template/myvc.config.yml b/template/myvc.config.yml index 27f405c..3fe7ad0 100755 --- a/template/myvc.config.yml +++ b/template/myvc.config.yml @@ -1,9 +1,9 @@ code: my-db schemas: - - myvc + - myt - my_db fixtures: - myvc: + myt: - version - versionLog my_db: diff --git a/template/package.json b/template/package.json index a95d0b8..715e96d 100644 --- a/template/package.json +++ b/template/package.json @@ -8,6 +8,6 @@ "type": "git" }, "dependencies": { - "myvc": "^1.5.0" + "myt": "^1.5.2" } }