# Bug OP-19359 - Migration 20250929070310 failing due to update code failing on not-yet fully migrated schema

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 17.4.1 |
| Observed in versions | 17.4.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) | 17.4.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 |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

Very similar to [previous bug](https://community.openproject.org/projects/openproject/work_packages/74539/activity), but still relevant.

### Steps to reproduce

1.  Setup clean 16.6.10
    
2.  Create user and group and add user to that group
    
3.  Add group to the project with Project admin role.
    
4.  Try to migrate to 17.4.0
    

### What is the buggy behavior?

Migration failed

### What is the expected behavior?

_Migration successful_

### **Logs**

> rake aborted!  
> StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
> 
> PG::UndefinedTable: ERROR: &nbsp;relation &quot;group\_details&quot; does not exist  
> LINE 1: ...\_descendants(id) AS ( SELECT gd.principal\_id FROM group\_deta...

Full stacktrace attached as file/

### Additional scenario

Similarly to the error above, this migration can also fail in other ways depending on the data in the OpenProject environment. The 2nd case may happen when users have the `manage_members` permission which then ends in the following error during the migration:

```text
Undeclared attribute type for enum 'sharing' in Meeting. Enums must be backed by a database column or declared with an explicit type via `attribute`.
```

The full logs for this scenario are attached as [migration-errror-meeting-enum.log](https://community.openproject.org/attachments/921441/migration-errror-meeting-enum.log).

The workaround (for the packaged installation) for that particular case is to do the following:

1.  apt update &amp; apt upgrade
    
2.  comment out line 48 in /opt/openproject/db/migrate/20250929070310\_add\_view\_all\_principals\_permission\_to\_existing\_roles.rb
    
3.  openproject run configure
    
4.  openproject run console with:  
    require Rails.root.join(&quot;db/migrate/20250929070310\_add\_view\_all\_principals\_permission\_to\_existing\_roles.rb&quot;)  
    AddViewAllPrincipalsPermissionToExistingRoles.new.send :add\_global\_role\_for\_manage\_members
    

### Environment information

*   Docker-compose installation
    
*   Docker development environment
    

**OpenProject version**

16.6.10 → 17.4.0
