drop database if exists pmacct;
create database pmacct;

use pmacct;

drop table if exists acct_v7; 
create table acct_v7 (
    agent_id INT(4) UNSIGNED NOT NULL,
    class_id CHAR(16) NOT NULL,
    mac_src CHAR(17) NOT NULL,
    mac_dst CHAR(17) NOT NULL,
    vlan INT(2) UNSIGNED NOT NULL,
    as_src INT(4) UNSIGNED NOT NULL,
    as_dst INT(4) UNSIGNED NOT NULL,
    ip_src CHAR(45) NOT NULL,
    ip_dst CHAR(45) NOT NULL,
    src_port INT(2) UNSIGNED NOT NULL,
    dst_port INT(2) UNSIGNED NOT NULL,
    tcp_flags INT(4) UNSIGNED NOT NULL,
    ip_proto CHAR(6) NOT NULL, 
    tos INT(4) UNSIGNED NOT NULL, 
    packets INT UNSIGNED NOT NULL,
    bytes BIGINT UNSIGNED NOT NULL,
    flows INT UNSIGNED NOT NULL,
    stamp_inserted DATETIME NOT NULL,
    stamp_updated DATETIME,
    PRIMARY KEY (agent_id, class_id, mac_src, mac_dst, vlan, as_src, as_dst, ip_src, ip_dst, src_port, dst_port, ip_proto, tos, stamp_inserted)
);
