DB Migration cancelled midway in "release/2024-11-20"

57 views
Skip to first unread message

Anand Srinivasan

unread,
May 30, 2025, 7:45:46 AMMay 30
to Canvas LMS Users
Hi all!


In the process of upgrading our self-hosted Canvas instance to the latest version, we have been performing DB migrations incrementally for every monthly release. Migrations until release tag "release/2024-10-23.232" were successful.

However, there is an error when migrating the DB under the "release/2024-11-20.285" release tag:

.
.
...
==  AddExpandedToDiscussionTopicParticipants: migrating =======================
-- add_column(:discussion_topic_participants, :expanded, :boolean, {:null=>false, :default=>false})
   -> 0.0010s
==  AddExpandedToDiscussionTopicParticipants: migrated (0.0010s) ==============

==  AddArchivedAtToCoursesAndEnrollments: migrating ===========================
-- add_column(:courses, :archived_at, :datetime)
   -> 0.0007s
-- add_column(:enrollments, :archived_at, :datetime)
   -> 0.0005s
==  AddArchivedAtToCoursesAndEnrollments: migrated (0.0013s) ==================

==  CreateRubricAssessmentImports: migrating ==================================
-- create_table(:rubric_assessment_imports, {:if_not_exists=>true})
rake aborted!
StandardError: An error has occurred, all later migrations canceled: (StandardError)

PG::SyntaxError: ERROR:  syntax error at or near "TRIGGER"
LINE 1: CREATE OR REPLACE TRIGGER guard_excessive_updates AFTER UPDA...

                          ^
 ~/canvas-lms/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `exec'
 ~/canvas-lms/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `block (2 levels) in raw_execute'
...
.
.

Greatly appreciate any help in this regard!


Thanks,
Anand

Cody Cutrer

unread,
May 30, 2025, 11:41:29 AMMay 30
to canvas-l...@googlegroups.com
The error is due to using syntax (the `OR REPLACE` portion of creating a trigger) that requires PostgreSQL 14. You'll need to upgrade your PostgreSQL server first.

Cody Cutrer
Software Engineer
Instructure

--

---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/canvas-lms-users/a833481d-eb86-4df1-b275-5f60214b1b26n%40googlegroups.com.

Anand Srinivasan

unread,
Jun 2, 2025, 8:19:53 AMJun 2
to Canvas LMS Users
We thought that PostgreSQL 12 was the minimum version required, but it proved otherwise.

Switching to PostgreSQL 14 resolved the problem.

Thanks, Cody!!!

Reply all
Reply to author
Forward
0 new messages