Skip to content

Instantly share code, notes, and snippets.

@alexesDev
Created August 4, 2018 20:18
Show Gist options
  • Save alexesDev/9f752d912a5c16d808b2a0c38080bb57 to your computer and use it in GitHub Desktop.
Save alexesDev/9f752d912a5c16d808b2a0c38080bb57 to your computer and use it in GitHub Desktop.
createteable sqitch template ~/ .sqitch/templates
-- Deploy [% project %]:[% change %] to [% engine %]
[% FOREACH item IN requires -%]
-- requires: [% item %]
[% END -%]
[% FOREACH item IN conflicts -%]
-- conflicts: [% item %]
[% END -%]
BEGIN;
create table if not exists [% schema %].[% table %] (
[% FOREACH col IN column -%]
[% col %] [% type.item( loop.index ) or 'text' %] not null[% loop.last ? '' : ',' %]
[% END -%]
);
COMMIT;
-- Verify [% project %]:[% change %] on [% engine %]
BEGIN;
select [% column.join(', ') %]
from [% schema %].[% table %]
where false;
ROLLBACK;
-- Revert [% project %]:[% change %] from [% engine %]
BEGIN;
drop table [% schema %].[% table %];
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment