Below is the SQL script for PostgreSQL that upgrades the schema from 0.9.12 to 1.0.0

-- This SQL script upgrades the database schema for manitou-mail
-- from 0.9.12 to 1.0.0 version

\set ON_ERROR_STOP 1

BEGIN;
ALTER TABLE body DROP COLUMN textsize;
ALTER TABLE body ADD bodyhtml TEXT;

ALTER TABLE header DROP COLUMN header_size;
ALTER TABLE mail DROP COLUMN msg_day;

ALTER TABLE mail RENAME attachments TO flags;
UPDATE mail SET flags=1 WHERE flags!=0;
UPDATE mail SET flags=flags|2 WHERE mail_id in (select mail_id from notes);

UPDATE runtime_info SET rt_value='1.0.0' WHERE rt_key='schema_version';

END