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

[#63912] Try to fix migrations CI run.

Pavel Balashou4d35299d67f4
diff --git a/app/models/principal.rb b/app/models/principal.rb
index 4706cde6a2f..c031896c8cb 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -122,6 +122,8 @@ class Principal < ApplicationRecord
before_create :set_default_empty_values
+ self.ignored_columns += [:identity_url]
+
# Columns required for formatting the principal's name.
def self.columns_for_name(formatter = nil)
raise NotImplementedError, "Redefine in subclass" unless self == Principal
diff --git a/app/models/user.rb b/app/models/user.rb
index dc09e8cd937..15a23b29511 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -111,8 +111,6 @@ class User < Principal
:with_time_zone,
:having_reminder_mail_to_send
- self.ignored_columns += [:identity_url]
-
def self.create_blocked_scope(scope, blocked)
scope.where(blocked_condition(blocked))
end
diff --git a/db/migrate/20230731153909_add_file_link_journals_to_existing_containers.rb b/db/migrate/20230731153909_add_file_link_journals_to_existing_containers.rb
index 558664edd23..d4482548176 100644
--- a/db/migrate/20230731153909_add_file_link_journals_to_existing_containers.rb
+++ b/db/migrate/20230731153909_add_file_link_journals_to_existing_containers.rb
@@ -30,6 +30,7 @@
class AddFileLinkJournalsToExistingContainers < ActiveRecord::Migration[7.0]
def up
+ SystemUser.reset_column_information
system_user = SystemUser.first
containers = Storages::FileLink.includes(:container).map(&:container).uniq.compact
diff --git a/db/migrate/20240131130134_fix_inherited_group_memberships.rb b/db/migrate/20240131130134_fix_inherited_group_memberships.rb
index c1698c5a00e..5740d8e2e2f 100644
--- a/db/migrate/20240131130134_fix_inherited_group_memberships.rb
+++ b/db/migrate/20240131130134_fix_inherited_group_memberships.rb
@@ -2,6 +2,7 @@ class FixInheritedGroupMemberships < ActiveRecord::Migration[7.0]
def up
# Recreate member_roles for all group members
# due to regression https://community.openproject.org/work_packages/52528
+ Group.reset_column_information
Group
.where(id: Member.where(project_id: nil, user_id: Group.select(:id)).select(:user_id))
.find_each do |group|
diff --git a/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb b/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb
index dc762df5909..d697bb2bb80 100644
--- a/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb
+++ b/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb
@@ -154,7 +154,7 @@ RSpec.describe Queries::PlaceholderUsers::PlaceholderUserQuery do
describe "#results" do
it "is the same as handwriting the query" do
- expected = "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"type\" = 'PlaceholderUser' ORDER BY \"users\".\"lastname\" DESC, \"users\".\"id\" DESC"
+ expected = "SELECT \"users\".\"id\", \"users\".\"login\", \"users\".\"firstname\", \"users\".\"lastname\", \"users\".\"mail\", \"users\".\"admin\", \"users\".\"status\", \"users\".\"last_login_on\", \"users\".\"language\", \"users\".\"ldap_auth_source_id\", \"users\".\"created_at\", \"users\".\"updated_at\", \"users\".\"type\", \"users\".\"first_login\", \"users\".\"force_password_change\", \"users\".\"failed_login_count\", \"users\".\"last_failed_login_on\", \"users\".\"consented_at\", \"users\".\"webauthn_id\" FROM \"users\" WHERE \"users\".\"type\" = 'PlaceholderUser' ORDER BY \"users\".\"lastname\" DESC, \"users\".\"id\" DESC"
expect(instance.results.to_sql).to eql expected
end
diff --git a/spec/views/users/edit.html.erb_spec.rb b/spec/views/users/edit.html.erb_spec.rb
index 893f53d2228..43b84ef74cf 100644
--- a/spec/views/users/edit.html.erb_spec.rb
+++ b/spec/views/users/edit.html.erb_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe "users/edit" do
end
context "authentication provider" do
- let(:user) { create(:user, identity_url: "#{provider}:veryuniqueid") }
+ let(:user) { create(:user, identity_url: "#{provider.slug}:veryuniqueid") }
let(:provider) { create(:oidc_provider, slug: "test_provider", display_name: "The Test Provider") }
before do