cacert-boardvoting/boardvoting/migrations/20170421143052_fix_duplicates.sql

30 lines
No EOL
1 KiB
SQL

/*
Copyright 2017-2019 Jan Dittberner
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this program except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
-- +migrate 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;
-- +migrate Down
-- SQL section 'Down' is executed when this migration is rolled back
-- There is no useful backward migration