Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: house_lists version column in database with wrong type #1716

Merged
merged 8 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions data-otservbr-global/migrations/40.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
function onUpdateDatabase()
logger.info("Updating database to version 41 (optimize house_lists)")
db.query([[
ALTER TABLE `house_lists` DROP COLUMN `id`;
]])

db.query([[
ALTER TABLE `house_lists`
ADD COLUMN `version` bigint NOT NULL DEFAULT 0 AFTER `listid`,
ADD INDEX `version` (`version`),
ADD PRIMARY KEY (`house_id`, `listid`);
]])

db.query([[
ALTER TABLE house_lists
CHANGE version version BIGINT(20)
NOT NULL DEFAULT '0';
]])
return true
end
4 changes: 2 additions & 2 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `server_config` (
CONSTRAINT `server_config_pk` PRIMARY KEY (`config`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '38'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0');
INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '41'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0');

-- Table structure `accounts`
CREATE TABLE IF NOT EXISTS `accounts` (
Expand Down Expand Up @@ -438,7 +438,7 @@ DELIMITER ;
CREATE TABLE IF NOT EXISTS `house_lists` (
`house_id` int NOT NULL,
`listid` int NOT NULL,
`version` int NOT NULL DEFAULT '0',
`version` bigint NOT NULL DEFAULT '0',
`list` text NOT NULL,
PRIMARY KEY (`house_id`, `listid`),
KEY `house_id_index` (`house_id`),
Expand Down