@@ -375,7 +375,9 @@ void CV2::initializeNetworks()
375375
376376 try {
377377 char qbuf[2048 ];
378- sprintf (qbuf, " SELECT id, name, configuration , creation_time, last_modified, revision FROM networks_ctl WHERE controller_id = '%s'" , _myAddressStr.c_str ());
378+ sprintf (qbuf, " SELECT id, name, configuration , (EXTRACT(EPOCH FROM creation_time AT TIME ZONE 'UTC')*1000)::bigint, "
379+ " (EXTRACT(EPOCH FROM last_modified AT TIME ZONE 'UTC')*1000):bigint, revision "
380+ " FROM networks_ctl WHERE controller_id = '%s'" , _myAddressStr.c_str ());
379381
380382 auto c = _pool->borrow ();
381383 pqxx::work w (*c->c );
@@ -386,7 +388,7 @@ void CV2::initializeNetworks()
386388 std::string // network ID
387389 , std::optional<std::string> // name
388390 , std::string // configuration
389- , std::optional<uint64_t > // created_at
391+ , std::optional<uint64_t > // creation_time
390392 , std::optional<uint64_t > // last_modified
391393 , std::optional<uint64_t > // revision
392394 > row;
@@ -490,9 +492,11 @@ void CV2::initializeMembers()
490492 char qbuf[2048 ];
491493 sprintf (qbuf,
492494 " SELECT nm.device_id, nm.network_id, nm.authorized, nm.active_bridge, nm.ip_assignments, nm.no_auto_assign_ips, "
493- " nm.sso_exempt, authentication_expiry_time, nm.creation_time, nm.identity, nm.last_authorized_credential, "
494- " nm.last_authorized_time, nm.last_deauthorized_time, nm.remote_trace_level, nm.remote_trace_target, "
495- " nm.revision, nm.capabilities, nm.tags "
495+ " nm.sso_exempt, (EXTRACT(EPOCH FROM nm.authentication_expiry_time AT TIME ZONE 'UTC')*1000)::bigint, "
496+ " EXTRACT(EPOCH FROM nm.creation_time AT TIME ZONE 'UTC')*1000)::bigint, nm.identity, nm.last_authorized_credential, "
497+ " EXTRACT(EPOCH FROM nm.last_authorized_time AT TIME ZONE 'UTC')*1000)::bigint, "
498+ " EXTRACT(EPOCH FROM nm.last_deauthorized_time AT TIME ZONE 'UTC')*1000)::bigint, "
499+ " nm.remote_trace_level, nm.remote_trace_target, nm.revision, nm.capabilities, nm.tags "
496500 " FROM network_memberships_ctl nm "
497501 " INNER JOIN networks_ctl n "
498502 " ON nm.network_id = n.id "
@@ -512,7 +516,7 @@ void CV2::initializeMembers()
512516 , std::optional<bool > // sso_exempt
513517 , std::optional<uint64_t > // authentication_expiry_time
514518 , std::optional<uint64_t > // creation_time
515- , std::string // identity
519+ , std::optional<std:: string> // identity
516520 , std::optional<std::string> // last_authorized_credential
517521 , std::optional<uint64_t > // last_authorized_time
518522 , std::optional<uint64_t > // last_deauthorized_time
@@ -541,7 +545,7 @@ void CV2::initializeMembers()
541545 std::optional<bool > sso_exempt = std::get<6 >(row);
542546 std::optional<uint64_t > authentication_expiry_time = std::get<7 >(row);
543547 std::optional<uint64_t > creation_time = std::get<8 >(row);
544- std::string identity = std::get<9 >(row);
548+ std::optional<std:: string> identity = std::get<9 >(row);
545549 std::optional<std::string> last_authorized_credential = std::get<10 >(row);
546550 std::optional<uint64_t > last_authorized_time = std::get<11 >(row);
547551 std::optional<uint64_t > last_deauthorized_time = std::get<12 >(row);
@@ -553,7 +557,7 @@ void CV2::initializeMembers()
553557
554558 config[" objtype" ] = " member" ;
555559 config[" id" ] = memberId;
556- config[" address" ] = identity;
560+ config[" address" ] = identity. value_or ( " " ) ;
557561 config[" nwid" ] = networkId;
558562 config[" authorized" ] = authorized;
559563 config[" activeBridge" ] = active_bridge.value_or (false );
0 commit comments