From 4acebcec7e16ce37e847e4273d40bbee924d8a1e Mon Sep 17 00:00:00 2001 From: shibafu Date: Mon, 10 Aug 2020 12:25:00 +0900 Subject: [PATCH] Add metadata error attrs migration --- app/Metadata.php | 2 +- ...8_10_114944_add_error_data_to_metadata.php | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2020_08_10_114944_add_error_data_to_metadata.php diff --git a/app/Metadata.php b/app/Metadata.php index 2abd321..546f155 100644 --- a/app/Metadata.php +++ b/app/Metadata.php @@ -13,7 +13,7 @@ class Metadata extends Model protected $fillable = ['url', 'title', 'description', 'image', 'expires_at']; protected $visible = ['url', 'title', 'description', 'image', 'expires_at', 'tags']; - protected $dates = ['created_at', 'updated_at', 'expires_at']; + protected $dates = ['created_at', 'updated_at', 'expires_at', 'error_at']; public function tags() { diff --git a/database/migrations/2020_08_10_114944_add_error_data_to_metadata.php b/database/migrations/2020_08_10_114944_add_error_data_to_metadata.php new file mode 100644 index 0000000..2938ccd --- /dev/null +++ b/database/migrations/2020_08_10_114944_add_error_data_to_metadata.php @@ -0,0 +1,36 @@ +timestamp('error_at')->nullable(); + $table->string('error_exception_class')->nullable(); + $table->integer('error_http_code')->nullable(); + $table->text('error_body')->nullable(); + $table->integer('error_count')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('metadata', function (Blueprint $table) { + $table->dropColumn(['error_at', 'error_exception_class', 'error_http_code', 'error_body', 'error_count']); + }); + } +}