summaryrefslogtreecommitdiff
path: root/database/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'database/migrations')
-rw-r--r--database/migrations/2020_07_23_185334_add_airing_status_to_view_anime.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/database/migrations/2020_07_23_185334_add_airing_status_to_view_anime.php b/database/migrations/2020_07_23_185334_add_airing_status_to_view_anime.php
index 67f46ab..330b489 100644
--- a/database/migrations/2020_07_23_185334_add_airing_status_to_view_anime.php
+++ b/database/migrations/2020_07_23_185334_add_airing_status_to_view_anime.php
@@ -19,8 +19,10 @@ class AddAiringStatusToViewAnime extends Migration
a.mal_id,
url,
image_url,
- title_pref as title,
+ (CASE WHEN title_eng IS NOT NULL THEN title_eng
+ ELSE title_pref END) as title,
title_pref,
+ title_eng,
anime_type,
a.created_at,
a.updated_at,
@@ -30,7 +32,7 @@ class AddAiringStatusToViewAnime extends Migration
airing_status,
(SELECT season_name FROM stats as b WHERE b.mal_id = a.mal_id ORDER BY created_at ASC LIMIT 1) as season_name,
(SELECT season_year FROM stats as b WHERE b.mal_id = a.mal_id ORDER BY created_at ASC LIMIT 1) as season_year,
- (SELECT score FROM stats as b WHERE b.mal_id = a.mal_id ORDER BY created_at ASC LIMIT 1) as score_begin,
+ (SELECT score FROM stats as b WHERE b.mal_id = a.mal_id AND score IS NOT NULL ORDER BY created_at ASC LIMIT 1) as score_begin,
(SELECT score FROM stats as b WHERE b.mal_id = a.mal_id ORDER BY created_at DESC LIMIT 1) as score_today,
(SELECT watching FROM stats as b WHERE b.mal_id = a.mal_id ORDER BY created_at DESC LIMIT 1) as watching,
(SELECT members FROM stats as b WHERE b.mal_id = a.mal_id ORDER BY created_at DESC LIMIT 1) as members