1.0 Beta Migration

Use one of the following scripts to migrate from RelStorage 1.0 beta to
RelStorage 1.0.  Alter the scripts to match the Python default encoding.
For example, if 'import sys; print sys.getdefaultencoding()' says the
encoding is "iso-8859-1", change all occurrences of 'UTF-8' or 'UTF8'
to 'ISO-8859-1'.


PostgreSQL 8.3 (using the psql command):

    ALTER TABLE transaction
        ALTER username TYPE BYTEA USING (convert_to(username, 'UTF-8')),
        ALTER description TYPE BYTEA USING (convert_to(description, 'UTF-8'));

PostgreSQL 8.2 and below (using the psql command):

    ALTER TABLE transaction
        ALTER username TYPE BYTEA USING
            (decode(replace(convert(username, 'UTF-8'), '\\', '\\\\'), 'escape')),
        ALTER description TYPE BYTEA USING
            (decode(replace(convert(description, 'UTF-8'), '\\', '\\\\'), 'escape'));

MySQL (using the mysql command):

    ALTER TABLE transaction
        MODIFY username BLOB NOT NULL,
        MODIFY description BLOB NOT NULL;

Oracle (using the sqlplus command):

    ALTER TABLE transaction ADD (
        new_username    RAW(255),
        new_description RAW(2000),
        new_extension   RAW(2000));

    UPDATE transaction
        SET new_username = UTL_I18N.STRING_TO_RAW(username, 'UTF8'),
            new_description = UTL_I18N.STRING_TO_RAW(description, 'UTF8'),
            new_extension = extension;

    ALTER TABLE transaction DROP (username, description, extension);
    ALTER TABLE transaction RENAME COLUMN new_username TO username;
    ALTER TABLE transaction RENAME COLUMN new_description TO description;
    ALTER TABLE transaction RENAME COLUMN new_extension TO extension;

