User Tools

Site Tools


dev:sqitch

This is an old revision of the document!


Using Sqitch with Evergreen

Getting Started

Install Sqitch
# Works on most systems.  See sqitch.org for more.
$ sudo cpan App::Sqitch
Install Base Schema
  1. Install the latest working branch from LP 1521693 and use the standard DB install tools.
  2. Alternatively, you can create a database manually with the working branch checked out like so:
$ cd Open-ILS/src/sql/schema
$ sudo -u postgres psql --set db_name=evergreen -f tools/create_database_extensions.sql

Creating an Upgrade Script

For this example, we're cross-porting an existing SQL upgrade script for LP #1319998.

Full code is tracked in commit c999d04.

$ cd Open-ILS/src/sql/schema
$ sqitch add schema.materialized_billing_summary_delete_trigger \
    --requires schema.no_delete_acq_cancel_reasons \
    -n 'Cross porting LP#1319998 schema.materialized_billing_summary_delete_trigger' 
  • The –requires flag specifies which commit our new commit depends on. For consistency with existing SQL upgrades, I apply all changes sequentially, so the –requires value points to the previous Sqitch install target. Or, in other words, the last/bottom target in the sqitch.plan file.
  • -n specifies a Sqitch "commit" message which appears in the Sqitch log output.

'sqitch add' adds a line to sqitch.plan to track the new install target and creates 3 new files:

deploy/schema.materialized_billing_summary_delete_trigger.sql
revert/schema.materialized_billing_summary_delete_trigger.sql
verify/schema.materialized_billing_summary_delete_trigger.sql
  • The deploy/ file includes our new change
  • The revert/ file includes SQL that allows us to roll back the changes in the deploy script.
    • For example, when deploying a modified function, as is the case with this example, the revert/ file will include the original functoin definition.
  • The verify/ file contains SQL to confirm the changes in the deploy/ file were properly deployed.

For example, see the contents of these 3 files at commit c999d04.

dev/sqitch.1451404947.txt.gz · Last modified: 2022/02/10 13:34 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.