feat: allow associating an existing device ID and token with a username

This commit is contained in:
2024-06-16 08:24:28 -04:00
parent e8aebac6d4
commit f9d7a6bbd2
4 changed files with 112 additions and 7 deletions

View File

@@ -11,7 +11,9 @@ export const deviceTokensTable = sqliteTable("device_tokens", {
token: text("token").notNull().unique(),
username: text("username"),
/** Used to determine if a device hasn't been used in a while. Should start to ignore tokens where the device hasn't connected in about a month. */
lastConnectedAt: text("last_connected_at").default(sql`(CURRENT_TIMESTAMP)`),
lastConnectedAt: text("last_connected_at")
.default(sql`(CURRENT_TIMESTAMP)`)
.$onUpdate(() => sql`(CURRENT_TIMESTAMP)`),
});
export const watchStatusTable = sqliteTable(