Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

YianAndCode/blueprint

Repository files navigation

Blueprint

Blueprint

Documentation | 中文文档

Introduction

Blueprint is a lightweight database migration CLI tool written in Go, inspired by Laravel Migrations.

If you are an independent developer or a startup team, tools like Bytebase may feel a little heavy, but Blueprint will be your powerful assistant😎

Quick start

Install

Visit the release page and download the corresponding binary file.

Then move the downloaded file to any directory included in the PATH environment variable (e.g., /usr/local/bin/blueprint), and run the following command:

blueprint help

If the setup is successful, you will see the help message output.

Init a repo

Navigate to your project migrations directory and run the following command:

blueprint init

And this directory will be initialized as a Blueprint repository for storing .sql files.

Create migration

blueprint create user
# or specify table name later:
blueprint create
# and you can use update for a update migration:
blueprint update

The create command wille create a pair of .sql files suce as 202411181653_create_user.sql and 202411181653_create_user_rollback.sql, and you just need to edit these files for your migration.

And update command is similar to create, the diffrence between them is just the .sql filename.

Run migration

blueprint
# or
blueprint run

Blueprint will executes all .sql files those not executed before, and these files will have same batch number.

Rollback migration

# to rollback the last batch of migrations, run the following command:
blueprint rollback
# or
blueprint rollback --batch 1
# or rollback the last step of migrations:
blueprint rollback --step 1

You can specify how many step(s) you need to rollback, one step means a .sql file.

Or you can specify how many batch(es) you need to rollback, the batch is introduced at Run migration

Only one of --step or --batch can be specified at a time, default is --batch 1

About

A lightweight database migration CLI tool

Resources

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /