MySQL and MariaDB version control using Git
Go to file
Juan Ferrer b21af192a3 Documentation and DB structure 2020-11-14 16:08:27 +01:00
docker first commit 2020-11-14 02:38:56 +01:00
templates first commit 2020-11-14 02:38:56 +01:00
.dockerignore first commit 2020-11-14 02:38:56 +01:00
.gitignore first commit 2020-11-14 02:38:56 +01:00
Dockerfile.client first commit 2020-11-14 02:38:56 +01:00
Dockerfile.dump Refactor and fixes 2020-11-14 15:53:13 +01:00
Dockerfile.server Refactor and fixes 2020-11-14 15:53:13 +01:00
LICENSE Refactor and fixes 2020-11-14 15:53:13 +01:00
README.md Documentation and DB structure 2020-11-14 16:08:27 +01:00
apply-changes.sh Refactor and fixes 2020-11-14 15:53:13 +01:00
db.ini Refactor and fixes 2020-11-14 15:53:13 +01:00
docker-run.js Refactor and fixes 2020-11-14 15:53:13 +01:00
docker.js Refactor and fixes 2020-11-14 15:53:13 +01:00
export-fixtures.sh Refactor and fixes 2020-11-14 15:53:13 +01:00
export-routines.js first commit 2020-11-14 02:38:56 +01:00
export-structure.sh first commit 2020-11-14 02:38:56 +01:00
index.js Refactor and fixes 2020-11-14 15:53:13 +01:00
myvc.js first commit 2020-11-14 02:38:56 +01:00
package-lock.json Refactor and fixes 2020-11-14 15:53:13 +01:00
package.json Version increased 2020-11-14 15:55:29 +01:00
structure.sql Documentation and DB structure 2020-11-14 16:08:27 +01:00

README.md

MyVC (MySQL Version Control)

Utilities to ease the maintenance of MySQL database versioning using a Git repository.

Prerequisites

Required applications.

  • Git
  • Node.js = 12.17.0 LTS
  • Docker

Installation

It's recommended to install the package globally.

# npm install -g myvc

How to use

Export structure (uses production configuration).

$ myvc structure

Export fixtures (uses production configuration).

$ myvc fixtures

Export routines.

$ myvc routines [environment]

Apply changes into database.

$ myvc apply [-f] [-u] [environment]

Basic information

Create database connection configuration files for each environment at main project folder using the standard MySQL parameters. The predefined environment names are production and testing.

db.[environment].ini

Structure and fixture dumps are located inside dump folder.

  • structure.sql
  • fixtures.sql
  • fixtures.local.sql

Routines are located inside routines folder. It includes procedures, functions, triggers, views and events with the following structure.

  routines
  `- schema
     |- events
     |  `- eventName.sql
     |- functions
     |  `- functionName.sql
     |- procedures
     |  `- procedureName.sql
     |- triggers
     |  `- triggerName.sql
     `- views
        `- viewName.sql

Versions

Place your versions inside changes folder with the following structure.

  changes
  |- 00001-firstVersionCodeName
  |  |- 00-firstExecutedScript.sql
  |  |- 01-secondScript.sql
  |  `- 99-lastScript.sql
  `- 00002-secondVersion
     |- 00-firstExecutedScript.sql
     `- 00-sameNumbers.sql

Built With