From 2faac71fe53060564846651109a8cd875d2ee7fe Mon Sep 17 00:00:00 2001 From: Stefan Midjich Date: Thu, 16 Nov 2017 20:48:13 +0100 Subject: [PATCH] changing name of sql table to be more intuitive. --- tools/captiveportal.pgsql | 4 ++-- tools/storage.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/captiveportal.pgsql b/tools/captiveportal.pgsql index 7043551..c68257a 100644 --- a/tools/captiveportal.pgsql +++ b/tools/captiveportal.pgsql @@ -8,7 +8,7 @@ BEGIN --more types here... END$$; -create table if not exists client ( +create table if not exists authenticated_clients ( client_id uuid NOT NULL unique, created timestamp NOT NULL, ip_address inet NOT NULL, @@ -20,4 +20,4 @@ create table if not exists client ( primary key (client_id, ip_address, protocol) ); -create index if not exists client_ip_address_index on client (ip_address); +create index if not exists client_ip_address_index on authenticated_clients (ip_address); \ No newline at end of file diff --git a/tools/storage.py b/tools/storage.py index 0f3658b..8e7a46f 100644 --- a/tools/storage.py +++ b/tools/storage.py @@ -35,14 +35,14 @@ class StoragePostgres(object): def client_ids(self): self.cur.execute( - 'select client_id from client' + 'select client_id from authenticated_clients' ) return self.cur.fetchall() def get_client_by_id(self, client_id): self.cur.execute( - 'select * from client where client_id=%s', + 'select * from authenticated_clients where client_id=%s', (client_id,) ) return self.cur.fetchone() @@ -54,7 +54,7 @@ class StoragePostgres(object): """ self.cur.execute( - 'select * from client where ip_address=%s and protocol=%s', + 'select * from authenticated_clients where ip_address=%s and protocol=%s', (ip_address, protocol, ) ) return self.cur.fetchone() @@ -62,7 +62,7 @@ class StoragePostgres(object): def write_client(self, client): query = ( - 'insert into client (client_id, created, ip_address, protocol, ' + 'insert into authenticated_clients (client_id, created, ip_address, protocol, ' 'enabled, last_packets, last_activity, expires) values ' '(%s, %s, %s, %s, %s, %s, %s, %s) on conflict (client_id, ' 'ip_address, protocol) do update set (enabled, last_packets, ' @@ -86,7 +86,7 @@ class StoragePostgres(object): def remove_client(self, client): - query = 'delete from client where client_id=%s' + query = 'delete from authenticated_clients where client_id=%s' self.cur.execute(query, (client.client_id,)) self.conn.commit()