aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-05-06 17:42:39 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-05-06 17:42:39 +0200
commitfcb9f26cb8977904f5de9c3151c4033fe41c5e88 (patch)
tree2ee86676a755d3a6a1f7fa21ca7d1bc78fc72b20 /db
parentcf28f344ed2a032d14036e3f1e54db4f9d3b8a68 (diff)
downloadFront-fcb9f26cb8977904f5de9c3151c4033fe41c5e88.tar.gz
Front-fcb9f26cb8977904f5de9c3151c4033fe41c5e88.tar.zst
Front-fcb9f26cb8977904f5de9c3151c4033fe41c5e88.zip
Add more missing migrations.
Diffstat (limited to 'db')
-rw-r--r--db/migrations.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/db/migrations.go b/db/migrations.go
index ada0296..5d753f3 100644
--- a/db/migrations.go
+++ b/db/migrations.go
@@ -23,14 +23,14 @@ var migrations []Migration = []Migration{
23 id BIGSERIAL PRIMARY KEY, 23 id BIGSERIAL PRIMARY KEY,
24 market_name text NOT NULL, 24 market_name text NOT NULL,
25 user_id bigint NOT NULL REFERENCES users(id) ON DELETE CASCADE, 25 user_id bigint NOT NULL REFERENCES users(id) ON DELETE CASCADE,
26 config jsonb, 26 config jsonb
27 UNIQUE(user_id, market_name)
28 )`, 27 )`,
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,
33 market_config_id bigint NOT NULL, 33 market_config_id bigint NOT NULL REFERENCES market_configs(id),
34 debug boolean 34 debug boolean
35 )`, 35 )`,
36 "CREATE INDEX IF NOT EXISTS reports_market_config_id ON reports (market_config_id)", 36 "CREATE INDEX IF NOT EXISTS reports_market_config_id ON reports (market_config_id)",
@@ -52,15 +52,15 @@ var migrations []Migration = []Migration{
52 reports.date AS report_date, 52 reports.date AS report_date,
53 report_lines.date, 53 report_lines.date,
54 report_lines.payload 54 report_lines.payload
55 FROM (((public.report_lines 55 FROM public.report_lines
56 JOIN public.reports ON ((reports.id = report_lines.report_id))) 56 JOIN public.reports ON reports.id = report_lines.report_id
57 JOIN public.market_configs ON ((reports.market_config_id = market_configs.id))) 57 JOIN public.market_configs ON reports.market_config_id = market_configs.id
58 JOIN public.users ON ((market_configs.user_id = users.id)))`, 58 JOIN public.users ON market_configs.user_id = users.id`,
59 }, 59 },
60 Down: []string{"DROP VIEW view_report_lines_by_user", "DROP TABLE users", "DROP TABLE market_configs", "DROP TABLE report_lines", "DROP TABLE reports"}, 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: 201805061000, 63 Version: 2,
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,
@@ -70,9 +70,9 @@ var migrations []Migration = []Migration{
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 },