]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/commitdiff
Add view for augmented market config v0.0.26
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 3 Aug 2018 08:40:45 +0000 (10:40 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 3 Aug 2018 08:40:45 +0000 (10:40 +0200)
db/migrations.go

index 1a105fcc5ba4d34fe9d3675c2f219d2e158f9815..9246eaa930c11d1bcec7df75236046877945eca1 100644 (file)
@@ -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",
+               },
+       },
 }