Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Extend error message when migration fails due to two schemas

Oliver Günther991380b7e54c
diff --git a/db/migrate/20210512121322_make_project_identifier_unique.rb b/db/migrate/20210512121322_make_project_identifier_unique.rb
index 2ec84f329e5..ad3eeb3edc6 100644
--- a/db/migrate/20210512121322_make_project_identifier_unique.rb
+++ b/db/migrate/20210512121322_make_project_identifier_unique.rb
@@ -1,6 +1,18 @@
class MakeProjectIdentifierUnique < ActiveRecord::Migration[6.1]
def change
- remove_index :projects, :identifier
+ begin
+ remove_index :projects, :identifier
+ rescue => e
+ raise <<~MESSAGE
+ Failed to remove an index from the OpenProject database: #{e.message}
+
+ You likely have two OpenProject database schemas running at the same time since migrating
+ from MySQL to PostgreSQL.
+
+ Please follow the following guide in our forums on how to correct this error before continuing the upgrade:
+ https://community.openproject.org/topics/13672?r=13736#message-13736
+ MESSAGE
+ end
begin
add_index :projects, :identifier, unique: true