Add goose database migrations
[cacert-boardvoting.git] / db / migrations / 20170421143052_fix_duplicates.sql
1
2 -- +goose Up
3 -- SQL in section 'Up' is executed when this migration is applied
4
5 -- Peter Yuill has a duplicate entry in the voters table he has ids 17 and 31
6
7 UPDATE votes SET voter=17 WHERE voter=31;
8 UPDATE decisions SET proponent=17 WHERE proponent=31;
9 DELETE FROM emails WHERE voter=31;
10 DELETE FROM voters WHERE id=31;
11
12 -- +goose Down
13 -- SQL section 'Down' is executed when this migration is rolled back
14
15 -- There is no useful backward migration