Skip to content

Commit

Permalink
Feature/php71 (#53)
Browse files Browse the repository at this point in the history
- Removed: support for lesser then php7
- Added: strong and string types 
- Changed: ConfigFactory removed and method make form array moved to Config
- Changed: MariaDbGtidLogDTO replaced getSequenceNumber with getMariaDbGtid
- Fixed: Insert NULL in a boolean column returns no rows
- Fixed: float problem about time field type
- Fixed: column order
- Changed: getFields and getMasterStatus returns no VO
- Changed: Column to ColumnDTO and added ColumnDTOCollection 
- Changed: replaced getFields with getColumnDTOCollection in TableMap
- Added: more compatibility for mysql 5.5, 5.6, 5.7, maria 10 and 8.0 
- Removed: makeConfigFromArray
  • Loading branch information
krowinski authored Jul 8, 2019
1 parent 966d858 commit 722ad6b
Show file tree
Hide file tree
Showing 87 changed files with 2,265 additions and 3,920 deletions.
89 changes: 42 additions & 47 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
dist: trusty
dist: xenial

language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
env:
- DB=mysql57
- DB=mysql56
- DB=mariadb

cache:
apt: true
cache:
bundler: true
directories:
- $HOME/.composer/cache

sudo: required

before_script:
- "sudo /etc/init.d/mysql stop || true"
- "sudo apt-get remove mysql* -y --purge"
- "if [ $DB = 'mysql57' ]; then echo deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7 | sudo tee /etc/apt/sources.list.d/mysql.list; sudo apt-get update; sudo apt-get install mysql-server -y --allow-unauthenticated; fi"
- "if [ $DB = 'mysql56' ]; then echo deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.6 | sudo tee /etc/apt/sources.list.d/mysql.list; sudo apt-get update; sudo apt-get install mysql-server -y --allow-unauthenticated; fi"
- "if [ $DB = 'mariadb' ]; then sudo rm -rf /var/lib/mysql /etc/mysql; echo deb http://ftp.hosteurope.de/mirror/mariadb.org/repo/10.3/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/mysql.list; sudo apt-get update; sudo apt-get install mariadb-server-10.3 -y --allow-unauthenticated; fi"
- "sudo mysql_upgrade --force"

# Config
- "echo '[mysqld]' | sudo tee /etc/mysql/conf.d/replication.cnf"
- "echo 'log-bin=mysql-bin' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "echo 'server-id=1' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "echo 'binlog-format= row' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "echo 'max_allowed_packet= 64M' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "echo 'innodb_log_file_size= 250M' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "cat /etc/mysql/conf.d/replication.cnf"

# Enable GTID (only for mysql 5.*)
- "if [ $DB != 'mariadb' ]; then echo '[mysqld]' | sudo tee /etc/mysql/conf.d/gtid.cnf; echo 'gtid_mode=ON' | sudo tee -a /etc/mysql/conf.d/gtid.cnf; echo 'enforce_gtid_consistency' | sudo tee -a /etc/mysql/conf.d/gtid.cnf; echo 'binlog_format=ROW' | sudo tee -a /etc/mysql/conf.d/gtid.cnf; echo 'log_slave_updates' | sudo tee -a /etc/mysql/conf.d/gtid.cnf; cat /etc/mysql/conf.d/gtid.cnf; fi"
services:
- docker

matrix:
include:
- env:
- DB=mariadb:5.5
php: "7.1"
- env:
- DB=mysql:5.5
php: "7.1"
- env:
- DB=mysql:5.6
php: "7.1"
- env:
- DB=mysql:5.7
php: "7.1"
- env:
- DB=mysql:8.0
- TEST_AUTH=yes
php: "7.1"
- env:
- DB=mariadb:5.5
php: "7.2"
- env:
- DB=mysql:5.5
php: "7.2"
- env:
- DB=mysql:5.6
php: "7.2"
- env:
- DB=mysql:5.7
php: "7.2"
- env:
- DB=mysql:8.0
- TEST_AUTH=yes
php: "7.2"

# Start mysql (avoid errors to have logs)/var/lib/mysql
- "sudo /etc/init.d/mysql restart || true"
- "sudo tail -1000 /var/log/syslog"

- "mysql --version"
- "mysql -u root -e 'SELECT VERSION();'"
- "mysql -u root -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';\""
- "mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql"

- if [ $DB = 'mysql56' ]; then echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi
- if [ $DB = 'mysql57' ]; then echo "USE mysql;\nUPDATE user SET authentication_string=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi
- if [ $DB = 'mariadb' ]; then echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE User='root';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi
before_script:
- ./.travis/initializedb.sh

install:
travis_retry composer install --no-interaction --prefer-source;

script: vendor/bin/phpunit
travis_retry composer install --no-interaction --prefer-source;
36 changes: 36 additions & 0 deletions .travis/initializedb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -ex

if [ $DB == 'mysql:8.0' ]; then
docker run -p 0.0.0.0:3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_ROOT_HOST=% --name=mysql -d ${DB} \
mysqld \
--datadir=/var/lib/mysql \
--user=mysql \
--server-id=1 \
--log-bin=/var/lib/mysql/mysql-bin.log \
--binlog-format=row \
--max_allowed_packet=64M \
--default_authentication_plugin=mysql_native_password
else
docker run -p 0.0.0.0:3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_ROOT_HOST=% --name=mysql -d ${DB} \
mysqld \
--datadir=/var/lib/mysql \
--user=mysql \
--server-id=1 \
--log-bin=/var/lib/mysql/mysql-bin.log \
--binlog-format=row \
--max_allowed_packet=64M
fi

mysql() {
docker exec mysql mysql -proot "${@}"
}
while :
do
sleep 3
mysql --protocol=tcp -e 'select version()' && break
done

docker logs mysql

14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release Notes

## v6.0.0 (2019-?????)
- Removed: support for lesser then php7
- Added: strong and string types
- Changed: ConfigFactory removed and method make form array moved to Config
- Changed: MariaDbGtidLogDTO replaced getSequenceNumber with getMariaDbGtid
- Fixed: Insert NULL in a boolean column returns no rows
- Fixed: float problem about time field type
- Fixed: column order
- Changed: getFields and getMasterStatus returns no VO
- Changed: Column to ColumnDTO and added ColumnDTOCollection
- Changed: replaced getFields with getColumnDTOCollection in TableMap
- Added: more compatibility for mysql 5.5, 5.6, 5.7, maria 10 and 8.0
- Removed: makeConfigFromArray

## v5.0.6 (2019-02-05)
- Fixed json with slash (#48)
- Fixed disabling events that are needed (#46)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ git clone https://github.com/krowinski/php-mysql-replication.git
composer install -o
```

Compatibility (based on integration tests)
=========
- mysql 5.5
- mysql 5.6
- mysql 5.7
- mysql 8.0 (ONLY with mysql_native_password)
- mariadb 5.5
- mariadb 10.0 (partaily, problem with some cases of TIMESTAMP)
- probably percona versions as is based on native mysql

MySQL server settings
=========

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"type": "library",
"require": {
"php": ">=5.6",
"php": ">=7.1",
"ext-sockets": "*",
"ext-json": "*",
"ext-bcmath": "*",
Expand All @@ -24,7 +24,7 @@
"psr/simple-cache": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^7.0"
},
"license": "MIT",
"authors": [
Expand Down
Loading

0 comments on commit 722ad6b

Please sign in to comment.