50.48%
Search · Index

III.10.19 Writing upgrade scripts

by Jade Rubick

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

If your package changes its data model, you have to write an upgrade script. This is very easy in OpenACS.

First, you want to make sure you change the original .sql file so that new installation will have the new data model.

Next, check what version your package is currently at. For example, it may be at version 1.0b1. Create a file in sql/postgres/upgrade called packagename-1.0b1-1.0b2.sql and put the SQL code that will update the data model. For example, if you add in a column, you would have an alter table add column statement in this file. Test this out very well, because data model changes are more serious and fundamental changes than the program .tcl files.

Now use the APM to create a new package version 1.0b2. Commit all your changes, tag the release (the section called “Distributing upgrades of your package”), and both new installations and upgrades will be taken care of.