diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-26 16:36:24 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-26 16:36:24 +0100 |
commit | 0fdf3088743b25e9fcc39b7b3b4c7f6e8332e26c (patch) | |
tree | a5433fb7afa8fb62c65f5a4395c7ed7b1f0a9af4 /synapse/storage/schema/users.sql | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-0fdf3088743b25e9fcc39b7b3b4c7f6e8332e26c.tar.xz |
Track the IP users connect with. Add an admin column to users table.
Diffstat (limited to 'synapse/storage/schema/users.sql')
-rw-r--r-- | synapse/storage/schema/users.sql | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/storage/schema/users.sql b/synapse/storage/schema/users.sql index 2519702971..89eab8babe 100644 --- a/synapse/storage/schema/users.sql +++ b/synapse/storage/schema/users.sql @@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS users( name TEXT, password_hash TEXT, creation_ts INTEGER, + admin BOOL DEFAULT 0 NOT NULL, UNIQUE(name) ON CONFLICT ROLLBACK ); @@ -29,3 +30,13 @@ CREATE TABLE IF NOT EXISTS access_tokens( FOREIGN KEY(user_id) REFERENCES users(id), UNIQUE(token) ON CONFLICT ROLLBACK ); + +CREATE TABLE IF NOT EXISTS user_ips ( + user TEXT NOT NULL, + access_token TEXT NOT NULL, + ip TEXT NOT NULL, + CONSTRAINT user_ip UNIQUE (user, access_token, ip) ON CONFLICT IGNORE +); + +CREATE INDEX IF NOT EXISTS user_ips_user ON user_ips(user); + |