]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/commitdiff
bot_setting table. bot-settings v0.0.25
authorjloup <jean-loup.jamet@trainline.com>
Thu, 2 Aug 2018 22:09:57 +0000 (00:09 +0200)
committerjloup <jean-loup.jamet@trainline.com>
Fri, 3 Aug 2018 08:05:43 +0000 (10:05 +0200)
db/migrations.go

index e8fc40d12762934caa1222995879a0ab2f973b3c..1a105fcc5ba4d34fe9d3675c2f219d2e158f9815 100644 (file)
@@ -100,4 +100,21 @@ var migrations []Migration = []Migration{
                        "DROP TYPE user_role",
                },
        },
+       {
+               Version: 201807311000,
+               Up: []string{
+                       "CREATE TYPE portfolio_profile AS ENUM ('high-liquidity', 'medium-liquidity')",
+                       `CREATE TABLE bot_settings (
+                               id                BIGSERIAL PRIMARY KEY,
+                               user_id           bigint REFERENCES users(id) ON DELETE CASCADE,
+                               portfolio_profile portfolio_profile
+                       )`,
+                       `CREATE INDEX IF NOT EXISTS bot_settings_user_id ON bot_settings (user_id)`,
+                       `CREATE UNIQUE INDEX bot_settings_unique_null_user_id ON bot_settings (coalesce(user_id, 0))`,
+               },
+               Down: []string{
+                       "DROP TABLE bot_settings",
+                       "DROP TYPE portfolio_profile",
+               },
+       },
 }