summaryrefslogtreecommitdiff
path: root/db/migrations/20170421143052_fix_duplicates.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/20170421143052_fix_duplicates.sql')
-rw-r--r--db/migrations/20170421143052_fix_duplicates.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrations/20170421143052_fix_duplicates.sql b/db/migrations/20170421143052_fix_duplicates.sql
new file mode 100644
index 0000000..a0ffbf0
--- /dev/null
+++ b/db/migrations/20170421143052_fix_duplicates.sql
@@ -0,0 +1,15 @@
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+
+-- Peter Yuill has a duplicate entry in the voters table he has ids 17 and 31
+
+UPDATE votes SET voter=17 WHERE voter=31;
+UPDATE decisions SET proponent=17 WHERE proponent=31;
+DELETE FROM emails WHERE voter=31;
+DELETE FROM voters WHERE id=31;
+
+-- +goose Down
+-- SQL section 'Down' is executed when this migration is rolled back
+
+-- There is no useful backward migration \ No newline at end of file