Upgrading to Habari 0.9.2

I was upgrading alasdairsmith.uk from Habari 0.8 to 0.9.2 today. It went fairly smoothly; however, none of my posts were being displayed.

Checking the logs

I checked the Habari logs in the admin section and found various entries of:

PDOStatement::execute(): SQLSTATE[22001]: String data, right truncated: 7 ERROR: value too long for type character varying(255) in system/classes/databaseconnection.php:274

There were corresponding entries in my PostgreSQL log:

BST ERROR:  column posts.input_formats does not exist at character 171
BST ERROR:  column "active" of relation "crontab" does not exist at character 20
BST STATEMENT:  UPDATE crontab SET active = $1 , callback = $2 , cron_class = $3 , description = $4 , end_time = $5 , failures = $6 , increment = $7 , last_run = $8 , name = $9 , next_run = $10 , notify = $11 , result = $12 , start_time = $13 WHERE 1=1 AND cron_id = $14
BST ERROR:  value too long for type character varying(255)

Checking the database

A quick check of my habari database confirms that, indeed, the posts table does not have an input_formats column. Similarly the columns failures and active were also missing from crontab.

postgres@linode99617:~$ psql
psql (8.4.17)
Type "help" for help.

postgres=# \c alasdair_habari
psql (8.4.17)
You are now connected to database "alasdair_habari".
alasdair_habari=# \d posts
                                      Table "public.posts"
     Column     |          Type          |                      Modifiers
 id             | bigint                 | not null default nextval('posts_pkey_seq'::regclass)
 slug           | character varying(255) | not null
 content_type   | integer                | not null
 title          | character varying(255) | not null
 guid           | character varying(255) | not null
 content        | text                   | not null
 cached_content | text                   | not null
 user_id        | integer                | not null
 status         | integer                | not null
 pubdate        | integer                | not null
 updated        | integer                | not null
 modified       | integer                | not null
    "posts_pkey" PRIMARY KEY, btree (id)
    "posts_slug_key" UNIQUE, btree (slug)

Adding the columns

I added the missing columns and everything seems to be working now.

alasdair_habari=# ALTER TABLE posts ADD COLUMN input_formats VARCHAR(255) NOT NULL DEFAULT '';
alasdair_habari=# ALTER TABLE crontab ADD COLUMN failures INTEGER NOT NULL DEFAULT 0;
alasdair_habari=# ALTER TABLE crontab ADD COLUMN active SMALLINT NOT NULL DEFAULT 1;


Your email address will not be published. I need it to send you a verification link. It will also be sent to Gravatar to check if you have one.