-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use api to store last accessed for user
- Loading branch information
1 parent
fcc30b3
commit ed13dde
Showing
4 changed files
with
66 additions
and
14 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
services/api/database/migrations/20241213000000_user_last_accessed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.up = async function(knex) { | ||
organizations = await knex.schema.hasTable('user'); | ||
if (!organizations) { | ||
return knex.schema | ||
.createTable('user', function (table) { | ||
table.specificType('usid', 'CHAR(36)'); | ||
table.datetime('last_accessed'); | ||
table.primary(['usid']); | ||
}) | ||
} | ||
else { | ||
return knex.schema | ||
} | ||
}; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.down = async function(knex) { | ||
return knex.schema | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters