[U] Finalize mysql migration guide

pull/14/head
Azalea 2024-02-17 01:33:34 -05:00
parent 0ae29b1920
commit a65fa8cf10
1 changed files with 21 additions and 9 deletions

View File

@ -33,27 +33,39 @@ services:
Run the following command to export your data from MySQL. Please fill in the fields in the curly braces with your MySQL database details. Run the following command to export your data from MySQL. Please fill in the fields in the curly braces with your MySQL database details.
To prevent charset encoding issues, please run the following command on Linux / macOS.
For some reason Windows is still not using UTF-8 by default in 2024.
```bash ```bash
mysqldump --user={username} --password={password} --host={host} --port={port} {database} > aqua.sql mysqldump --user={username} --password={password} --host={host} --port={port} {database} > aqua.sql
``` ```
Now `aqua.sql` should be created. Please open `aqua.sql` and check if `utf8mb4_0900_ai_ci` exists.
If it does, you're running a higher version of MySQL, please replace `utf8mb4_0900_ai_ci` with `utf8mb4_general_ci` in the `aqua.sql` file.
```bash
# A command to replace the strings as mentioned above (Linux / macOS only).
sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' aqua.sql
```
### 3. Import Data to MariaDB ### 3. Import Data to MariaDB
Run the following command to import your data to MariaDB. Please fill in the fields in the curly braces with your MariaDB database details. Run the following command to import your data to MariaDB. Please fill in the fields in the curly braces with your MariaDB database details.
First, login to your MariaDB server.
```bash ```bash
mysql --user={username} --password={password} --host={host} --port={port} {database} < aqua.sql
```
### 4. Fix Flyway Schema History
AquaDX uses Flyway to manage database schema migrations. Most migrations were identical, but one migration used different case for MySQL and MariaDB, so we need to fix its checksum.
```shell
# Connect to your MariaDB server
mysql --user={username} --password={password} --host={host} --port={port} {database} mysql --user={username} --password={password} --host={host} --port={port} {database}
``` ```
Then, import the data.
```sql
source aqua.sql;
```
Finally, we need to fix a flyway checksum. Aqua uses Flyway to manage database schema migrations. Most migrations were identical, but one migration used different case for MySQL and MariaDB, so we need to fix its checksum.
Run the following SQL query to fix the checksum. Run the following SQL query to fix the checksum.
```sql ```sql