github.com/mg98/scriptup@v0.1.0/README.md (about)

     1  <h1 align="center">scriptup ⬆️</h1>
     2  <p align="center">
     3      A migration tool for shell script executions.
     4  </p>
     5  
     6  <p align="center">
     7    <a href="https://github.com/mg98/scriptup/actions/workflows/test.yml">
     8      <img src="https://github.com/mg98/scriptup/actions/workflows/test.yml/badge.svg">
     9    </a>
    10    <a href="https://pkg.go.dev/github.com/mg98/scriptup">
    11      <img src="http://img.shields.io/badge/godoc-reference-blue.svg"/>
    12    </a>
    13    <a href="https://codecov.io/gh/mg98/scriptup">
    14      <img src="https://codecov.io/gh/mg98/scriptup/branch/main/graph/badge.svg?token=R3OYXX1HC7">
    15    </a>
    16    <a href="https://goreportcard.com/report/github.com/mg98/scriptup">
    17      <img src="https://goreportcard.com/badge/github.com/mg98/scriptup">
    18    </a>
    19    <a href="./LICENSE">
    20      <img src="https://img.shields.io/github/license/mg98/scriptup">
    21    </a>
    22  </p>
    23  
    24  <hr>
    25  
    26  _scriptup_ is a framework- and language-agnostic tool that enables software projects to maintain code-based migration scripts.
    27  This is very similar to database migration tools, just that it is based on shell instead of SQL executions.
    28  While traditional SQL migration frameworks aid deploying database changes to production systems and to other developer machines,
    29  _scriptup_ is able to perform state migrations using general-purpose code!
    30  Example use cases include complex data alterations in the database (e.g. encryption) or the installation of IDE extensions
    31  or even git hooks on developer machines.
    32  
    33  
    34  ## Install and Setup
    35  
    36  The tool is run as a standalone binary.
    37  You can find the appropriate executable for your OS on the [Releases](https://github.com/mg98/scriptup/releases) page.
    38  However, macOS users are very welcome to install it via the package manager [brew](https://brew.sh).
    39  
    40  ```sh
    41  brew tap mg98/homebrew-tap
    42  brew install scriptup
    43  
    44  # Verify your installation
    45  scriptup -v
    46  ```
    47  
    48  To setup _scriptup_ in your project, you have to create its configuration file in your project's root directory.
    49  Take [scriptup.yml](./scriptup.yml) as a template and adjust the values as needed.
    50  
    51  ## Usage
    52  
    53  Create a new migration, e.g.
    54  
    55  ```sh
    56  scriptup new add-git-hook
    57  ```
    58  
    59  This will create a new file in your configured migration folder, something like `20220626135412_add-git-hook.sh`.
    60  Edit the file to contain the script that you want to be executed when running this migration.
    61  
    62  As you will see from the template, the file is subdivided into two sections.
    63  Everything after `### migrate up ###` and before (an optional) `### migrate down ###` will be run on `scriptup up`.
    64  Everything after `### migrate down ###` will be executed on `scriptup down` and is supposed to undo the changes 
    65  performed through the script in the _up_-section (your responsibility though).
    66  
    67  ### CLI Reference
    68  
    69  ```
    70  COMMANDS:
    71     new, n     Generate a new migration file
    72     up, u      Execute recent scripts that have not been migrated yet
    73     down, d    Undo recently performed migrations
    74     status, s  Get status about open migrations and which was run last
    75     help, h    Shows a list of commands or help for one command
    76  
    77  GLOBAL OPTIONS:
    78     --env value, -e value  specify which configuration to use (default: "dev")
    79     --help, -h             show help (default: false)
    80     --version, -v          print the version (default: false)
    81  ```