Annotation of embedaddon/bmon/xtra/db.sql, revision 1.1.1.1

1.1       misho       1: CREATE TABLE IF NOT EXISTS nodes (
                      2:        id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
                      3:        name TEXT NOT NULL,
                      4:        source TEXT,
                      5:        PRIMARY KEY (id)
                      6: );
                      7: 
                      8: CREATE TABLE IF NOT EXISTS items (
                      9:        id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
                     10:        name TEXT NOT NULL,
                     11:        description TEXT,
                     12:        node INT UNSIGNED NOT NULL,
                     13:        handle INT UNSIGNED,
                     14:        parent INT UNSIGNED,
                     15:        indent INT UNSIGNED,
                     16:        rx_usage SMALLINT NOT NULL,
                     17:        tx_usage SMALLINT NOT NULL,
                     18:        PRIMARY KEY (id),
                     19:        FOREIGN KEY (node) REFERENCES nodes(id),
                     20:        FOREIGN KEY (parent) REFERENCES items(id)
                     21: );
                     22: 
                     23: CREATE TABLE IF NOT EXISTS attrs (
                     24:        id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
                     25:        name CHAR(15) NOT NULL,
                     26:        item INT UNSIGNED NOT NULL,
                     27:        rx_rate INT UNSIGNED,
                     28:        tx_rate INT UNSIGNED,
                     29:        rx_counter BIGINT UNSIGNED NOT NULL,
                     30:        tx_counter BIGINT UNSIGNED NOT NULL,
                     31:        PRIMARY KEY (id),
                     32:        FOREIGN KEY (item) REFERENCES items(id)
                     33: );
                     34: 
                     35: CREATE TABLE IF NOT EXISTS attr_desc (
                     36:        id CHAR(15) NOT NULL UNIQUE,
                     37:        is_num SMALLINT UNSIGNED NOT NULL,
                     38:        txt TEXT NOT NULL,
                     39:        PRIMARY KEY(id)
                     40: );
                     41: 
                     42: CREATE TABLE IF NOT EXISTS hist_r (
                     43:        attr INT UNSIGNED NOT NULL,
                     44:        ts INT UNSIGNED NOT NULL,
                     45:        offset INT UNSIGNED NOT NULL,
                     46:        rx_rate INT UNSIGNED NOT NULL,
                     47:        tx_rate INT UNSIGNED NOT NULL,
                     48:        PRIMARY KEY (attr, ts, offset),
                     49:        FOREIGN KEY (attr) REFERENCES attrs(id)
                     50: );
                     51: 
                     52: CREATE TABLE IF NOT EXISTS hist_s (
                     53:        attr INT UNSIGNED NOT NULL,
                     54:        ts INT UNSIGNED NOT NULL,
                     55:        offset INT UNSIGNED NOT NULL,
                     56:        rx_rate INT UNSIGNED NOT NULL,
                     57:        tx_rate INT UNSIGNED NOT NULL,
                     58:        PRIMARY KEY (attr, ts, offset),
                     59:        FOREIGN KEY (attr) REFERENCES attrs(id)
                     60: );
                     61: 
                     62: CREATE TABLE IF NOT EXISTS hist_m (
                     63:        attr INT UNSIGNED NOT NULL,
                     64:        ts INT UNSIGNED NOT NULL,
                     65:        offset INT UNSIGNED NOT NULL,
                     66:        rx_rate INT UNSIGNED NOT NULL,
                     67:        tx_rate INT UNSIGNED NOT NULL,
                     68:        PRIMARY KEY (attr, ts, offset),
                     69:        FOREIGN KEY (attr) REFERENCES attrs(id)
                     70: );
                     71: 
                     72: CREATE TABLE IF NOT EXISTS hist_h (
                     73:        attr INT UNSIGNED NOT NULL,
                     74:        ts INT UNSIGNED NOT NULL,
                     75:        offset INT UNSIGNED NOT NULL,
                     76:        rx_rate INT UNSIGNED NOT NULL,
                     77:        tx_rate INT UNSIGNED NOT NULL,
                     78:        PRIMARY KEY (attr, ts, offset),
                     79:        FOREIGN KEY (attr) REFERENCES attrs(id)
                     80: );
                     81: 
                     82: CREATE TABLE IF NOT EXISTS hist_d (
                     83:        attr INT UNSIGNED NOT NULL,
                     84:        ts INT UNSIGNED NOT NULL,
                     85:        offset INT UNSIGNED NOT NULL,
                     86:        rx_rate INT UNSIGNED NOT NULL,
                     87:        tx_rate INT UNSIGNED NOT NULL,
                     88:        PRIMARY KEY (attr, ts, offset),
                     89:        FOREIGN KEY (attr) REFERENCES attrs(id)
                     90: );

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>