# Bug OP-19253 - Migration: 20250929070310 AddViewAllPrincipalsPermissionToExistingRoles failing on upgrade

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-19253

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Project member, Administration / Roles and permissions / Global roles and permissions, Administration / Roles and permissions / Project roles and permissions |
| Target versions | 17.4.0 |
| Observed in versions | 17.3.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) | 17.3.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Oliver Günther |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Install OpenProject 16.6.5
    
2.  Create a user and a group
    
3.  Add the user to the group
    
4.  Add the group as a member to project with the `Project admin` role
    
5.  Upgrade to 17.3.1
    

### What is the buggy behavior?

*   The Migration fails:
    

```text
seeder-1  | == 20250929070310 AddViewAllPrincipalsPermissionToExistingRoles: migrating ====
seeder-1  | Executing database migrations...
seeder-1  | rake aborted!
seeder-1  | StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
seeder-1  |
seeder-1  | PG::UndefinedTable: ERROR:  relation "group_details" does not exist
seeder-1  | LINE 10:  WHERE a.attrelid = '"group_details"'::regclass
...
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.2.1/lib/active_support/callbacks.rb:130:in 'block in ActiveSupport::Callbacks#run_callbacks'
seeder-1  | /app/app/services/base_services/base_callable.rb:70:in 'BaseServices::BaseCallable#assign_state'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.2.1/lib/active_support/callbacks.rb:130:in 'block in ActiveSupport::Callbacks#run_callbacks'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.2.1/lib/active_support/callbacks.rb:141:in 'ActiveSupport::Callbacks#run_callbacks'
seeder-1  | /app/app/services/base_services/base_callable.rb:41:in 'BaseServices::BaseCallable#call'
seeder-1  | /app/app/services/members/add_role_service.rb:45:in 'Members::AddRoleService#call'
seeder-1  | /app/db/migrate/20250929070310_add_view_all_principals_permission_to_existing_roles.rb:70:in 'block in AddViewAllPrincipalsPermissionToExistingRoles#add_global_role_for_manage_members'
seeder-1  | /app/db/migrate/20250929070310_add_view_all_principals_permission_to_existing_roles.rb:68:in 'Array#each'
seeder-1  | /app/db/migrate/20250929070310_add_view_all_principals_permission_to_existing_roles.rb:68:in 'AddViewAllPrincipalsPermissionToExistingRoles#add_global_role_for_manage_members'
seeder-1  | /app/db/migrate/20250929070310_add_view_all_principals_permission_to_existing_roles.rb:48:in 'AddViewAllPrincipalsPermissionToExistingRoles#up'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activerecord-8.1.2.1/lib/active_record/migration.rb:999:in 'Kernel#public_send'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activerecord-8.1.2.1/lib/active_record/migration.rb:999:in 'ActiveRecord::Migration#exec_migration'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activerecord-8.1.2.1/lib/active_record/migration.rb:980:in 'block (2 levels) in ActiveRecord::Migration#migrate'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activesupport-8.1.2.1/lib/active_support/benchmark.rb:17:in 'ActiveSupport::Benchmark.realtime'
seeder-1  | /app/vendor/bundle/ruby/4.0.0/gems/activerecord-8.1.2.1/lib/active_record/migration.rb:979:in 'block in ActiveRecord::Migration#migrate'
...
```

*   <br>
    

### What is the expected behavior?

1.  The migration runs without any issue
    
    <br>
    

### Workaround

<br>

As a workaround it is possible to skip the migration and execute it after the other migrations have been run.

```bash
sudo su - postgres -c 'psql -d openproject' #open db console
INSERT INTO schema_migrations (version) VALUES (20250929070310);

sudo openproject configure # run migrations

sudo su - postgres -c 'psql -d openproject' # open db console again
DELETE FROM schema_migrations WHERE version='20250929070310';

sudo openproject configure #run migrations again
```

<br>
