instructure / analytics

The official analytics package for Instructure's Canvas LMS.
GNU Affero General Public License v3.0
35 stars 32 forks source link

MakeWikiPageContextNotNull migration fails with context_type fields all null #7

Closed breiter closed 6 years ago

breiter commented 6 years ago
==  MakeWikiPageContextNotNull: migrating =====================================
-- change_column_null(:wiki_pages, :context_type, false)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::NotNullViolation: ERROR:  column "context_type" contains null values
: ALTER TABLE "wiki_pages" ALTER "context_type" SET NOT NULL

I'm trying to perform an in-place update of canvas and I'm running into a problem where the context_type field for every row in the wiki_pages table is null, which causes the data migration to fail.

I can see that there is a class /lib/data_fixup/populate_context_on_wiki_pages.rb that should populate context_id and context_type, but it isn't quite obvious to me how to determine and manually correct values context_id and context_type on the wiki_pages table.