From e6cf3f0df70735ea5b6a755da54ef8f9bb785943 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Thu, 1 Oct 2020 22:21:27 +0200 Subject: [PATCH] Rename struct fields --- userapi/api/api.go | 4 ++-- userapi/storage/devices/postgres/devices_table.go | 6 +++--- userapi/storage/devices/sqlite3/devices_table.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/userapi/api/api.go b/userapi/api/api.go index 365081cef..84737bb08 100644 --- a/userapi/api/api.go +++ b/userapi/api/api.go @@ -213,8 +213,8 @@ type Device struct { // associated with access tokens. SessionID int64 DisplayName string - LastSeen int64 - IPAddr string + LastSeenTS int64 + LastSeenIP string } // Account represents a Matrix account on this home server. diff --git a/userapi/storage/devices/postgres/devices_table.go b/userapi/storage/devices/postgres/devices_table.go index 0aa8de6cb..b837c38c4 100644 --- a/userapi/storage/devices/postgres/devices_table.go +++ b/userapi/storage/devices/postgres/devices_table.go @@ -65,7 +65,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS device_localpart_id_idx ON device_devices(loca ` const insertDeviceSQL = "" + - "INSERT INTO device_devices(device_id, localpart, access_token, created_ts, display_name, last_used_ts, ip) VALUES ($1, $2, $3, $4, $5, $6, $7)" + + "INSERT INTO device_devices(device_id, localpart, access_token, created_ts, display_name, last_seen_ts, ip) VALUES ($1, $2, $3, $4, $5, $6, $7)" + " RETURNING session_id" const selectDeviceByTokenSQL = "" + @@ -166,8 +166,8 @@ func (s *devicesStatements) insertDevice( UserID: userutil.MakeUserID(localpart, s.serverName), AccessToken: accessToken, SessionID: sessionID, - LastSeen: createdTimeMS, - IPAddr: ipAddr, + LastSeenTS: createdTimeMS, + LastSeenIP: ipAddr, }, nil } diff --git a/userapi/storage/devices/sqlite3/devices_table.go b/userapi/storage/devices/sqlite3/devices_table.go index 0d1154f1d..110b6dd35 100644 --- a/userapi/storage/devices/sqlite3/devices_table.go +++ b/userapi/storage/devices/sqlite3/devices_table.go @@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS device_devices ( ` const insertDeviceSQL = "" + - "INSERT INTO device_devices (device_id, localpart, access_token, created_ts, display_name, session_id, last_used_ts, ip)" + + "INSERT INTO device_devices (device_id, localpart, access_token, created_ts, display_name, session_id, last_seen_ts, ip)" + " VALUES ($1, $2, $3, $4, $5, $6, $7, $8)" const selectDevicesCountSQL = "" + @@ -161,8 +161,8 @@ func (s *devicesStatements) insertDevice( UserID: userutil.MakeUserID(localpart, s.serverName), AccessToken: accessToken, SessionID: sessionID, - LastSeen: createdTimeMS, - IPAddr: ipAddr, + LastSeenTS: createdTimeMS, + LastSeenIP: ipAddr, }, nil }