All posts changed to post_type=3 while migration

Hi,

as described here Upgrade fails while migrating we’re currently upgrading from a very old installation of discourse to the current v2.3.2. We’ve recognized that all posts have been changed to post_type=3 while the migration-process.

We’ve seen that an old but updated migration-script causes this “destruction”.

It seems that it has to be this way to make the string-append work:

sql = "UPDATE posts SET action_code = 'autoclosed.enabled', post_type = 3 "
sql += "WHERE post_type = 2 AND ("
sql += strings.map { |s| "raw ~* #{ActiveRecord::Base.connection.quote(s)}" }.join(' OR ')
sql += ")"

The current migration-step produces this query/output:

== 20150729150523 MigrateAutoClosePosts: migrating ============================
-- execute("UPDATE posts SET action_code = 'autoclosed.enabled', post_type = 3 ")

Kind Regards
Sascha

3 Likes

@gerhard can you fix that migration and validate that our migrations are “frozen-strings”-compatible?

1 Like

Thanks for reporting that issue. Fixed in FIX: Migrations tried to change frozen string · discourse/discourse@a8cdd68 · GitHub

5 Likes