aboutsummaryrefslogtreecommitdiff
path: root/db/migrations.go
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations.go')
-rw-r--r--db/migrations.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/db/migrations.go b/db/migrations.go
index 5d753f3..23847c9 100644
--- a/db/migrations.go
+++ b/db/migrations.go
@@ -26,7 +26,7 @@ var migrations []Migration = []Migration{
26 config jsonb 26 config jsonb
27 )`, 27 )`,
28 `CREATE UNIQUE INDEX IF NOT EXISTS market_name_user_id_idx ON public.market_configs (user_id, market_name)`, 28 `CREATE UNIQUE INDEX IF NOT EXISTS market_name_user_id_idx ON public.market_configs (user_id, market_name)`,
29 `CREATE INDEX IF NOT EXISTS market_configs_user_id ON market_configs (user_id)`, 29 `CREATE INDEX IF NOT EXISTS market_configs_user_id ON market_configs (user_id)`,
30 `CREATE TABLE reports ( 30 `CREATE TABLE reports (
31 id BIGSERIAL PRIMARY KEY, 31 id BIGSERIAL PRIMARY KEY,
32 date timestamp with time zone NOT NULL, 32 date timestamp with time zone NOT NULL,
@@ -60,21 +60,21 @@ var migrations []Migration = []Migration{
60 Down: []string{"DROP VIEW view_report_lines_by_user", "DROP TABLE report_lines", "DROP TABLE reports", "DROP TABLE market_configs", "DROP TABLE users"}, 60 Down: []string{"DROP VIEW view_report_lines_by_user", "DROP TABLE report_lines", "DROP TABLE reports", "DROP TABLE market_configs", "DROP TABLE users"},
61 }, 61 },
62 { 62 {
63 Version: 2, 63 Version: 201805061000,
64 Up: []string{ 64 Up: []string{
65 `CREATE VIEW "view_balances" AS 65 `CREATE VIEW "view_balances" AS
66 SELECT report_lines.id, 66 SELECT report_lines.id,
67 reports.id AS report_id, 67 reports.id AS report_id,
68 market_configs.market_name, 68 market_configs.market_name,
69 market_configs.id AS market_id, 69 market_configs.id AS market_id,
70 reports.date AS report_date, 70 reports.date AS report_date,
71 report_lines.date, 71 report_lines.date,
72 report_lines.payload 72 report_lines.payload
73 FROM report_lines 73 FROM report_lines
74 JOIN reports ON reports.id = report_lines.report_id 74 JOIN reports ON reports.id = report_lines.report_id
75 JOIN market_configs ON reports.market_config_id = market_configs.id 75 JOIN market_configs ON reports.market_config_id = market_configs.id
76 WHERE report_lines.payload::jsonb->'checkpoint' IS NOT NULL`, 76 WHERE report_lines.payload::jsonb->'checkpoint' IS NOT NULL`,
77 `CREATE INDEX checkpoints_idx ON report_lines ((payload->>'checkpoint'))`, 77 `CREATE INDEX checkpoints_idx ON report_lines ((payload->>'checkpoint'))`,
78 }, 78 },
79 Down: []string{"DROP VIEW view_balances", "DROP INDEX checkpoints_idx"}, 79 Down: []string{"DROP VIEW view_balances", "DROP INDEX checkpoints_idx"},
80 }, 80 },