--- make_poll.pl 2003/04/24 19:39:14 1.7 +++ make_poll.pl 2003/09/24 19:55:43 1.8 @@ -194,6 +194,9 @@ # dump sql structure open(SQL,">$poll/$poll.sql") || die "$poll.sql: $!"; +print SQL "drop database ".$prefix.$poll.";\n"; +print SQL "create database ".$prefix.$poll.";\n"; +print SQL "\\connect ".$prefix.$poll.";\n"; print SQL "create table poslani ( member_id int4 not null, unesen timestamp default now() );\n"; print SQL "create table $poll (do_stranice text default null, ",join(",\n",@sql_create),");\n"; close(SQL); @@ -229,7 +232,8 @@ # return unique name of pitanje sub new_pit { - my $out="p".$pitanje_nr.$p_suffix; + my $out="p".$pitanje_nr; + $out .= "_".$p_suffix if ($p_suffix); $curr_suffix=$p_suffix; $p_suffix++; return $out; @@ -743,6 +747,10 @@ } } +print "\n\nTo create database for poll $poll use:\n\n"; +print "\$ psql template1 < $poll/$poll.sql\n\n"; +print "THIS WILL DISTROY ALL DATA IN EXISTING DATABASE ".$prefix.$poll." !!\n"; + # read configuration data # # FIX: write actually this :-)