Docs improved, template fixes

This commit is contained in:
Juan Ferrer 2022-04-04 19:30:43 +02:00
parent 2f9fb1de98
commit df46ca8c93
4 changed files with 101 additions and 81 deletions

171
README.md
View File

@ -18,14 +18,14 @@ It's recommended to install the package globally.
```text ```text
# npm install -g myvc # npm install -g myvc
$ myvc [command] $ myvc <command>
``` ```
You can also install locally and use the *npx* command to execute it. You can also install locally and use the *npx* command to execute it.
```text ```text
$ npm install myvc $ npm install myvc
$ npx myvc [command] $ npx myvc <command>
``` ```
## How to use ## How to use
@ -54,6 +54,101 @@ Local server management commands:
Each command can have its own specific commandline options. 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 [<remote>]
```
### 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 ## Versioning commands
### init ### init
@ -126,78 +221,6 @@ version of it.
$ myvc start $ 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 ## Why
The main reason for starting this project it's because there are no fully free The main reason for starting this project it's because there are no fully free

View File

@ -1,6 +1,6 @@
{ {
"name": "myvc", "name": "myvc",
"version": "1.3.8", "version": "1.3.9",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "MySQL Version Control", "description": "MySQL Version Control",
"license": "GPL-3.0", "license": "GPL-3.0",

View File

@ -5,7 +5,7 @@ schemas:
fixtures: fixtures:
myvc: myvc:
- version - version
- versionUser - versionLog
my_db: my_db:
- table1 - table1
- table2 - table2

View File

@ -7,10 +7,7 @@
"repository": { "repository": {
"type": "git" "type": "git"
}, },
"devDependencies": { "dependencies": {
"myvc": "^1.0.17" "myvc": "^1.3.9"
},
"scripts": {
"myvc": "myvc"
} }
} }