mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
Optimizes IP Address Storage in DB (#25751)
* Initial commit * comment fix * Updates new columns position in table * Updates insert statement for connection_log * 57 to 58 - Handles changes post merge conflict
This commit is contained in:
@@ -506,7 +506,7 @@ CREATE TABLE `connection_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`datetime` datetime NOT NULL,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`ip` varchar(32) NOT NULL,
|
||||
`ip` INT UNSIGNED NOT NULL,
|
||||
`computerid` varchar(32) NOT NULL,
|
||||
`server_id` VARCHAR(50) NULL DEFAULT NULL,
|
||||
`result` ENUM('ESTABLISHED','DROPPED - IPINTEL','DROPPED - BANNED','DROPPED - INVALID') NOT NULL DEFAULT 'ESTABLISHED' COLLATE 'utf8mb4_general_ci',
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Updating DB from 57-58 ~Burza
|
||||
# Changes the data type for the `ip` column in `connection_log` from VARCHAR to INT
|
||||
|
||||
# Creates a temporary column for our new data type
|
||||
ALTER TABLE `connection_log`
|
||||
ADD COLUMN `ip_int` INT UNSIGNED NULL;
|
||||
|
||||
# Copies the data from the `ip` column to `ip_int` as our new data type
|
||||
UPDATE `connection_log`
|
||||
SET `ip_int` = INET_ATON(`ip`);
|
||||
|
||||
# Deletes the old `ip` column from the table
|
||||
ALTER TABLE `connection_log` DROP COLUMN `ip`;
|
||||
|
||||
# Updates the name of the temporary column to take place of the original
|
||||
ALTER TABLE `connection_log`
|
||||
CHANGE COLUMN `ip_int` `ip` INT UNSIGNED NOT NULL AFTER `ckey`;
|
||||
Reference in New Issue
Block a user