0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laravel マイグレーション deploy:failed に関して

Last updated at Posted at 2019-11-11

テスト環境のdeployで発生したエラー

migrationで新規テーブル作成及び既存テーブルに項目追加

テーブル content_file_table 追加
2019_10_29_162318_create_content_file_table.php
テーブル content_front_pageに seederでデータを 追加
2019_10_31_135533_insert_content_front_page_table.php

下記の内容でseederでデータを 追加する
スクリーンショット 2019-11-11 12.19.16.png

deployで発生したエラー内容

下記のエラーが出たSeederの問題かと思い、InsertContentFrontPageTableSeeder調べても特に問題なし
スクリーンショット 2019-11-11 11.35.22.png

deployで発生したエラー調査

「artisan migrate --force" failed.」なので、Laravelのログを調べたら下記のエラーがあった。

Syntax error or access violation: 1067 Invalid default value for 'created_at' (SQL: create table `tbl_content_file` (`

Seederの問題ではなく、tbl_content_fileテーブル作成時の問題ぽい。
2019_10_29_162318_create_content_file_table.phpを調べたら「作成日時」でSyntax errorだった。

赤く表示された「artisan migrate --force" failed.」メッセージのもっと上の方の「Executing task artisan:migrate」を見たら、
すぐ下にも「deploy:failed」があった。

/usr/bin/php /home/ec2-user/deploy/pro/releases/20191111_110814/artisan migrate --force
Executing task deploy:failed

Syntax error修正でdeploy成功

Syntax error修正して再deployして問題なくテストアップ!

結論

Laravel マイグレーションのエラーは、Syntax error を飛ばしてSeederにエラーがあるように見える。
Laravel マイグレーションのエラ調査は赤くなってる部分だけ見るのではなくもっと他も疑うべき!!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?