Skip to content

w-kuipers/alphadb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

395 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlphaDB

GitHub releases Crates.io Version PyPI release NPM release License: GPL v3 Tests

AlphaDB

AlphaDB is a SQL schema versioning tool that lets you define your database structure in a JSON format and handles applying migrations across multiple databases. It gives you consistency and control over schema evolution, whether you're working in development, staging, or production environments.


Beta

AlphaDB is currently in beta stage. Breaking changes should be expected.


Key Features

  • JSON-Based Database Schema: Define your database structure in a clear, human-readable JSON format.
  • Easy Migration Management: Apply, track, and roll back migrations seamlessly across multiple databases.
  • Version Control for Your Database: Keep your database schema in sync with your application code.
  • Lightweight and Developer-Friendly: Designed to integrate smoothly into your development workflow.

Documentation

Visit the official documentation

Installation

Install using Cargo

cargo install alphadb-cli

Usage

Connect to a database

alphadb connect

You will be asked to provide the database credentials. After connecting the connection will be saved for later use.

Make sure the database is empty, back it up if necessary. If the database is not empty, you can use the vacate method. Note that this function will erase ALL data in the database and this action is irriversible.

alphadb vacate

The database is now ready to be initialized. The init command will create the adb_conf table. This holds configuration data for the database.

alphadb init

Now we update the database. For this we need to give it a structure. Read more about version sources.

{
  "name": "mydb",
  "engine": "postgres",
  "version": [
    {
      "_id": "0.1.0",
      "createtable": {
        "customers": {
          "primary_key": "id",
          "name": {
            "type": "VARCHAR",
            "length": 100
          },
          "id": {
            "type": "INTEGER",
            "generated": "BY DEFAULT"
          }
        }
      }
    },
    {
      "_id": "1.0.0",
      "createtable": {
        "orders": {
          "primary_key": "id",
          "id": {
            "type": "INTEGER",
            "generated": "BY DEFAULT"
          },
          "date": {
            "type": "TIMESTAMP"
          },
          "note": {
            "type": "TEXT",
            "null": true
          }
        }
      }
    }
  ]
}

Then run the update command.

alphadb update

You will be asked to select a version source. This can be a path to a JSON file or a URL returning JSON data.

License

GPL-3.0 LICENSE

About

AlphaDB is a SQL schema versioning tool that uses JSON-defined structure specifications to automate and streamline database migrations across environments.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages