-
-
Notifications
You must be signed in to change notification settings - Fork 963
Schema migration #1192
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
noplanman
merged 1 commit into
php-telegram-bot:bot_api_5.1
from
massadm:db_schema_update
Mar 30, 2021
Merged
Schema migration #1192
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Invite Links | ||
CREATE TABLE IF NOT EXISTS `chat_invite_link` ( | ||
`id` BIGINT UNSIGNED COMMENT 'Unique identifier for this entry' | ||
PRIMARY KEY, | ||
`invite_link` VARCHAR(2083) CHARACTER SET 'ascii' COLLATE 'ascii_general_ci' NOT NULL COMMENT 'The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”', | ||
# IE7 has a 2083 character limit for HTTP GET operations: http://support.microsoft.com/kb/208427 | ||
`creator_id` BIGINT NOT NULL COMMENT 'Creator of the link', | ||
`is_primary` BOOLEAN NOT NULL COMMENT 'True, if the link is primary', | ||
`is_revoked` BOOLEAN NOT NULL COMMENT 'True, if the link is revoked', | ||
`expire_date` TIMESTAMP NULL COMMENT 'Point in time (Unix TIMESTAMP) when the link will expire or has been expired', | ||
`member_limit` MEDIUMINT UNSIGNED NULL COMMENT 'Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999', | ||
|
||
FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; | ||
|
||
# New update type | ||
CREATE TABLE IF NOT EXISTS `chat_member_updated` ( | ||
`id` BIGINT UNSIGNED COMMENT 'Unique identifier for this entry' | ||
PRIMARY KEY, | ||
`chat_id` BIGINT NOT NULL COMMENT 'Chat the user belongs to', | ||
`user_id` BIGINT NOT NULL COMMENT 'Performer of the action, which resulted in the change', | ||
`date` TIMESTAMP NOT NULL COMMENT 'Date the change was done in Unix time', | ||
`old_chat_member` TEXT NOT NULL COMMENT 'Previous information about the chat member', | ||
`new_chat_member` TEXT NOT NULL COMMENT 'New information about the chat member', | ||
`chat_invite_link_id` BIGINT UNSIGNED NULL COMMENT 'Chat invite link, which was used by the user to join the chat; for joining by invite link events only', | ||
|
||
FOREIGN KEY (`chat_id`) REFERENCES `chat` (`id`), | ||
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`), | ||
FOREIGN KEY (`chat_invite_link_id`) REFERENCES `chat_invite_link` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; | ||
|
||
# Updates about member status changes in chats | ||
ALTER TABLE `telegram_update` ADD COLUMN `my_chat_member_update_id` | ||
BIGINT UNSIGNED NULL COMMENT 'The bot''s chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.'; | ||
ALTER TABLE `telegram_update` ADD FOREIGN KEY (`my_chat_member_update_id`) REFERENCES `chat_member_updated` (`id`); | ||
ALTER TABLE `telegram_update` ADD COLUMN `chat_member_update_id` | ||
BIGINT UNSIGNED NULL COMMENT 'A chat member''s status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates.'; | ||
ALTER TABLE `telegram_update` ADD FOREIGN KEY (`chat_member_update_id`) REFERENCES `chat_member_updated` (`id`); | ||
|
||
# New service messages | ||
ALTER TABLE `message` ADD COLUMN `message_auto_delete_timer_changed` | ||
TEXT COMMENT 'MessageAutoDeleteTimerChanged object. Message is a service message: auto-delete timer settings changed in the chat' AFTER `channel_chat_created`; | ||
ALTER TABLE `message` ADD COLUMN `voice_chat_started` | ||
TEXT COMMENT 'VoiceChatStarted object. Message is a service message: voice chat started' AFTER `proximity_alert_triggered`; | ||
ALTER TABLE `message` ADD COLUMN `voice_chat_ended` | ||
TEXT COMMENT 'VoiceChatEnded object. Message is a service message: voice chat ended' AFTER `voice_chat_started`; | ||
ALTER TABLE `message` ADD COLUMN `voice_chat_participants_invited` | ||
TEXT COMMENT 'VoiceChatParticipantsInvited object. Message is a service message: new participants invited to a voice chat' AFTER `voice_chat_ended`; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.