From 13c6bf54d0d08363ac36b0755a7a26386b6768e6 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Sat, 6 Apr 2019 20:38:14 -0400 Subject: [PATCH] FIX: Sometimes queued post would have a string for a category In this case, don't migrate the old queued post category --- db/migrate/20190111170824_migrate_reviewable_queued_posts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190111170824_migrate_reviewable_queued_posts.rb b/db/migrate/20190111170824_migrate_reviewable_queued_posts.rb index c673777db93..b83b1166eb8 100644 --- a/db/migrate/20190111170824_migrate_reviewable_queued_posts.rb +++ b/db/migrate/20190111170824_migrate_reviewable_queued_posts.rb @@ -17,7 +17,7 @@ class MigrateReviewableQueuedPosts < ActiveRecord::Migration[5.2] user_id, true, topic_id, - nullif(post_options->>'category', '')::int, + NULLIF(REGEXP_REPLACE(post_options->>'category', '[^0-9]+', '', 'g'), '')::int, json_build_object( 'old_queued_post_id', id, 'raw', raw