Skip to content
Daniel Einspanjer edited this page Oct 9, 2016 · 5 revisions

About

This page contains a collection of templates shared by members of the community.

Installation

  1. Click the gist link for the template you want to use
  2. Review the template parameters available for use with the sqitch add -s <param>=<value> command (note parameters can be specified more than once which will make them a list)
  3. Download the template files as a zip
  4. Extract the files
  5. Copy the files into the proper subdirectory of your templates folder
  6. Rename them to remove the database engine and deploy/revert/verify prefixes
  7. Optionally, install the sa.sh (sqitch-add) helper bash script into your /usr/local/bin folder

Usage

Please see sqitch-add for details on using a template, or archive.org copy of theory's blog post about fancy templates for a walkthrough on writing new templates.

Note, passing lots of -s param=value arguments can get tiresome when specifying a bunch of columns to a new table or such. Here is a bash trick that might make it a bit easier for you:

sqitch add my_table --template create_table -m "Aren't I cool" $(echo "--set column="{foo,bar,baz} "--set type="{INT,BOOL,TEXT})

There is also a helper bash script, sa.sh included which can make it more convenient to use the various templates with lots of parameters. Run it with no arguments to see the usage instructions.

Contribute!

Add new templates

  1. Create a gist containing your template definitions
  2. Add separate files for the deploy/revert/verify commands.
  3. Name the files with the following pattern: <engine>_<deploy/revert/verify>_<template_name>.tmpl
  4. Save the gist as a public gist
  5. Copy the URL of the gist
  6. Add a new entry in this page

Update existing templates

  1. Click the gist link for a template
  2. Click the Fork button to make your own copy of the gist
  3. Click the Edit button to edit your copy
  4. Make your changes
  5. Click Update public gist
  6. Edit this wiki page and create a new sub-item under the existing template name with a description of your change

sa.sh bash helper script

Templates

pg