Skip to content

ryarnyah/dblock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DBLock Build Status

________ __________.____                  __
\______ \\______   \    |    ____   ____ |  | __
 |    |  \|    |  _/    |   /  _ \_/ ___\|  |/ /
 |    `   \    |   \    |__(  <_> )  \___|    <
/_______  /______  /_______ \____/ \___  >__|_ \
        \/       \/        \/          \/     \/

Tool to maintain compatibility beetween multiple SQL database versions.

Rules

CODE Test
DCT02 Add a column NOT NULL without default value
DCT01 Change Column type
DC001 Delete Column
DT001 Delete Table

Installation

Binaries

sudo curl -L https://github.com/ryarnyah/dblock/releases/download/0.4.3/dblock-linux-amd64 -o /usr/local/bin/dblock && sudo chmod +x /usr/local/bin/dblock

Via Go

$ go get github.com/ryarnyah/dblock/cmd/dblock

From Source

$ mkdir -p $GOPATH/src/github.com/ryarnyah
$ git clone https://github.com/ryarnyah/dblock $GOPATH/src/github.com/ryarnyah/dblock
$ cd !$
$ make

Running with Docker

docker run ryarnyah/dblock-linux-amd64:0.4.3 <option>

Usage

________ __________.____                  __
\______ \\______   \    |    ____   ____ |  | __
 |    |  \|    |  _/    |   /  _ \_/ ___\|  |/ /
 |    `   \    |   \    |__(  <_> )  \___|    <
/_______  /______  /_______ \____/ \___  >__|_ \
        \/       \/        \/          \/     \/
 Check db schema compatibility.
 Version: 0.4.3
 Build: a6d4ec3-dirty

  -alsologtostderr
        log to standard error as well as files
  -database-lock-file string
        file where database schemas will be persisted (default ".dblock.lock")
  -error-json-file string
        JSON file to write all errors
  -file-source string
        New schema in a json file (default ".new-schema.json")
  -log_backtrace_at value
        when logging hits line file:N, emit a stack trace
  -log_dir string
        If non-empty, write log files in this directory
  -logtostderr
        log to standard error instead of files
  -mssql-conn-info string
        Mssql connetion info (default "sqlserver://sa@localhost/SQLExpress?database=master&connection+timeout=30")
  -mssql-schema-regexp string
        Reex to filter schema to process (default ".*")
  -mysql-conn-info string
        MysqlQL connetion info (default "user:password@/dbname")
  -mysql-schema-regexp string
        Regex to filter schema to process (default ".*")
  -pg-conn-info string
        PostgreSQL connetion info (default "host=localhost port=5432 user=postgres dbname=postgres sslmode=disable password=postgres")
  -pg-schema-regexp string
        Reex to filter schema to process (default ".*")
  -provider string
        DB provider (supported values: postgres, mysql, mssql, file) (default "postgres")
  -stderrthreshold value
        logs at or above this threshold go to stderr
  -v value
        log level for V logs
  -version
        Print version
  -vmodule value
        comma-separated list of pattern=N settings for file-filtered logging

About

Supported Providers

File (-provider file)

  -file-source string
        New schema in a json file (default ".new-schema.json")

PostgreSQL (-provider postgres)

  -pg-conn-info string
        PostgreSQL connetion info (default "host=localhost port=5432 user=postgres dbname=postgres sslmo
  -pg-schema-regexp string
        Reex to filter schema to process (default ".*")

MySQL (-provider mysql)

  -mysql-conn-info string
        MysqlQL connetion info (default "user:password@/dbname")
  -mysql-schema-regexp string
        Regex to filter schema to process (default ".*")

MSSQL (-provider mssql)

  -mssql-conn-info string
        Mssql connetion info (default "sqlserver://sa@localhost/SQLExpress?database=master&connection+timeout=30")
  -mssql-schema-regexp string
        Reex to filter schema to process (default ".*")