# Bug OP-8391 - Can't delete old project: CostObject to Budget migration doesn't update journalable_type

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 12.0.0 |
| Observed in versions | 11.1.0 |
| Sprint | 12.0.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 11.1.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

### **Environment**:

Your OpenProject Version: 11.1.2 / Self-hosted custom packages

openSUSE Leap 15.2 / Firefox / English

(I'm not sure whether you can officially support this environment but—at least to my untrained eye—this looks like an actual bug and not just a dependency problem.)

### **Logs**

Relevant output of `journalctl -u openproject-background-jobs.service --reverse` is attached as a text file.

### **Steps to reproduce:**

1.  Start with an old OpenProject installation from before 10 August 2020
2.  Use the Time and Costs module
3.  Upgrade to the latest version of OpenProject
4.  Attempt to delete the old project

### **Actual Behavior**

Project becomes archived but never deleted, background worker fails to delete the project.

### **Expected Behavior**

Project is permanently deleted.

### Technical Details

After noticing that the only reference to "CostObject" in the code is in the [migration](https://github.com/opf/openproject/blob/dev/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rb) that renames it to "Budget" I decided to peruse tables that seemed like they might be relevant based on the error. Sure enough:

<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20707/content"></div><figcaption class="op-uc-figure--description">Screenshot of LibreOffice Base highlighting the row with the mistake</figcaption></figure>

It looks like the migration I linked to doesn't update the `journalable_type` column. I was tempted to edit the database manually with LibreOffice Base but didn't want to cause more problems in case the error affects more than just that one row.
