#!/usr/bin/perl
use strict; use warnings;
=pod

=head1 NAME

vox-rename-poll - reassign votes in the input store

=head1 SYNOPSIS

vox-rename-poll OLD-NAME NEW-NAME

=head1 CAVEATS

Not intended for an online vote-server.  Polls are not ordinarily renamed after going
online.

Only reassigns votes in the input store.  Configuration, output store (counts), and wiki
are unaffected.

=cut

{
    use Pod::Usage qw( pod2usage );
    my $oldName = shift;
    my $newName = shift;
    scalar @ARGV == 0 && defined $oldName && defined $newName or pod2usage( -verbose => 1 ); # and exits

    my $command = qq!psql --command!;
    $command .= qq! "UPDATE in_vote SET servicename = '$newName' WHERE servicename = '$oldName'"!;
    exec( $command );
}