Git Product home page Git Product logo

parade's Introduction

Parade

Installation

Parade is just a shell script called parade. To install, you can simply download the script and place it in a directory. Parade expects the following environment variables:

  • PARADE_PATH to point to a folder where migrations.txt (your list of migrations) and the migrations and rollback folders will live.
  • PARADE_DB a default database name or URL. You can alternately pass the database as a command line argument.
  • PARADE_EDITOR is an optional command line editor for opening migrations when they are created (e.g. code, subl, vim, etc.)

Once the shell script is downloaded, you will need to run parade install on your database(s) so that the Versioning schema and functions can be added to your database.

curl https://raw.githubusercontent.com/negcx/parade/master/setup.sh > parade_setup.sh && bash parade_setup.sh && source .env && rm parade_setup.sh

Setup Script

I have provided an easy setup script that will download Parade and setup some nice defaults:

  • Setup the path for Parade as ./sql or allow you to change it
  • Create or append to a .env file environment variables
  • Add .env to .gitignore

Why Parade?

Parade is a shell script to help create and manage migrations in pure SQL for PostgreSQL. You can commit Parade with your code and easily setup shell scripts on your deploy to ensure your migrations run.

I write applications using a number of different languages, tools, and frameworks. I prefer to write migrations in pure SQL as it gives me the greatest level of control and visibility into what is going to happen on the database. It's also a single language for me to remember for migrations, rather than having to learn the specific syntax of each framework I'm using.

Migrations from the shell in pure SQL are faster, easier to understand, and easier to manage than migrations that require the host language to run.

Parade is built on top of Versioning under the hood. The blog post How to manage changes to your database? describes the theory behind Versioning and using pure SQL to manage your migrations.

Defaults

Parade has a number of sensible defaults in place which would be easy to change in the shell script itself on a project-to-project basis.

  • UUIDs as primary keys named for the table (e.g. customer_id)
  • created_at and updated_at timestamps with the TIMESTAMPTZ type
  • Trigger to automatically update the created_at timestamp

parade's People

Contributors

negcx avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.