From 0a43482e6971d1fddb43b9cafd815ca153e52bf7 Mon Sep 17 00:00:00 2001 From: tonyco97 Date: Fri, 22 Mar 2024 11:04:14 +0100 Subject: [PATCH 1/3] nethlink. created user_nethlink table --- .../30_nethcti3.user_nethlink-schema.sql | 12 ++++++++++++ nethcti-server/entrypoint.sh | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql diff --git a/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql b/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql new file mode 100644 index 000000000..330033efd --- /dev/null +++ b/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql @@ -0,0 +1,12 @@ +/*!40101 SET NAMES binary*/; +/*!40014 SET FOREIGN_KEY_CHECKS=0*/; + +/*!40103 SET TIME_ZONE='+00:00' */; +USE `nethcti3`; +CREATE TABLE IF NOT EXISTS `user_nethlink` ( + `id` int(11) NOT NULL auto_increment, + `user` varchar(255) NOT NULL, + `extension` varchar(255) NOT NULL, + `timestamp` varchar(255) default NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/nethcti-server/entrypoint.sh b/nethcti-server/entrypoint.sh index 26499d2d5..ede987924 100755 --- a/nethcti-server/entrypoint.sh +++ b/nethcti-server/entrypoint.sh @@ -205,6 +205,14 @@ cat > $FILE < Date: Mon, 25 Mar 2024 10:04:52 +0100 Subject: [PATCH 2/3] migration. create nethlink table if missing --- freepbx/initdb.d/migration.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/freepbx/initdb.d/migration.php b/freepbx/initdb.d/migration.php index aa710f1b8..9a5a313bd 100644 --- a/freepbx/initdb.d/migration.php +++ b/freepbx/initdb.d/migration.php @@ -146,3 +146,7 @@ $stmt->execute(array_merge([$value,$sip_option],$extensions)); } } + +# add nethlink table if not exist +$db->query("CREATE TABLE IF NOT EXISTS `user_nethlink` (`id` INT(11) NOT NULL AUTO_INCREMENT, `user` VARCHAR(255) NOT NULL, `extension` VARCHAR(255) NOT NULL, `timestamp` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); + From 0f3ae133c47f89e9195a9709c2944b1e67a0628d Mon Sep 17 00:00:00 2001 From: tonyco97 Date: Tue, 26 Mar 2024 10:32:45 +0100 Subject: [PATCH 3/3] nethlinkTable. fixed nethlink table --- freepbx/initdb.d/migration.php | 3 +-- .../30_nethcti3.user_nethlink-schema.sql | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/freepbx/initdb.d/migration.php b/freepbx/initdb.d/migration.php index 9a5a313bd..d8979fbe4 100644 --- a/freepbx/initdb.d/migration.php +++ b/freepbx/initdb.d/migration.php @@ -148,5 +148,4 @@ } # add nethlink table if not exist -$db->query("CREATE TABLE IF NOT EXISTS `user_nethlink` (`id` INT(11) NOT NULL AUTO_INCREMENT, `user` VARCHAR(255) NOT NULL, `extension` VARCHAR(255) NOT NULL, `timestamp` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); - +$db->query("CREATE TABLE `user_nethlink` (`user` varchar(255) NOT NULL UNIQUE,`extension` varchar(255) NOT NULL,`timestamp` varchar(255) DEFAULT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8"); diff --git a/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql b/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql index 330033efd..03171849c 100644 --- a/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql +++ b/mariadb/docker-entrypoint-initdb.d/30_nethcti3.user_nethlink-schema.sql @@ -3,10 +3,8 @@ /*!40103 SET TIME_ZONE='+00:00' */; USE `nethcti3`; -CREATE TABLE IF NOT EXISTS `user_nethlink` ( - `id` int(11) NOT NULL auto_increment, - `user` varchar(255) NOT NULL, +CREATE TABLE `user_nethlink` ( + `user` varchar(255) NOT NULL UNIQUE, `extension` varchar(255) NOT NULL, - `timestamp` varchar(255) default NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file + `timestamp` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8;