602 852 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#
# Update port_counters, no more card,port
#
use strict;
use libdb;

sub DoUpdate($$$)
{
    my ($dbhandle, $dbname, $version) = @_;

    if (DBKeyExists("port_counters", "PRIMARY")) {
	DBQueryFatal("alter table port_counters drop primary key");
    }
    if (DBSlotExists("port_counters", "card")) {
	DBQueryFatal("alter table port_counters ".
		     "  change card card_saved ".
		     "      tinyint(3) unsigned NOT NULL default '0',".
		     "  change port port_saved ".
		     "      smallint(5) unsigned NOT NULL default '0'");
    }
    # These get left behind.
    DBQueryFatal("delete from port_counters where iface=''");
    
    if (!DBKeyExists("port_counters", "PRIMARY")) {
	DBQueryFatal("alter table port_counters add primary key ".
		     "  (`node_id`,`iface`(128))");
    }
    return 0;
}

1;

# Local Variables:
# mode:perl
# End: