2024/8/6

Craft の composer.json を書き換えたときは craft up も実行しておく

Craft 5.3 のベータが出たと思ったら、

5.3 はもうリリースされた

Craft 5.3 Released | Craft CMS
https://craftcms.com/blog/craft-5-3-released

先日試したときは beta をインストール出来ないなぁ、、、と思っていて、サポートに聞いてみたら、以下の手順を教えてくれた。
Tommyさんが日本語で回答してくれるのでありがたすぎる。。。(一応英語もつけてメールしているが)

composer.json で 5.3.0-beta.2 に設定
composer update
craft up

craft up をやっていなかった。

craft up を実行したところmigrationするかを聞かれて

$ ./craft up
Checking for pending Craft and plugin migrations ...
Total 2 new Craft migrations to be applied:
    - m240723_214330_drop_bulkop_fk
    - m240731_053543_soft_delete_fields

Apply the above migrations? (yes|no) [no]:yes
Create database backup? (yes|no) [yes]:
Backing up the database ... done
*** applying m240723_214330_drop_bulkop_fk
    > dropping foreign key on {{%elements_bulkops}} if it exists ... done (time: 0.013s)
*** applied m240723_214330_drop_bulkop_fk (time: 0.020s)

*** applying m240731_053543_soft_delete_fields
    > add column dateDeleted datetime NULL DEFAULT NULL AFTER `dateUpdated` to table {{%fields}} ... done (time: 0.013s)
    > create index idx_ggluzpvacjtlqxjusdvotzytxkglshfzxwnp on {{%fields}} (dateDeleted) ... done (time: 0.016s)
*** applied m240731_053543_soft_delete_fields (time: 0.034s)


2 migrations were applied.

Migrated up successfully.

Checking for pending content migrations ...
No new migrations found. Your system is up-to-date.

無事 5.3 ベータがインストール出来た。

@BUN に聞いてみたら、composer.json 書き換えて composer update した後は ./craft migrate/all./craft up はやっておいた方がよさそうな感じだった。
今後気をつけていこう。


ちなみに終わってないなーと、途中で終わってたと思われるのはこんな感じ

$ composer update
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer8/src/Composer/Autoload/AutoloadGenerator.php:879
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer8/src/Composer/Autoload/AutoloadGenerator.php:884
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 4 updates, 0 removals
  - Upgrading craftcms/cms (5.2.10 => 5.3.0-beta.2)
  - Upgrading enshrined/svg-sanitize (0.16.0 => 0.19.0)
  - Upgrading yiisoft/yii2 (2.0.50 => 2.0.51)
  - Upgrading yiisoft/yii2-debug (2.1.22 => 2.1.25)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 4 updates, 0 removals
  - Upgrading craftcms/cms (5.2.10 => 5.3.0-beta.2): Extracting archive
  - Upgrading yiisoft/yii2 (2.0.50 => 2.0.51): Extracting archive
  - Upgrading yiisoft/yii2-debug (2.1.22 => 2.1.25): Extracting archive
  - Upgrading enshrined/svg-sanitize (0.16.0 => 0.19.0): Extracting archive
Generating optimized autoload files

  Seems you have upgraded Yii Framework from version 2.0.50 to 2.0.51.

  Please check the upgrade notes for possible incompatible changes
  and adjust your application code accordingly.

  Upgrade from Yii 2.0.50
  -----------------------
  
  * Correcting the behavior for `JSON` column type in `MariaDb`.
  
  Example usage of `JSON` column type in `db`:
  
  ```php
  <?php
  
  use yii\db\Schema;
  
  $db = Yii::$app->db;

以下略