From df46ca8c938080f484b0dd41ca5de929558aaea8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 4 Apr 2022 19:30:43 +0200 Subject: [PATCH] Docs improved, template fixes --- README.md | 171 ++++++++++++++++++++++----------------- package.json | 2 +- template/myvc.config.yml | 2 +- template/package.json | 7 +- 4 files changed, 101 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index a145d79..3ef4943 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,14 @@ It's recommended to install the package globally. ```text # npm install -g myvc -$ myvc [command] +$ myvc ``` You can also install locally and use the *npx* command to execute it. ```text $ npm install myvc -$ npx myvc [command] +$ npx myvc ``` ## How to use @@ -54,6 +54,101 @@ Local server management commands: Each command can have its own specific commandline options. +## Basic information + +First of all you have to initalize the workspace. + +```text +$ myvc init +``` + +Now you can configure MyVC using *myvc.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. + +Don't forget to initialize git (if it isn't initialized yet). + +```text +$ git init +``` + +### Remotes + +Create database connection configuration for each environment at *remotes* +folder using standard MySQL *ini* configuration files. The convention remote +names are *local*, *production* and *test*. + +```text +remotes/[remote].ini +``` +### Startup + +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 +``` + +From now on, you can use the project as if it were a standard git repository +(since it is). To apply changes to the database run the *push* command on the +desired remote. + +```text +$ myvc push [] +``` + +### Routines + +Routines are placed inside *routines* folder. All objects that have PL/SQL code +are considered routines. It includes events, functions, procedures, triggers +and views with the following structure. + +```text + routines + `- schema + |- events + | `- eventName.sql + |- functions + | `- functionName.sql + |- procedures + | `- procedureName.sql + |- triggers + | `- triggerName.sql + `- views + `- viewName.sql +``` + +### Versions + +Versions are placed inside *versions* folder with the following structure. +Don't place your PL/SQL objects here, use the routines folder! + +```text + versions + |- 00001-firstVersionCodeName + | |- 00-firstExecutedScript.sql + | |- 01-secondScript.sql + | `- 99-lastScript.sql + `- 00002-secondVersion + |- 00-firstExecutedScript.sql + `- 00-sameNumbers.sql +``` + +### Local server + +The local server is created as a MariaDB Docker container using the base dump +created with the *dump* command plus pushing local versions and changed +routines. + +### Dumps + +You can create your local fixture and structure files. + +* *dump/structure.sql* +* *dump/fixtures.sql* + + ## Versioning commands ### init @@ -126,78 +221,6 @@ version of it. $ myvc start ``` -## Basic information - -First of all you have to initalize the workspace. - -```text -$ myvc init -``` - -Now you can configure MyVC using *myvc.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. - -### Remotes - -Create database connection configuration for each environment at *remotes* -folder using standard MySQL *ini* configuration files. The convention remote -names are *production* and *test*. - -```text -remotes/[remote].ini -``` - -### Routines - -Routines are placed inside *routines* folder. All objects that have PL/SQL code -are considered routines. It includes events, functions, procedures, triggers -and views with the following structure. - -```text - routines - `- schema - |- events - | `- eventName.sql - |- functions - | `- functionName.sql - |- procedures - | `- procedureName.sql - |- triggers - | `- triggerName.sql - `- views - `- viewName.sql -``` - -### Versions - -Versions are placed inside *versions* folder with the following structure. -Don't place your PL/SQL objects here, use the routines folder! - -```text - versions - |- 00001-firstVersionCodeName - | |- 00-firstExecutedScript.sql - | |- 01-secondScript.sql - | `- 99-lastScript.sql - `- 00002-secondVersion - |- 00-firstExecutedScript.sql - `- 00-sameNumbers.sql -``` - -### Local server - -The local server is created as a MariaDB Docker container using the base dump -created with the *dump* command plus pushing local versions and changed -routines. - -### Dumps - -You can create your local fixture and structure files. - -* *dump/structure.sql* -* *dump/fixtures.sql* - ## Why The main reason for starting this project it's because there are no fully free diff --git a/package.json b/package.json index edba274..2c49b32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "myvc", - "version": "1.3.8", + "version": "1.3.9", "author": "Verdnatura Levante SL", "description": "MySQL Version Control", "license": "GPL-3.0", diff --git a/template/myvc.config.yml b/template/myvc.config.yml index 666e079..27f405c 100755 --- a/template/myvc.config.yml +++ b/template/myvc.config.yml @@ -5,7 +5,7 @@ schemas: fixtures: myvc: - version - - versionUser + - versionLog my_db: - table1 - table2 diff --git a/template/package.json b/template/package.json index c2c970a..72e6620 100644 --- a/template/package.json +++ b/template/package.json @@ -7,10 +7,7 @@ "repository": { "type": "git" }, - "devDependencies": { - "myvc": "^1.0.17" - }, - "scripts": { - "myvc": "myvc" + "dependencies": { + "myvc": "^1.3.9" } }