Forum OpenACS Q&A: How I'm upgrading from ACS 3.4.10 Oracle to OpenACS 4.6orso Postgres

I've ported my first package to OpenACS, and I'm now in the process of creating upgrade scripts to port our company's Intranet up to OpenACS.

This is a small Intranet, with only about 25 users, running on Oracle and ACS 3.4.10.

We're upgrading to OpenACS, both to take advantage of the new dotWRK initiative (and to participate in creating it), and all the advantages of being a part of a living code stream instead of a static one.

For anybody else that's upgrading, here are some other webpages to look at:

http://jongriffin.com/static/openacs/acs-conversion/upgrade
https://openacs.org/faq/one-faq?faq_id=43841
https://openacs.org/doc/openacs-3/html/oracle-to-pg-porting.html
http://grumet.net/random/mikes-migration-guide/

What I'm doing is setting up a table that contains the old and new user_ids (so I can map the old values to the new values). I'll probably do this as a package, if anybody else wants it. I've just started working on it. It's nothing complicated, just a table with the old value and the new value.

I am creating an export script for every table I need from the old Intranet, and an import script for every table in the new Intranet. This will be easiest for my own custom packages -- much more difficult for things like the projects and user_groups tables in ACS 3.4.10. I haven't quite solved that problem yet.

The export scripts looks something like this:

# /packages/packagename/www/upgrade/export.tcl

ad_page_contract {
    page which exports the packagename table

    @author mailto:jader@bread.com
    @cvs-id $Id$
    @creation-date 3/14/03

} {
}

ns_write "<html><table>"

set file_stream [open /tmp/packagename.export w]

db_foreach get_brand "
...
" {
    puts $file_stream "@%@%@<oneitem>$oneitemvalue</oneitem>..."

    ns_write "<tr><td>$oneitemvalue</td>..."
}

close $file_stream

ns_write "</table></html>"

----------

The import script (unfinished) looks like this so far:

# /packages/packagename/www/upgrade/import.tcl

ad_page_contract {
    page which imports the packagename table

    @author mailto:jader@bread.com
    @cvs-id $Id$
    @creation-date 3/14/03

} {
}

set file_stream [open /tmp/packagename.export r]

set the_whole_file [read -nonewline $file_stream]

close $file_stream

set list_of_lines [split $the_whole_file "@%@%@"]

ns_write "<html><table border=1 cellspacing=0>"

db_dml delete_all "delete from packagename"

# determine highest value for sequence
set highest_seq_value -1

foreach line $list_of_lines {

    if {[exists_and_not_null line]} {
        regexp {<oneitem>(.*)</oneitem>} $line match oneitem

        ns_write "
        <tr>
        <td>$oneitem

        if {$index_value > $highest_seq_value} {
            set highest_seq_value $index_value
        }

        # get the user_id from a user_map table
        set user_id [db_string get_user_id xxxxxxx]

        db_exec_plsql new_packagetablename "
        select packagename__new(...)"
    }
}

I'll keep this thread updates if I come across any major snags, or change the way I go about this. I thought this might be helpful for anyone else going through an ACS to OpenACS migration.

I've copied this posting to:

http://rubick.com/openacs/acs_to_openacs

I'll be keeping the edited and updated version there.