Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## About the changes https://linear.app/unleash/issue/2-705/store-sign-on-events Adds a migration for a new `login_events` table. Also adds the new `loginEventLog` feature flag. <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: #2951 --------- Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
exports.up = function (db, cb) { | ||
db.runSql( | ||
` | ||
CREATE TABLE IF NOT EXISTS login_events ( | ||
id SERIAL PRIMARY KEY NOT NULL, | ||
username TEXT NOT NULL, | ||
auth_type TEXT NOT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), | ||
successful BOOLEAN NOT NULL, | ||
ip INET, | ||
failure_reason TEXT | ||
); | ||
CREATE INDEX IF NOT EXISTS login_events_ip_idx ON login_events(ip); | ||
`, | ||
cb, | ||
); | ||
}; | ||
|
||
exports.down = function (db, cb) { | ||
db.runSql( | ||
` | ||
DROP INDEX IF EXISTS login_events_ip_idx; | ||
DROP TABLE IF EXISTS login_events; | ||
`, | ||
cb, | ||
); | ||
}; |