Skip to content

Commit f62780e

Browse files
authored
Merge pull request #1025 from noplanman/1023-fix_migration_script
Fix DB schema update script and add tests for them.
2 parents 8e7155e + ed66b84 commit f62780e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ install:
3939
- travis_retry composer install --prefer-dist --no-interaction
4040

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

4448
script:
49+
- 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;
4550
- composer check-code
4651
- if [ "$TRAVIS_PHP_VERSION" == "7.3" ]; then composer test-cov; else composer test; fi
4752

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
77
### Notes
88
- [:ledger: View file changes][Unreleased]
99
### Added
10+
- Tests for schema update scripts, to ensure that updates work as expected.
1011
### Changed
1112
### Deprecated
1213
### Removed
1314
### Fixed
15+
- DB schema update from 0.60.0 to 0.61.0.
1416
### Security
1517

1618
## [0.61.0] - 2019-11-02
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ALTER TABLE `message`
1+
ALTER TABLE `telegram_update`
22
DROP KEY `message_id`,
33
ADD KEY `message_id` (`message_id`),
44
ADD KEY `chat_message_id` (`chat_id`, `message_id`);

0 commit comments

Comments
 (0)