diff --git a/examples/migration-5.7/.env b/examples/migration-5.7/.env new file mode 100644 index 00000000..b2abcb0e --- /dev/null +++ b/examples/migration-5.7/.env @@ -0,0 +1,6 @@ +DB_ROOT_PASSWORD='secret' +DB_USER='testuser' +DB_PASSWORD='password' +DB_DATABASE='testdb' +MYSQL_name='mysql-container' +MYSQL_MIGRATE_name='mysql-container-migrated' \ No newline at end of file diff --git a/examples/migration-5.7/compose-migrate-mysql.yml b/examples/migration-5.7/compose-migrate-mysql.yml new file mode 100644 index 00000000..80e52ad4 --- /dev/null +++ b/examples/migration-5.7/compose-migrate-mysql.yml @@ -0,0 +1,21 @@ +version: "3" +x-common-variables: &common-variables + MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} + MYSQL_USER: ${DB_USER} + MYSQL_PASSWORD: ${DB_PASSWORD} + +services: + mariadb-from-mysql57: + environment: + MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} + MYSQL_USER: ${DB_USER} + MYSQL_PASSWORD: ${DB_PASSWORD} + MARIADB_AUTO_UPGRADE: 1 + container_name: ${MYSQL_MIGRATE_name} + image: mariadb:lts + volumes: + # MySQL data that we want to migrate + - dbdata:/var/lib/mysql + +volumes: + dbdata: {} \ No newline at end of file diff --git a/examples/migration-5.7/compose-mysql.yml b/examples/migration-5.7/compose-mysql.yml new file mode 100644 index 00000000..275705f3 --- /dev/null +++ b/examples/migration-5.7/compose-mysql.yml @@ -0,0 +1,27 @@ +version: "3" + +services: + mysql: + environment: + MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} + MYSQL_USER: ${DB_USER} + MYSQL_PASSWORD: ${DB_PASSWORD} + MYSQL_DATABASE: ${DB_DATABASE} + container_name: ${MYSQL_name} + image: mysql:5.7 + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] + interval: 5s + timeout: 3s + retries: 2 + start_period: 0s + volumes: + # Preload files for MySQL data + - ./mysql:/docker-entrypoint-initdb.d:z + # We have to save MySQL volume that will be used in upgrade + - dbdata:/var/lib/mysql +volumes: + dbdata: {} + +networks: + backend: \ No newline at end of file diff --git a/examples/migration-5.7/mysql/mysql-data.sql b/examples/migration-5.7/mysql/mysql-data.sql new file mode 100644 index 00000000..c71d9588 --- /dev/null +++ b/examples/migration-5.7/mysql/mysql-data.sql @@ -0,0 +1,3 @@ +DROP TABLE IF EXISTS countries; +CREATE TABLE countries(name char(20)); +INSERT INTO countries values ("Bosnia & Herzegovina"); \ No newline at end of file