mirror of https://gitlab.com/litecord/litecord.git
schema.sql: add users.last_session
- gateway.websocket: update users.last_session SQL for instances: ```sql ALTER TABLE users ADD COLUMN last_session timestamp without time zone default (now() at time zone 'utc'); ```
This commit is contained in:
parent
9aa9b3839b
commit
80c29265f3
|
|
@ -406,6 +406,13 @@ class GatewayWebsocket:
|
||||||
# link the state to the user
|
# link the state to the user
|
||||||
self.ext.state_manager.insert(self.state)
|
self.ext.state_manager.insert(self.state)
|
||||||
|
|
||||||
|
# update last_session
|
||||||
|
await self.ext.db.execute("""
|
||||||
|
UPDATE users
|
||||||
|
SET last_session = (now() at time zone 'utc')
|
||||||
|
WHERE id = $1
|
||||||
|
""", user_id)
|
||||||
|
|
||||||
await self.update_status(presence)
|
await self.update_status(presence)
|
||||||
await self.subscribe_all()
|
await self.subscribe_all()
|
||||||
await self.dispatch_ready()
|
await self.dispatch_ready()
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,9 @@ CREATE TABLE IF NOT EXISTS users (
|
||||||
phone varchar(60) DEFAULT '',
|
phone varchar(60) DEFAULT '',
|
||||||
password_hash text NOT NULL,
|
password_hash text NOT NULL,
|
||||||
|
|
||||||
|
-- store the last time the user logged in via the gateway
|
||||||
|
last_session timestamp without time zone default (now() at time zone 'utc'),
|
||||||
|
|
||||||
PRIMARY KEY (id, username, discriminator)
|
PRIMARY KEY (id, username, discriminator)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue