-
Notifications
You must be signed in to change notification settings - Fork 216
Shared Templates
This page contains a collection of templates shared by members of the community.
- Click the gist link for the template you want to use
- 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) - Download the template files as a zip
- Extract the files
- Copy the files into the proper subdirectory of your templates folder
- Rename them to remove the database engine and deploy/revert/verify prefixes
- Optionally, install the sa.sh (sqitch-add) helper bash script into your /usr/local/bin folder
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.
- Create a gist containing your template definitions
- Add separate files for the deploy/revert/verify commands.
- Name the files with the following pattern:
<engine>_<deploy/revert/verify>_<template_name>.tmpl
- Save the gist as a public gist
- Copy the URL of the gist
- Add a new entry in this page
- Click the gist link for a template
- Click the Fork button to make your own copy of the gist
- Click the Edit button to edit your copy
- Make your changes
- Click
Update public gist
- Edit this wiki page and create a new sub-item under the existing template name with a description of your change