<p>According to P&amp;T this is expected behavior. Their solution is to put this in config/app.php:</p>

<pre><code>'components' =&gt; [
    'projectConfig' =&gt; function() {
        $config = craft\helpers\App::projectConfigConfig();
        $config['readOnly'] = false;
        return Craft::createObject($config);
    },
],
</code></pre>

<p><em>(Thanks Oli, Brandon, Andris!)</em></p>

<p>Since I do all migration via Craft's console commands, this shorter solution works for me:</p>

<pre><code>'allowAdminChanges' =&gt; (php_sapi_name() === 'cli')
</code></pre>

<p>It simply enables admin changes when using the console command.</p>

CC BY-SA 4.0
2019-05-17T07:50:16.387Z
2019-05-17T07:50:16.387Z
Matthias Redl-Mann
<p>One of the recent Craft updates (something close to 3.1.25) also brought a redactor migration (<a href="https://github.com/craftcms/redactor/blob/v2/src/migrations/m190225_003922_split_cleanup_html_settings.php" rel="nofollow noreferrer">https://github.com/craftcms/redactor/blob/v2/src/migrations/m190225_003922_split_cleanup_html_settings.php</a>), which fails when those 2 configs are disabled:</p>

<pre><code>'allowAdminChanges' =&gt; false,
'useProjectConfigFile' =&gt; false,
</code></pre>

<p>The reason why it fails is that the migration tries to do something with projectConfig, which is read only when allowAdminChanges is disabled.</p>

<redactor><migration><projectconfig>
Redactor migration might fail with allowAdminChanges & useProjectConfigFile false
# Redactor migration might fail with allowAdminChanges & useProjectConfigFile false

(Asked by: username_0 on 2019-05-17)

One of the recent Craft updates (something close to 3.1.25) also brought a redactor migration (https://github.com/craftcms/redactor/blob/v2/src/migrations/m190225_003922_split_cleanup_html_settings.php), which fails when those 2 configs are disabled:
'allowAdminChanges' => false,
'useProjectConfigFile' => false,

The reason why it fails is that the migration tries to do something with projectConfig, which is read only when allowAdminChanges is disabled.

**Tags:** redactor, migration, projectconfig


---

## 1 answers

### Answer by username_0 on 2019-05-17. Score: 2

According to P&T this is expected behavior. Their solution is to put this in config/app.php:
'components' => [
    'projectConfig' => function() {
        $config = craft\helpers\App::projectConfigConfig();
        $config['readOnly'] = false;
        return Craft::createObject($config);
    },
],

(Thanks Oli, Brandon, Andris!)
Since I do all migration via Craft's console commands, this shorter solution works for me:
'allowAdminChanges' => (php_sapi_name() === 'cli')

It simply enables admin changes when using the console command.


---

