MySQL and MariaDB version control using Git
Go to file
Juan Ferrer e11a7730d9 first commit 2020-11-14 02:38:56 +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 first commit 2020-11-14 02:38:56 +01:00
Dockerfile.client first commit 2020-11-14 02:38:56 +01:00
README.md first commit 2020-11-14 02:38:56 +01:00
apply-changes.sh first commit 2020-11-14 02:38:56 +01:00
config.ini first commit 2020-11-14 02:38:56 +01:00
docker-run.js first commit 2020-11-14 02:38:56 +01:00
docker.js first commit 2020-11-14 02:38:56 +01:00
export-fixtures.sh first commit 2020-11-14 02:38:56 +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 first commit 2020-11-14 02:38:56 +01:00
myvc.js first commit 2020-11-14 02:38:56 +01:00
package-lock.json first commit 2020-11-14 02:38:56 +01:00
package.json first commit 2020-11-14 02:38:56 +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

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