table('discovered_hosts'); $table ->addColumn('scan_job_id', 'integer', ['null' => true]) ->addColumn('ip_address', 'string', ['limit' => 45, 'null' => false]) ->addColumn('mac_address', 'string', ['limit' => 17, 'null' => true]) ->addColumn('hostname', 'string', ['limit' => 255, 'null' => true]) ->addColumn('vendor', 'string', ['limit' => 255, 'null' => true]) ->addColumn('detected_os', 'string', ['limit' => 255, 'null' => true]) ->addColumn('open_ports_json', 'text', ['null' => true]) ->addColumn('protocols_json', 'text', ['null' => true]) ->addColumn('fingerprint_json', 'text', ['null' => true]) ->addColumn('confidence', 'integer', ['null' => false, 'default' => 50]) ->addColumn('status', 'string', ['limit' => 20, 'null' => false, 'default' => 'new']) ->addColumn('matched_device_id', 'integer', ['null' => true]) ->addColumn('first_seen', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) ->addColumn('last_seen', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) ->addColumn('created_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) ->addColumn('updated_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) ->addIndex(['ip_address']) ->addIndex(['mac_address']) ->addIndex(['status']) ->create(); } }