DROP TABLE IF EXISTS frames;

CREATE TABLE frames (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    addresse TEXT,
    alive INT,
    altitude REAL,
    body TEXT,
    comment TEXT,
    course REAL,
    created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    created_unix INT,
    format TEXT,
    frame TEXT,
    "from" TEXT,
    gpsfixstatus TEXT,
    header_raw TEXT,
    latitude REAL,
    longitude REAL,
    mbits INT,
    messagecapable INT,
    message_text TEXT,
    msgNo INT,
    mtype TEXT,
    object_format TEXT,
    object_name TEXT,
    party INT,
    path TEXT,
    phg REAL,
    phg_dir TEXT,
    phg_gain REAL,
    phg_height REAL,
    phg_power REAL,
    phg_range REAL,
    posambiguity INT,
    raw TEXT,
    raw_timestamp TEXT,
    rng REAL,
    speed REAL,
    station_call TEXT,
    station_lat REAL,
    station_lon REAL,
    status TEXT,
    subpacket TEXT,
    symbol TEXT,
    symbol_table TEXT,
    telemetry TEXT,
    timestamp INT,
    "to" TEXT,
    tEQNS TEXT,
    tPARM TEXT,
    tUNIT TEXT,
    type TEXT,
    via TEXT,
    weather TEXT,
    wx_raw_timestamp TIMESTAMP
);

CREATE TABLE "stations" (
	"id"	INTEGER NOT NULL UNIQUE,
	"from"	TEXT UNIQUE,
	"frames_id"	INTEGER,
	"last_heard_unix"	INTEGER,
	"count"	INTEGER,
	PRIMARY KEY("id" AUTOINCREMENT)
);
