Socket
Book a DemoInstallSign in
Socket

versiondb

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

versiondb

A tool to version database schemas, upgrades, and migrations

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

Version DB

An tool for maintaining the versioned schemas in a postgresql database.

Build Status

How it works

Version DB creates a single table (versiondb.version) in the target database that tracks which version of each product's database schema resides in the database. Every time it is run, it checks what version of a product's database schema is on the database, checks the schema file, and runs all of the scripts required to bring the database schema up to the latest version.

If a product does not exist in the database, all of the scripts will be run on the database to create a schema that is the latest version.

Installation

npm install -g versiondb

Usage

To check what schemas are currently installed on a database

versiondb ls

To run upgrade scripts for a product

versiondb run path/to/my/awesome/product/schema.yaml

Schema Files

Schema files are written in YAML.

product: my-product

versions:
  - version: "1.0"
    tasks:
      - name: Create tables
        script: 1.0/tables.sql
      - name: Create functions
        script: 1.0/functions.sql
      - name: Create users
        script: 1.0/users.sql

  - version: "1.1"
    tasks:
      - name: Tables and functions that support the new wizbang feature
        script: 1.1/wizbang.sql
      - name: Tables and functions that support the new foobar feature
        script: 1.1/foobar.sql

The scripts are referenced relative the schema file. Versions are considered ordered by the order that they are in the schema file. (E.g., versiondb does not do semver ordering or alphabetical ordering. It considers one version to be after another version if it appears lower in the schema file.)

FAQs

Package last updated on 19 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts