diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2018-09-04 16:08:26 -0700 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2018-09-04 16:08:26 -0700 |
commit | a4be9ceb5a3e991674ebd13b38ab2a4292b3013e (patch) | |
tree | 84e915dfcf4d811b889a5e1b0c016598cc853e31 | |
parent | e21b6e1daf6fcb58868281d3fc1927ee0173164c (diff) | |
download | infinitytier-a4be9ceb5a3e991674ebd13b38ab2a4292b3013e.tar.gz infinitytier-a4be9ceb5a3e991674ebd13b38ab2a4292b3013e.zip |
dont insert/update creation time. Let the database handle it with the default value
-rw-r--r-- | controller/PostgreSQL.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index 980f8ea6..a7477b7c 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -586,13 +586,12 @@ void PostgreSQL::commitThread() if (!(*config)["remoteTraceTarget"].is_null()) { target = (*config)["remoteTraceTarget"]; } - const char *values[20] = { + const char *values[19] = { memberId.c_str(), networkId.c_str(), ((*config)["activeBridge"] ? "true" : "false"), ((*config)["authorized"] ? "true" : "false"), OSUtils::jsonDump((*config)["capabilities"], -1).c_str(), - std::to_string((long long)(*config)["creationTime"]).c_str(), name.c_str(), description.c_str(), identity.c_str(), @@ -610,14 +609,14 @@ void PostgreSQL::commitThread() }; PGresult *res = PQexecParams(conn, - "INSERT INTO ztc_member (id, network_id, active_bridge, authorized, capabilities, creation_time, " + "INSERT INTO ztc_member (id, network_id, active_bridge, authorized, capabilities, " "name, description, identity, last_authorized_time, last_deauthorized_time, no_auto_assign_ips, " "remote_trace_level, remote_trace_target, revision, tags, v_major, v_minor, v_rev, v_proto) " - "VALUES ($1, $2, $3, $4, $5, TO_TIMESTAMP($6::double precision/1000), $7, $8, $9, " - "TO_TIMESTAMP($10::double precision/1000), TO_TIMESTAMP($11::double precision/1000), " - "$12, $13, $14, $15, $16, $17, $18, $19, $20) ON CONFLICT (network_id, id) DO UPDATE SET " + "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, " + "TO_TIMESTAMP($9::double precision/1000), TO_TIMESTAMP($10::double precision/1000), " + "$11, $12, $13, $14, $15, $16, $17, $18, $19) ON CONFLICT (network_id, id) DO UPDATE SET " "active_bridge = EXCLUDED.active_bridge, authorized = EXCDLUDED.authorized, capabilities = EXCLUDED.capabilities, " - "creation_time = EXCLUDED.creation_time, name = EXCLUDED.name, description = EXCLUDED.description, " + "name = EXCLUDED.name, description = EXCLUDED.description, " "identity = EXCLUDED.identity, last_authorized_time = EXCLUDED.last_authorized_time, " "last_deauthorized_time = EXCLUDED.last_deauthorized_time, no_auto_assign_ips = EXCLUDED.no_auto_assign_ips, " "remote_trace_level = EXCLUDED.remote_trace_level, remote_trace_target = EXCLUDED.remote_trace_target, " |