#!/usr/bin/perl -w
# run from pronto libdir like this ./migration-scripts/mkmimetable.pl

BEGIN {
	$libpath = $0;
	$libpath =~ s!/[^/]+$!!;
	$libpath =~ s!/bin$!/lib/pronto!;
	if (! -e $libpath) { die "Can't find required files in $libpath"; };
}

use lib "$libpath";
use lib "$libpath/modules/lib/perl5/site_perl/5.005";
use DBI;

require 'prontolib.pl';
&read_prefs;

my $dbh=&open_db_conn;

if ($prefs{'DatabaseDriver'} eq "CSV") {
$sth1 = $dbh->prepare("create table mimetypes(id int, mime varchar(100), command varchar(100), icon varchar(100))");
$sth1->execute or die @_;
} elsif ($prefs{'DatabaseDriver'} eq "mysql" or "pg") {
$sth1 = $dbh->prepare("create table mimetypes(id int4, mime text, command text, icon text)");
$sth1->execute or die @_;
}
