Last active
October 9, 2016 13:02
-
-
Save deinspanjer/183bdab9a19060804c2137f5ae5ad5c5 to your computer and use it in GitHub Desktop.
Sqitch create table templates for pg engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Deploy [% project %]:[% change %] to [% engine %] | |
| [% FOREACH item IN requires -%] | |
| -- requires: [% item %] | |
| [% END -%] | |
| [% FOREACH item IN conflicts -%] | |
| -- conflicts: [% item %] | |
| [% END -%] | |
| BEGIN; | |
| SET SEARCH_PATH TO [% IF schema %][% schema %],[% END %]public; | |
| CREATE TABLE [% IF name %][% name %][% ELSE %][% change %][% END %] ( | |
| [% FOREACH col IN column -%] | |
| [% col %] [% type.item( loop.index ) or 'TEXT' %] NOT NULL[% loop.last ? '' : ', ' %] | |
| [% END -%] | |
| ); | |
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Revert [% project %]:[% change %] from [% engine %] | |
| BEGIN; | |
| SET SEARCH_PATH TO [% IF schema %][% schema %],[% END %]public; | |
| DROP TABLE [% IF name %][% name %][% ELSE %][% change %][% END %] CASCADE; | |
| COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Verify [% project %]:[% change %] on [% engine %] | |
| BEGIN; | |
| SELECT '[% IF schema; schema %].[% END %][% IF name %][% name %][% ELSE %][% change %][% END %]'::REGCLASS; | |
| ROLLBACK; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment