Versioning

Fork/mirror of https://gitlab.com/depesz/Versioning
git clone https://ccx.te2000.cz/git/Versioning
Log | Files | Refs | README | LICENSE

patch_file_format.md (1077B)


      1 # Purpose
      2 
      3 The patch format for `apply_patchset` script slightly differs from regular **Versioning** patch format.
      4 The reason for this is to make the patch metadata easier to parse and thus allow reasoning about them before patch
      5 application, as well as validation of the format and removing boilerplate such as transaction management.
      6 
      7 This format equates filename with patch name.
      8 While it's less flexible than being able to assign arbitrary names to patches it greatly simplifies the automation
      9 required to get the correct patches applied.
     10 
     11 # Format
     12 
     13 Every patch file has a header which starts with `-- VPATCH` and ends with empty line (required).
     14 In between those lines you can put dependency and conflict lines in arbitrary order, such as:
     15 
     16 ```
     17 -- VPATCH
     18 -- VDEP:000-base.sql
     19 -- VDEP:001-extensions.sql
     20 -- VCON:009-special.sql
     21 
     22 create table foo (foo_id serial primary key, bar text);
     23 ```
     24 
     25 Note the lack of transaction management and calls to `_v.patch()`.
     26 That is all handled by the script applying the patches so you can have just the relevant SQL code below the header.