Migrating from v1.2 to v2.0¶
Introduction¶
Version 2.0 of the framework brings many improvements and bug fixes. \ Please read the changes carefully to migrate your project from version 1.2 to version 2.0. Link to the release note: Release note 2.0
How to migrate?¶
To migrate from version 1.2 to version 2.0, follow these steps:
- Analyze the changes: Analyze the changes brought by the new version to understand their impact on your project.
- Back up your data: Make sure you back up your data before migrating to avoid any loss.
- Carry out the following actions:
3.1 Update the composer file:
"require": {
"php": ">=8.1",
"ext-mbstring": "*",
-- "studoo/edu-framework": "1.2.x-dev"
++ "studoo/edu-framework": "2.x-dev"
},
3.2 Update the framework:
Result:
[...]
Package operations: 0 installs, 1 update, 0 removals
- Downloading studoo/edu-framework (2.x-dev xxxxx)
- Upgrading studoo/edu-framework (1.2.x-dev ef385b8 => 2.0.x-dev xxxxx): Extracting archive
[...]
3.3 Check the framework version:
Result:
Changes¶
There are many changes between version 1.2 and version 2.0. \ Here are the main changes to take into account:
Docker¶
In version 1.2, the services were started with the composer edu:docker:db-service:start mysql command. \
In version 2.0, the services are started with the docker compose up -d command.
Here are the actions to carry out to migrate from version 1.2 to version 2.0:
-
Stop the services: (if they are running)
-
Download the new Docker file:
Open a git bash terminal at the root of your project
To download the compose file, follow the instructions:
curl: (35)
If you get the error curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
Type the following command:
- Edit the new Docker file:
You can edit the compose.yaml file to adjust the settings to your environment.
environment:
MYSQL_DATABASE: app_db
-- MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
++ #MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
-- #MYSQL_ROOT_PASSWORD: root
++ MYSQL_ROOT_PASSWORD: root
#MYSQL_USER: app_db_user
#MYSQL_PASSWORD: app_db_password
Note
Note: The comments are added to help you understand the changes. Make sure you follow the YAML syntax to avoid errors (indentation, etc.).
- Start the services:
- Delete the old Docker folders:
Important information
Warning: Before deleting the old Docker folders, make sure the Docker services are running. Open a git bash terminal at the root of your project
- Delete the script lines in composer:
Open the
composer.jsonfile and delete the following lines:
"scripts": {
"edu:start": [
"Composer\\Config::disableProcessTimeout",
"php -S localhost:8042 -t public"
],
"edu:init": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
-- "edu:docker:db-service:start": "Studoo\\EduFramework\\Scripts\\DockerPilot::start",
-- "edu:docker:db-service:down": "Studoo\\EduFramework\\Scripts\\DockerPilot::down"
},
"scripts-descriptions": {
"edu:init": "Create env file",
"edu:start": "Start local server",
-- "edu:docker:db-service:start": "Start docker related database service [args : mysql / maria-db]",
-- "edu:docker:db-service:down": "Stop and remove docker related database service [args : mysql / maria-db]"
}
Debug bar¶
The environment configuration file has been modified to be more readable and easier to understand.
Here is the list of variables:
- The
APP_ENVvariable \ This variable enables debug features
| Value | Description |
|---|---|
| dev | Development mode |
| prod | Production mode |
Example:
- The
DB_TYPEvariable \ This variable defines the type of database
| Value | Description |
|---|---|
| mysql | MySQL database |
| mariadb | MariaDB database |
Example:
New features¶
New commands¶
New commands have been added to make developing your application easier.
php bin/edu make:api: To generate an API controllerphp bin/edu make:command: To generate a console command