From: Ismaƫl Bouya Date: Fri, 3 Aug 2018 08:40:45 +0000 (+0200) Subject: Add view for augmented market config X-Git-Tag: v0.0.26 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git;a=commitdiff_plain;h=215e478fa347e922ad47ace89316113f1b7f15cd Add view for augmented market config --- diff --git a/db/migrations.go b/db/migrations.go index 1a105fc..9246eaa 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -117,4 +117,24 @@ var migrations []Migration = []Migration{ "DROP TYPE portfolio_profile", }, }, + { + Version: 201808031000, + Up: []string{ + `CREATE VIEW market_configs_augmented AS + SELECT market_configs.*, + COALESCE(u.portfolio_profile, g.portfolio_profile) + AS portfolio_profile + FROM market_configs + LEFT JOIN bot_settings AS u + ON u.user_id = market_configs.user_id, + ( + SELECT portfolio_profile + FROM bot_settings + WHERE user_id IS NULL + ) AS g`, + }, + Down: []string{ + "DROP VIEW market_configs_augmented", + }, + }, }