mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-31 04:31:41 +00:00
* Migrate ip2group tables to ints from varchar * Need to bump these * MariaDB vs MySQL insanity
24 lines
723 B
SQL
24 lines
723 B
SQL
# Updating DB from 67-68 -AffectedArc07
|
|
# Changes the data types in ip2group from varchar to int
|
|
|
|
# Create temporary table
|
|
CREATE TABLE `ip2group_copy` (
|
|
`ip` INT UNSIGNED NOT NULL,
|
|
`date` TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
|
`groupstr` INT UNSIGNED NOT NULL,
|
|
PRIMARY KEY (`ip`) USING BTREE,
|
|
INDEX `groupstr` (`groupstr`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
# Migrate data
|
|
DELETE FROM ip2group WHERE groupstr = ''; # This is junk
|
|
|
|
INSERT INTO ip2group_copy (ip, date, groupstr)
|
|
SELECT INET_ATON(`ip`), `date`, CAST(`groupstr` AS UNSIGNED) FROM ip2group;
|
|
|
|
# Drop old table
|
|
DROP TABLE `ip2group`;
|
|
|
|
# Rename new table
|
|
RENAME TABLE `ip2group_copy` TO `ip2group`;
|