@ -127,13 +127,13 @@ def create_table(**kwargs):
) ;
CREATE TABLE IF NOT EXISTS ` uuid ` ( ` user_id ` INTEGER NOT NULL , ` uuid ` varchar ( 64 ) , ` exp ` timestamp default ' 0000-00-00 00:00:00 ' ) ;
CREATE TABLE IF NOT EXISTS ` token ` ( ` user_id ` INTEGER , ` token ` varchar ( 64 ) , ` exp ` timestamp default ' 0000-00-00 00:00:00 ' ) ;
CREATE TABLE IF NOT EXISTS ` telegram ` ( ` id ` integer primary key autoincrement , ` token ` VARCHAR ( 64 ) , ` chanel_name ` INTEGER NOT NULL DEFAULT 1 , ` groups ` INTEGER NOT NULL DEFAULT 1 ) ;
CREATE TABLE IF NOT EXISTS ` telegram ` ( ` id ` integer primary key autoincrement , ` token ` VARCHAR ( 64 ) , ` chanel_name ` INTEGER NOT NULL DEFAULT 1 , ` groups ` INTEGER NOT NULL DEFAULT 1 ) ;
CREATE TABLE IF NOT EXISTS ` metrics ` ( ` serv ` varchar ( 64 ) , curr_con INTEGER , cur_ssl_con INTEGER , sess_rate INTEGER , max_sess_rate INTEGER , ` date ` timestamp default ' 0000-00-00 00:00:00 ' ) ;
CREATE TABLE IF NOT EXISTS ` settings ` ( ` param ` varchar ( 64 ) , value varchar ( 64 ) , section varchar ( 64 ) , ` desc ` varchar ( 100 ) , ` group ` INTEGER NOT NULL DEFAULT 1 , UNIQUE ( param , ` group ` ) ) ;
CREATE TABLE IF NOT EXISTS ` version ` ( ` version ` varchar ( 64 ) ) ;
CREATE TABLE IF NOT EXISTS ` options ` ( ` id ` INTEGER NOT NULL , ` options ` VARCHAR ( 64 ) , ` groups ` VARCHAR ( 120 ) , PRIMARY KEY ( ` id ` ) ) ;
CREATE TABLE IF NOT EXISTS ` saved_servers ` ( ` id ` INTEGER NOT NULL , ` server ` VARCHAR ( 64 ) , ` description ` VARCHAR ( 120 ) , ` groups ` VARCHAR ( 120 ) , PRIMARY KEY ( ` id ` ) ) ;
CREATE TABLE IF NOT EXISTS ` backups ` ( ` id ` INTEGER NOT NULL , ` server ` VARCHAR ( 64 ) , ` rhost ` VARCHAR ( 120 ) , ` rpath ` VARCHAR ( 120 ) , ` type ` VARCHAR ( 120 ) , ` time ` VARCHAR ( 120 ) , cred INTEGER , ` description ` VARCHAR ( 120 ) , PRIMARY KEY ( ` id ` ) ) ;
CREATE TABLE IF NOT EXISTS ` options ` ( ` id ` INTEGER NOT NULL , ` options ` VARCHAR ( 64 ) , ` groups ` VARCHAR ( 120 ) , PRIMARY KEY ( ` id ` ) ) ;
CREATE TABLE IF NOT EXISTS ` saved_servers ` ( ` id ` INTEGER NOT NULL , ` server ` VARCHAR ( 64 ) , ` description ` VARCHAR ( 120 ) , ` groups ` VARCHAR ( 120 ) , PRIMARY KEY ( ` id ` ) ) ;
CREATE TABLE IF NOT EXISTS ` backups ` ( ` id ` INTEGER NOT NULL , ` server ` VARCHAR ( 64 ) , ` rhost ` VARCHAR ( 120 ) , ` rpath ` VARCHAR ( 120 ) , ` type ` VARCHAR ( 120 ) , ` time ` VARCHAR ( 120 ) , cred INTEGER , ` description ` VARCHAR ( 120 ) , PRIMARY KEY ( ` id ` ) ) ;
CREATE TABLE IF NOT EXISTS ` waf ` ( ` server_id ` INTEGER UNIQUE , metrics INTEGER ) ;
CREATE TABLE IF NOT EXISTS ` waf_metrics ` ( ` serv ` varchar ( 64 ) , conn INTEGER , ` date ` DATETIME default ' 0000-00-00 00:00:00 ' ) ;
CREATE TABLE IF NOT EXISTS user_groups ( user_id INTEGER NOT NULL , user_group_id INTEGER NOT NULL , UNIQUE ( user_id , user_group_id ) ) ;
@ -1046,6 +1046,25 @@ def update_db_v_4_5_8_2(**kwargs):
con . close ( )
def update_db_v_4_5_9 ( * * kwargs ) :
con , cur = get_cur ( )
sql = list ( )
sql . append ( " INSERT INTO settings (param, value, section, `desc`) values( ' smon_check_interval ' , ' 1 ' , ' monitoring ' , ' SMON check interval, in minutes ' ) " )
sql . append ( " INSERT INTO settings (param, value, section, `desc`) values( ' checker_check_interval ' , ' 1 ' , ' monitoring ' , ' Checker check interval, in minutes ' ) " )
for i in sql :
try :
cur . execute ( i )
con . commit ( )
except sqltool . Error as e :
pass
else :
if kwargs . get ( ' silent ' ) != 1 :
print ( ' Updating... DB has been updated to version 4.5.9 ' )
cur . close ( )
con . close ( )
def update_ver ( * * kwargs ) :
con , cur = get_cur ( )
sql = """ update version set version = ' 4.5.8.0 ' ; """
@ -1087,6 +1106,7 @@ def update_all():
update_db_v_4_5_8 ( )
update_db_v_4_5_8_1 ( )
update_db_v_4_5_8_2 ( )
update_db_v_4_5_9 ( )
update_ver ( )
@ -1119,6 +1139,7 @@ def update_all_silent():
update_db_v_4_5_8 ( silent = 1 )
update_db_v_4_5_8_1 ( silent = 1 )
update_db_v_4_5_8_2 ( silent = 1 )
update_db_v_4_5_9 ( silent = 1 )
update_ver ( )