Skip to content

Fix DB schema update script and add tests for them. #1025

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
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
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ install:
- travis_retry composer install --prefer-dist --no-interaction

before_script:
- mysql -u root -e 'create database telegrambot; use telegrambot; source structure.sql;'
# Get structure from 0.44.1, to test all migration steps.
- git fetch origin 0.44.1 && git checkout FETCH_HEAD -- structure.sql
- mysql -u root -e "create database telegrambot_migrations; use telegrambot_migrations; source structure.sql;"
- git checkout HEAD -- structure.sql
- mysql -u root -e "create database telegrambot; use telegrambot; source structure.sql;"

script:
- for SCHEMA_UPDATE_FILE in $(ls utils/db-schema-update); do mysql -u root -e "use telegrambot_migrations; source utils/db-schema-update/${SCHEMA_UPDATE_FILE};"; done;
- composer check-code
- if [ "$TRAVIS_PHP_VERSION" == "7.3" ]; then composer test-cov; else composer test; fi

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Notes
- [:ledger: View file changes][Unreleased]
### Added
- Tests for schema update scripts, to ensure that updates work as expected.
### Changed
### Deprecated
### Removed
### Fixed
- DB schema update from 0.60.0 to 0.61.0.
### Security

## [0.61.0] - 2019-11-02
Expand Down
2 changes: 1 addition & 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,4 @@
ALTER TABLE `message`
ALTER TABLE `telegram_update`
DROP KEY `message_id`,
ADD KEY `message_id` (`message_id`),
ADD KEY `chat_message_id` (`chat_id`, `message_id`);