Skip to content

MySQL fixes #1105

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

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Removed
### Fixed
- Primary key for `poll_answer` also requires the `user_id`.
- Small SQL foreign key fixes.
### Security

## [0.62.0] - 2020-04-08
Expand Down
1 change: 0 additions & 1 deletion structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ CREATE TABLE IF NOT EXISTS `message` (
FOREIGN KEY (`forward_from`) REFERENCES `user` (`id`),
FOREIGN KEY (`forward_from_chat`) REFERENCES `chat` (`id`),
FOREIGN KEY (`reply_to_chat`, `reply_to_message`) REFERENCES `message` (`chat_id`, `id`),
FOREIGN KEY (`forward_from`) REFERENCES `user` (`id`),
FOREIGN KEY (`left_chat_member`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

Expand Down
8 changes: 7 additions & 1 deletion utils/db-schema-update/0.60.0-0.61.0.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
SET FOREIGN_KEY_CHECKS=0;

ALTER TABLE `telegram_update`
DROP KEY `message_id`;

ALTER TABLE `telegram_update`
DROP KEY `message_id`,
ADD KEY `message_id` (`message_id`),
ADD KEY `chat_message_id` (`chat_id`, `message_id`);

SET FOREIGN_KEY_CHECKS=1;
2 changes: 2 additions & 0 deletions utils/db-schema-update/0.62.0-unreleased.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ ALTER TABLE `poll` ADD COLUMN `open_period` int UNSIGNED DEFAULT NULL COMMENT 'A
ALTER TABLE `poll` ADD COLUMN `close_date` timestamp NULL DEFAULT NULL COMMENT 'Point in time (Unix timestamp) when the poll will be automatically closed' AFTER `open_period`;

ALTER TABLE `poll_answer` DROP PRIMARY KEY, ADD PRIMARY KEY (`poll_id`, `user_id`);

ALTER TABLE `message` DROP CONSTRAINT `message_ibfk_6`;