Unable to install Discourse Question Answer: ON CONFLICT DO NOTHING

It’s looking like there’s an issue with the ‘vote_history’ field:

I, [2022-09-05T19:39:21.422820 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
2022-09-05 19:39:34.506 CST [819] discourse@discourse ERROR:  cannot extract elements from a scalar
2022-09-05 19:39:34.506 CST [819] discourse@discourse STATEMENT:  INSERT INTO question_answer_votes (post_id, user_id, created_at)
        SELECT
          X.post_id AS post_id,
          (X.value->>'user_id')::int AS user_id,
          (X.value->>'created_at')::timestamp AS created_at
        FROM (
          SELECT
            post_id,
            jsonb_array_elements(value::jsonb) AS value
          FROM post_custom_fields WHERE name = 'vote_history'
        ) AS X
        WHERE (X.value->>'action') != 'destroy'
        ORDER BY (X.value->>'created_at')::timestamp DESC
        ON CONFLICT DO NOTHING

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

There was another report of a similar error recently - Bootstrap failed with exit code 1 Though no solution posted there yet.

Perhaps this is a conflict with having previously installed the Pavilion plugin? @Hifihedgehog, did your site also previously have that installed too?

1 Like