Create PostgreSQL sql code quickly and in a streamlined, versioned workflow.
skitch is a wrapper around sqitch to enable a sane workflow for sane database management.
- write and deploy extensions that can be installed with
CREATE EXTENSION - optionally deploy same source as
sqitchmodules (since some managed db providers don't allow custom extensions) - write/deploy a project full of many
sqitchmodules that cross-reference each other using dependency resolution for running deploy command in proper order, etc - pulling modules down (currently via npm) to make re-usability super easy
Install psql without actually running the database. On mac you can use
brew install libpq
Or you can install the full-blown postgres locally, but it is recommended that you shut the service down. You'll be using psql to connect to the postgres that runs inside of a docker container.
https://sqitch.org/ mac users can use brew: https://github.com/sqitchers/homebrew-sqitch
Install the Template library from http://www.tt2.org/
sudo cpan Templatenpm install -g skitchhttps://github.com/pyramation/pg-utils
Initialize a project
skitch init --bare
skitch installNow you should have a packages/ folder
cd packages/
mkdir myfirstmodule
cd myfirstmodule/
skitch initNow you can create some sql using sqitch!
skitch generate schema
skitch generate tableDeploy recursively, using all the required modules!
skitch deploy --createdb --recursiveTo create a test, first cd into a sqitch module
cd packages/myfirstmodule
skitch maketestThen you can use jest via pnpm to test your logic.
pnpm test:watch- interactive shell
- naming conventions
- utility functions to create verify/revert functions for most types
- bundled with templates for most common things:
column
extension
fixture
foreignKey
grantAllTables
grantExecute
grantRole
grantSchema
grantTable
index
policy
procedure
role
rowLevelSecurity
schema
table
timestamps
trigger
type
uniqueIndex
utility
You can install an npm module and then bundle it for plv8
pnpm add my-awesome-npm-module
skitch bundle my-awesome-npm-module awesomeThingskitch install skitch-extension-verify
skitch install skitch-extension-jobs