campus-total-block/load-domains-list.sql.in

32 lines
872 B
MySQL
Raw Normal View History

2024-02-12 01:53:41 +02:00
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;