@verdnatura/myt 1.5.17 → 1.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.dockerignore +2 -2
  2. package/LICENSE +17 -17
  3. package/README.md +278 -278
  4. package/assets/db.ini +5 -5
  5. package/assets/myt.default.yml +11 -11
  6. package/assets/structure.sql +24 -24
  7. package/cli.js +4 -4
  8. package/exporters/event.ejs +18 -18
  9. package/exporters/event.js +31 -31
  10. package/exporters/event.sql +19 -19
  11. package/exporters/function.ejs +17 -17
  12. package/exporters/function.js +27 -27
  13. package/exporters/function.sql +16 -16
  14. package/exporters/procedure.ejs +11 -11
  15. package/exporters/procedure.js +23 -23
  16. package/exporters/procedure.sql +14 -14
  17. package/exporters/trigger.ejs +4 -4
  18. package/exporters/trigger.js +10 -10
  19. package/exporters/trigger.sql +13 -13
  20. package/exporters/view.ejs +7 -7
  21. package/exporters/view.js +29 -29
  22. package/exporters/view.sql +12 -12
  23. package/lib/command.js +13 -13
  24. package/lib/conn.js +141 -141
  25. package/lib/docker.js +133 -133
  26. package/lib/dumper.js +83 -83
  27. package/lib/exporter-engine.js +112 -112
  28. package/lib/exporter.js +86 -86
  29. package/lib/repo.js +29 -29
  30. package/lib/server.js +71 -71
  31. package/lib/util.js +7 -7
  32. package/myt-clean.js +58 -58
  33. package/myt-create.js +74 -74
  34. package/myt-dump.js +75 -75
  35. package/myt-fixtures.js +29 -29
  36. package/myt-init.js +36 -36
  37. package/myt-pull.js +183 -183
  38. package/myt-push.js +568 -562
  39. package/myt-run.js +177 -177
  40. package/myt-start.js +54 -54
  41. package/myt-version.js +218 -218
  42. package/myt.js +361 -361
  43. package/package.json +41 -41
  44. package/server/Dockerfile.base +1 -1
  45. package/server/Dockerfile.client +14 -14
  46. package/server/Dockerfile.dump +16 -16
  47. package/server/Dockerfile.server +25 -25
  48. package/server/docker-dump.sh +4 -4
  49. package/server/docker-fixtures.sh +4 -4
  50. package/server/docker-import.sh +6 -6
  51. package/server/docker-init.sh +20 -20
  52. package/server/docker-start.sh +10 -10
  53. package/server/docker.cnf +9 -9
  54. package/template/dump/Dockerfile.base +1 -1
  55. package/template/dump/afterDump.sql +1 -1
  56. package/template/dump/beforeDump.sql +1 -1
  57. package/template/dump/fixtures.sql +1 -1
  58. package/template/myt.config.yml +11 -11
  59. package/template/package.json +13 -13
  60. package/template/remotes/docker.ini +4 -4
  61. package/template/remotes/local.ini +5 -5
  62. package/template/routines/README.md +1 -1
  63. package/template/versions/00001-firstVersion/00-firstScript.sql +1 -1
  64. package/template/versions/README.md +1 -1
package/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
2
-
3
- const Myt = require('./myt');
4
- new Myt().run();
1
+ #!/usr/bin/env node
2
+
3
+ const Myt = require('./myt');
4
+ new Myt().run();
@@ -1,18 +1,18 @@
1
- <%- begin %> <%- typeAndName %><%
2
- if (params.type == 'RECURRING') { %>
3
- ON SCHEDULE EVERY <%- params.intervalValue %> <%- params.intervalField %><%
4
- if (params.starts) { %>
5
- STARTS <%- params.starts %><%
6
- }
7
- if (params.ends) { %>
8
- ENDS <%- params.ends %><%
9
- }
10
- } else { %>
11
- ON SCHEDULE AT <%- params.executeAt %><%
12
- } %>
13
- ON COMPLETION <%- params.onCompletion %>
14
- <%- params.status %><%
15
- if (params.comment) { %>
16
- COMMENT <%- params.comment %><%
17
- } %>
18
- DO <%- params.body %><%- end %>
1
+ <%- begin %> <%- typeAndName %><%
2
+ if (params.type == 'RECURRING') { %>
3
+ ON SCHEDULE EVERY <%- params.intervalValue %> <%- params.intervalField %><%
4
+ if (params.starts) { %>
5
+ STARTS <%- params.starts %><%
6
+ }
7
+ if (params.ends) { %>
8
+ ENDS <%- params.ends %><%
9
+ }
10
+ } else { %>
11
+ ON SCHEDULE AT <%- params.executeAt %><%
12
+ } %>
13
+ ON COMPLETION <%- params.onCompletion %>
14
+ <%- params.status %><%
15
+ if (params.comment) { %>
16
+ COMMENT <%- params.comment %><%
17
+ } %>
18
+ DO <%- params.body %><%- end %>
@@ -1,31 +1,31 @@
1
-
2
- module.exports = {
3
- schemaCol: 'EVENT_SCHEMA',
4
- nameCol: 'EVENT_NAME',
5
- escapeCols: [
6
- 'starts',
7
- 'ends',
8
- 'executeAt',
9
- 'comment'
10
- ],
11
- defaults: {
12
- type: 'RECURRING',
13
- intervalValue: 1,
14
- intervalField: 'DAY',
15
- onCompletion: 'PRESERVE'
16
- },
17
- formatter(params) {
18
- let status;
19
- switch(params.status){
20
- case 'DISABLED':
21
- status = 'DISABLE';
22
- break;
23
- case 'SLAVESIDE_DISABLED':
24
- status = 'DISABLE ON SLAVE';
25
- break;
26
- default:
27
- status = 'ENABLE'
28
- }
29
- params.status = status;
30
- }
31
- };
1
+
2
+ module.exports = {
3
+ schemaCol: 'EVENT_SCHEMA',
4
+ nameCol: 'EVENT_NAME',
5
+ escapeCols: [
6
+ 'starts',
7
+ 'ends',
8
+ 'executeAt',
9
+ 'comment'
10
+ ],
11
+ defaults: {
12
+ type: 'RECURRING',
13
+ intervalValue: 1,
14
+ intervalField: 'DAY',
15
+ onCompletion: 'PRESERVE'
16
+ },
17
+ formatter(params) {
18
+ let status;
19
+ switch(params.status){
20
+ case 'DISABLED':
21
+ status = 'DISABLE';
22
+ break;
23
+ case 'SLAVESIDE_DISABLED':
24
+ status = 'DISABLE ON SLAVE';
25
+ break;
26
+ default:
27
+ status = 'ENABLE'
28
+ }
29
+ params.status = status;
30
+ }
31
+ };
@@ -1,19 +1,19 @@
1
-
2
- SELECT
3
- `EVENT_SCHEMA` AS `schema`,
4
- `EVENT_NAME` AS `name`,
5
- `DEFINER` AS `definer`,
6
- `EVENT_DEFINITION` AS `body`,
7
- `EVENT_TYPE` AS `type`,
8
- `EXECUTE_AT` AS `executeAt`,
9
- `INTERVAL_VALUE` AS `intervalValue`,
10
- `INTERVAL_FIELD` AS `intervalField`,
11
- `STARTS` AS `starts`,
12
- `ENDS` AS `ends`,
13
- `STATUS` AS `status`,
14
- `ON_COMPLETION` AS `onCompletion`,
15
- `EVENT_COMMENT` AS `comment`,
16
- `LAST_ALTERED` AS `modified`
17
- FROM `information_schema`.`EVENTS`
18
- WHERE ?
19
- ORDER BY `name`
1
+
2
+ SELECT
3
+ `EVENT_SCHEMA` AS `schema`,
4
+ `EVENT_NAME` AS `name`,
5
+ `DEFINER` AS `definer`,
6
+ `EVENT_DEFINITION` AS `body`,
7
+ `EVENT_TYPE` AS `type`,
8
+ `EXECUTE_AT` AS `executeAt`,
9
+ `INTERVAL_VALUE` AS `intervalValue`,
10
+ `INTERVAL_FIELD` AS `intervalField`,
11
+ `STARTS` AS `starts`,
12
+ `ENDS` AS `ends`,
13
+ `STATUS` AS `status`,
14
+ `ON_COMPLETION` AS `onCompletion`,
15
+ `EVENT_COMMENT` AS `comment`,
16
+ `LAST_ALTERED` AS `modified`
17
+ FROM `information_schema`.`EVENTS`
18
+ WHERE ?
19
+ ORDER BY `name`
@@ -1,17 +1,17 @@
1
- <%- begin %> <%- typeAndName %>(<%- params.paramList %>)
2
- RETURNS <%- params.returns %><%
3
- if (params.isDeterministic == 'NO') { %>
4
- NOT DETERMINISTIC<%
5
- } else { %>
6
- DETERMINISTIC<%
7
- }
8
- if (params.dataAccess) { %>
9
- <%- params.dataAccess %><%
10
- }
11
- if (params.securityType == 'INVOKER') { %>
12
- SQL SECURITY <%- params.securityType %><%
13
- }
14
- if (params.comment) { %>
15
- COMMENT <%- params.comment %><%
16
- } %>
17
- <%- params.body %><%- end %>
1
+ <%- begin %> <%- typeAndName %>(<%- params.paramList %>)
2
+ RETURNS <%- params.returns %><%
3
+ if (params.isDeterministic == 'NO') { %>
4
+ NOT DETERMINISTIC<%
5
+ } else { %>
6
+ DETERMINISTIC<%
7
+ }
8
+ if (params.dataAccess) { %>
9
+ <%- params.dataAccess %><%
10
+ }
11
+ if (params.securityType == 'INVOKER') { %>
12
+ SQL SECURITY <%- params.securityType %><%
13
+ }
14
+ if (params.comment) { %>
15
+ COMMENT <%- params.comment %><%
16
+ } %>
17
+ <%- params.body %><%- end %>
@@ -1,27 +1,27 @@
1
-
2
- module.exports = {
3
- schemaCol: 'db',
4
- nameCol: 'name',
5
- escapeCols: [
6
- 'comment'
7
- ],
8
- defaults: {
9
- returns: 'INT',
10
- isDeterministic: 'NO'
11
- },
12
- formatter(params) {
13
- let dataAccess;
14
- switch(params.dataAccess) {
15
- case 'NO_SQL':
16
- dataAccess = 'NO SQL';
17
- break;
18
- case 'READS_SQL_DATA':
19
- dataAccess = 'READS SQL DATA';
20
- break;
21
- case 'MODIFIES_SQL_DATA':
22
- dataAccess = 'MODIFIES SQL DATA';
23
- break;
24
- }
25
- params.dataAccess = dataAccess;
26
- }
27
- };
1
+
2
+ module.exports = {
3
+ schemaCol: 'db',
4
+ nameCol: 'name',
5
+ escapeCols: [
6
+ 'comment'
7
+ ],
8
+ defaults: {
9
+ returns: 'INT',
10
+ isDeterministic: 'NO'
11
+ },
12
+ formatter(params) {
13
+ let dataAccess;
14
+ switch(params.dataAccess) {
15
+ case 'NO_SQL':
16
+ dataAccess = 'NO SQL';
17
+ break;
18
+ case 'READS_SQL_DATA':
19
+ dataAccess = 'READS SQL DATA';
20
+ break;
21
+ case 'MODIFIES_SQL_DATA':
22
+ dataAccess = 'MODIFIES SQL DATA';
23
+ break;
24
+ }
25
+ params.dataAccess = dataAccess;
26
+ }
27
+ };
@@ -1,16 +1,16 @@
1
-
2
- SELECT
3
- `db` AS `schema`,
4
- `name`,
5
- `definer`,
6
- `param_list` AS `paramList`,
7
- `body`,
8
- `sql_data_access` AS `dataAccess`,
9
- `security_type` AS `securityType`,
10
- `comment`,
11
- `modified`,
12
- `is_deterministic` AS `isDeterministic`,
13
- `returns`
14
- FROM `mysql`.`proc`
15
- WHERE ? AND `type` = 'FUNCTION'
16
- ORDER BY `name`
1
+
2
+ SELECT
3
+ `db` AS `schema`,
4
+ `name`,
5
+ `definer`,
6
+ `param_list` AS `paramList`,
7
+ `body`,
8
+ `sql_data_access` AS `dataAccess`,
9
+ `security_type` AS `securityType`,
10
+ `comment`,
11
+ `modified`,
12
+ `is_deterministic` AS `isDeterministic`,
13
+ `returns`
14
+ FROM `mysql`.`proc`
15
+ WHERE ? AND `type` = 'FUNCTION'
16
+ ORDER BY `name`
@@ -1,11 +1,11 @@
1
- <%- begin %> <%- typeAndName %>(<%- params.paramList %>)<%
2
- if (params.dataAccess) { %>
3
- <%- params.dataAccess %><%
4
- }
5
- if (params.securityType == 'INVOKER') { %>
6
- SQL SECURITY <%- params.securityType %><%
7
- }
8
- if (params.comment) { %>
9
- COMMENT <%- params.comment %><%
10
- } %>
11
- <%- params.body %><%- end %>
1
+ <%- begin %> <%- typeAndName %>(<%- params.paramList %>)<%
2
+ if (params.dataAccess) { %>
3
+ <%- params.dataAccess %><%
4
+ }
5
+ if (params.securityType == 'INVOKER') { %>
6
+ SQL SECURITY <%- params.securityType %><%
7
+ }
8
+ if (params.comment) { %>
9
+ COMMENT <%- params.comment %><%
10
+ } %>
11
+ <%- params.body %><%- end %>
@@ -1,23 +1,23 @@
1
-
2
- module.exports = {
3
- schemaCol: 'db',
4
- nameCol: 'name',
5
- escapeCols: [
6
- 'comment'
7
- ],
8
- formatter(params) {
9
- let dataAccess;
10
- switch(params.dataAccess) {
11
- case 'NO_SQL':
12
- dataAccess = 'NO SQL';
13
- break;
14
- case 'READS_SQL_DATA':
15
- dataAccess = 'READS SQL DATA';
16
- break;
17
- case 'MODIFIES_SQL_DATA':
18
- dataAccess = 'MODIFIES SQL DATA';
19
- break;
20
- }
21
- params.dataAccess = dataAccess;
22
- }
23
- };
1
+
2
+ module.exports = {
3
+ schemaCol: 'db',
4
+ nameCol: 'name',
5
+ escapeCols: [
6
+ 'comment'
7
+ ],
8
+ formatter(params) {
9
+ let dataAccess;
10
+ switch(params.dataAccess) {
11
+ case 'NO_SQL':
12
+ dataAccess = 'NO SQL';
13
+ break;
14
+ case 'READS_SQL_DATA':
15
+ dataAccess = 'READS SQL DATA';
16
+ break;
17
+ case 'MODIFIES_SQL_DATA':
18
+ dataAccess = 'MODIFIES SQL DATA';
19
+ break;
20
+ }
21
+ params.dataAccess = dataAccess;
22
+ }
23
+ };
@@ -1,14 +1,14 @@
1
-
2
- SELECT
3
- `db` AS `schema`,
4
- `name`,
5
- `definer`,
6
- `param_list` AS `paramList`,
7
- `body`,
8
- `sql_data_access` AS `dataAccess`,
9
- `security_type` AS `securityType`,
10
- `comment`,
11
- `modified`
12
- FROM `mysql`.`proc`
13
- WHERE ? AND `type` = 'PROCEDURE'
14
- ORDER BY `name`
1
+
2
+ SELECT
3
+ `db` AS `schema`,
4
+ `name`,
5
+ `definer`,
6
+ `param_list` AS `paramList`,
7
+ `body`,
8
+ `sql_data_access` AS `dataAccess`,
9
+ `security_type` AS `securityType`,
10
+ `comment`,
11
+ `modified`
12
+ FROM `mysql`.`proc`
13
+ WHERE ? AND `type` = 'PROCEDURE'
14
+ ORDER BY `name`
@@ -1,4 +1,4 @@
1
- <%- begin %> <%- typeAndName %>
2
- <%- params.actionTiming %> <%- params.actionType %> ON `<%- params.table %>`
3
- FOR EACH ROW
4
- <%- params.body %><%- end %>
1
+ <%- begin %> <%- typeAndName %>
2
+ <%- params.actionTiming %> <%- params.actionType %> ON `<%- params.table %>`
3
+ FOR EACH ROW
4
+ <%- params.body %><%- end %>
@@ -1,10 +1,10 @@
1
-
2
- module.exports = {
3
- schemaCol: 'TRIGGER_SCHEMA',
4
- nameCol: 'TRIGGER_NAME',
5
- defaults: {
6
- actionTiming: 'AFTER',
7
- actionType: 'INSERT',
8
- table: 'table'
9
- }
10
- };
1
+
2
+ module.exports = {
3
+ schemaCol: 'TRIGGER_SCHEMA',
4
+ nameCol: 'TRIGGER_NAME',
5
+ defaults: {
6
+ actionTiming: 'AFTER',
7
+ actionType: 'INSERT',
8
+ table: 'table'
9
+ }
10
+ };
@@ -1,13 +1,13 @@
1
-
2
- SELECT
3
- `TRIGGER_SCHEMA` AS `schema`,
4
- `TRIGGER_NAME` AS `name`,
5
- `DEFINER` AS `definer`,
6
- `ACTION_TIMING` AS `actionTiming`,
7
- `EVENT_MANIPULATION` AS `actionType`,
8
- `EVENT_OBJECT_TABLE` AS `table`,
9
- `ACTION_STATEMENT` AS `body`,
10
- `CREATED` AS `modified`
11
- FROM `information_schema`.`TRIGGERS`
12
- WHERE ?
13
- ORDER BY `name`
1
+
2
+ SELECT
3
+ `TRIGGER_SCHEMA` AS `schema`,
4
+ `TRIGGER_NAME` AS `name`,
5
+ `DEFINER` AS `definer`,
6
+ `ACTION_TIMING` AS `actionTiming`,
7
+ `EVENT_MANIPULATION` AS `actionType`,
8
+ `EVENT_OBJECT_TABLE` AS `table`,
9
+ `ACTION_STATEMENT` AS `body`,
10
+ `CREATED` AS `modified`
11
+ FROM `information_schema`.`TRIGGERS`
12
+ WHERE ?
13
+ ORDER BY `name`
@@ -1,7 +1,7 @@
1
- <%- createOrReplace %>
2
- SQL SECURITY <%- params.securityType %>
3
- <%- typeAndName %>
4
- AS <%- params.definition %><%
5
- if (params.checkOption != 'NONE') { %>
6
- WITH <%- params.checkOption %> CHECK OPTION<%
7
- } %>
1
+ <%- createOrReplace %>
2
+ SQL SECURITY <%- params.securityType %>
3
+ <%- typeAndName %>
4
+ AS <%- params.definition %><%
5
+ if (params.checkOption != 'NONE') { %>
6
+ WITH <%- params.checkOption %> CHECK OPTION<%
7
+ } %>
package/exporters/view.js CHANGED
@@ -1,29 +1,29 @@
1
-
2
- const sqlFormatter = require('@sqltools/formatter');
3
-
4
- module.exports = {
5
- schemaCol: 'TABLE_SCHEMA',
6
- nameCol: 'TABLE_NAME',
7
- defaults: {
8
- securityType: 'DEFINER',
9
- checkOption: 'NONE'
10
- },
11
- formatter(params) {
12
- params.definition = sqlFormatter.format(params.definition, {
13
- indent: '\t',
14
- reservedWordCase: 'upper'
15
- });
16
-
17
- let algorithm;
18
- switch (params.isUpdatable) {
19
- case 'YES':
20
- algorithm = 'MERGE';
21
- break;
22
- case 'NO':
23
- algorithm = 'TEMPTABLE';
24
- break;
25
- default:
26
- algorithm = 'UNDEFINED';
27
- }
28
- }
29
- };
1
+
2
+ const sqlFormatter = require('@sqltools/formatter');
3
+
4
+ module.exports = {
5
+ schemaCol: 'TABLE_SCHEMA',
6
+ nameCol: 'TABLE_NAME',
7
+ defaults: {
8
+ securityType: 'DEFINER',
9
+ checkOption: 'NONE'
10
+ },
11
+ formatter(params) {
12
+ params.definition = sqlFormatter.format(params.definition, {
13
+ indent: '\t',
14
+ reservedWordCase: 'upper'
15
+ });
16
+
17
+ let algorithm;
18
+ switch (params.isUpdatable) {
19
+ case 'YES':
20
+ algorithm = 'MERGE';
21
+ break;
22
+ case 'NO':
23
+ algorithm = 'TEMPTABLE';
24
+ break;
25
+ default:
26
+ algorithm = 'UNDEFINED';
27
+ }
28
+ }
29
+ };
@@ -1,12 +1,12 @@
1
-
2
- SELECT
3
- `TABLE_SCHEMA` AS `schema`,
4
- `TABLE_NAME` AS `name`,
5
- `VIEW_DEFINITION` AS `definition`,
6
- `CHECK_OPTION` AS `checkOption`,
7
- `IS_UPDATABLE` AS `isUpdatable`,
8
- `DEFINER` AS `definer`,
9
- `SECURITY_TYPE` AS `securityType`
10
- FROM `information_schema`.`VIEWS`
11
- WHERE ?
12
- ORDER BY `name`
1
+
2
+ SELECT
3
+ `TABLE_SCHEMA` AS `schema`,
4
+ `TABLE_NAME` AS `name`,
5
+ `VIEW_DEFINITION` AS `definition`,
6
+ `CHECK_OPTION` AS `checkOption`,
7
+ `IS_UPDATABLE` AS `isUpdatable`,
8
+ `DEFINER` AS `definer`,
9
+ `SECURITY_TYPE` AS `securityType`
10
+ FROM `information_schema`.`VIEWS`
11
+ WHERE ?
12
+ ORDER BY `name`
package/lib/command.js CHANGED
@@ -1,13 +1,13 @@
1
- /**
2
- * Base class for Myt commands.
3
- */
4
- module.exports = class MytCommand {
5
- constructor(myt, opts) {
6
- this.myt = myt;
7
- this.opts = opts;
8
- }
9
-
10
- async run(myt, opts) {
11
- throw new Error('run command not defined');
12
- }
13
- }
1
+ /**
2
+ * Base class for Myt commands.
3
+ */
4
+ module.exports = class MytCommand {
5
+ constructor(myt, opts) {
6
+ this.myt = myt;
7
+ this.opts = opts;
8
+ }
9
+
10
+ async run(myt, opts) {
11
+ throw new Error('run command not defined');
12
+ }
13
+ }