diff --git a/load-domains-list.sql.in b/load-domains-list.sql.in new file mode 100644 index 0000000..e759a64 --- /dev/null +++ b/load-domains-list.sql.in @@ -0,0 +1,31 @@ +USE squidconf; + +DROP TABLE IF EXISTS totalBlockTmp; + + +CREATE TABLE `totalBlockTmp` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + + +LOAD DATA LOCAL INFILE '###FILENAME###' INTO TABLE totalBlockTmp +FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' +(@col1) set dstdom=@col1; + + +SET autocommit=0; + +START TRANSACTION; + ALTER TABLE totalBlock RENAME totalBlockOld; + ALTER TABLE totalBlockTmp RENAME totalBlock; + DROP TABLE totalBlockOld; +COMMIT; + +SET autocommit=1; diff --git a/load-dstdomain-list-into-bl.sh b/load-dstdomain-list-into-bl.sh new file mode 100755 index 0000000..a31f26b --- /dev/null +++ b/load-dstdomain-list-into-bl.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +LIST_FILENAME="$1" + +if [ ! -f "${LIST_FILENAME}" ] +then + echo "The file [ \"${LIST_FILENAME}\" ] doesn't exits" + exit 1 +fi + +stat load-domains-list.sql && rm -vf load-domains-list.sql + +cat load-domains-list.sql.in |sed -e "s@###FILENAME###@${LIST_FILENAME}@g" > load-domains-list.sql + +mariadb -u root --local-infile < load-domains-list.sql diff --git a/squidconf.sql b/squidconf.sql new file mode 100644 index 0000000..a048278 --- /dev/null +++ b/squidconf.sql @@ -0,0 +1,230 @@ +-- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64) +-- +-- Host: 192.168.220.135 Database: squidconf +-- ------------------------------------------------------ +-- Server version 11.2.3-MariaDB-1:11.2.3+maria~deb12 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!50503 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `campusBlackList` +-- + +DROP TABLE IF EXISTS `campusBlackList`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `campusBlackList` ( + `dstdom_id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`dstdom_id`), + KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `campusTestingBlackList` +-- + +DROP TABLE IF EXISTS `campusTestingBlackList`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `campusTestingBlackList` ( + `dstdom_id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`dstdom_id`), + KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `campusTestingWhiteList` +-- + +DROP TABLE IF EXISTS `campusTestingWhiteList`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `campusTestingWhiteList` ( + `dstdom_id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`dstdom_id`), + KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `campusWhiteList` +-- + +DROP TABLE IF EXISTS `campusWhiteList`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `campusWhiteList` ( + `dstdom_id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`dstdom_id`), + KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lists` +-- + +DROP TABLE IF EXISTS `lists`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `lists` ( + `list_id` bigint(20) NOT NULL AUTO_INCREMENT, + `list_name` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`list_id`), + KEY `lists_list_name_IDX` (`list_name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lists_values` +-- + +DROP TABLE IF EXISTS `lists_values`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `lists_values` ( + `dstdom_id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `list_id` bigint(20) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`dstdom_id`), + UNIQUE KEY `lists_values_unique` (`dstdom`,`list_id`), + KEY `lists_values_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `totalBlock` +-- + +DROP TABLE IF EXISTS `totalBlock`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `totalBlock` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `comment` text DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2031587 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `users` ( + `user_id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `comment` text DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`user_id`), + KEY `users_username_IDX` (`username`) USING BTREE, + KEY `users_password_IDX` (`password`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `usersBlackLists` +-- + +DROP TABLE IF EXISTS `usersBlackLists`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `usersBlackLists` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `comment` text DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `usersWhieLists_unique` (`dstdom`,`user_id`), + KEY `usersWhieLists_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `usersWhiteLists` +-- + +DROP TABLE IF EXISTS `usersWhiteLists`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `usersWhiteLists` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `dstdom` varchar(255) NOT NULL, + `y` int(11) NOT NULL DEFAULT 1, + `comment` text DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `usersWhieLists_unique` (`dstdom`,`user_id`), + KEY `usersWhieLists_dstdom_IDX` (`dstdom`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping routines for database 'squidconf' +-- +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2024-02-12 1:49:50 +