# Bug OP-15537 - FixDeletedDataJournals migration can fail sometimes

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 14.5.0 |
| Observed in versions | 14.3.0 |
| Sprint | 14.5.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 14.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 | Oliver Günther |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

### Steps to reproduce

*Please write down the steps to reproduce. Try to write down all necessary preconditions (what permissions do you have, are other users involved?). Example:*

1.  Upgrade to OpenProject 14.3.0

### What is the buggy behavior?

*Please describe the bug in as much detail as possible. Example:*

  - FixDeletedDataJournals migration can fail with follwoing error:

I, [2024-07-31T09:59:46.776240 <mention class="mention" data-id="3635" data-type="work_package" data-text="#3635">#3635</mention>]  INFO -- : Migrating to FixDeletedDataJournals (20220818074159)  
\== 20220818074159 FixDeletedDataJournals: migrating ===========================  
rake aborted\!  
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

uninitialized constant WikiContent  
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.2/lib/active\_support/inflector/methods.rb:290:in \`constantize'  
/opt/openproject/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.2/lib/active\_support/core\_ext/string/inflections.rb:74:in \`constantize'  
/opt/openproject/db/migrate/20220818074159\_fix\_deleted\_data\_journals.rb:119:in \`block in get\_missing\_journals'  
/opt/openproject/db/migrate/20220818074159\_fix\_deleted\_data\_journals.rb:118:in \`to\_h'  
/opt/openproject/db/migrate/20220818074159\_fix\_deleted\_data\_journals.rb:118:in \`get\_missing\_journals'  
/opt/openproject/db/migrate/20220818074159\_fix\_deleted\_data\_journals.rb:31:in \`up'

### What is the expected behavior?

*Describe how the application should behave like. Example:*

1.  The migration will fail in versions 14.x+

2.  We inform the user what to do without an internal error

### Workaround:

Open SQL console:

``` shell
sudo su - postgres -c psql
```

Insert the following commands:

``` sql
\c openproject
INSERT INTO schema_migrations (version) VALUES (20220818074159);
```

Run openproject configure command:

``` shell
sudo openproject configure
```

Open SQL console again:

``` text
sudo su - postgres -c psql
```

Run the following commands:

``` shell
\c openproject
DELETE FROM schema_migrations WHERE version='20220818074159';
```

Run  openproject configure  again:

``` text
sudo openproject configure
```
