Proof-of-concept for MariaDb code-first migrations in .NET 6 Web API using the Pomelo EF Provider.
-
Clone this repository
-
Install Docker if not already installed
-
Navigate to the cloned repository directory in your terminal of choice
-
Install dotnet ef core tools by running
dotnet tool install --global dotnet-ef
-
Run
docker compose up -d
to initialize the MariaDb database Docker container- Optional: Database configurations can be updated as necessary via edit to the
docker-compose.yml
file
- Optional: Database configurations can be updated as necessary via edit to the
-
From the terminal, start the MariaDB console within the Docker containter via
docker exec -it mariadb mariadb --user root -p{YOUR_DB_PASSWORD_HERE}
-
Provide
admin
user with grants to everything by runningGRANT SELECT ON *.* TO 'admin';
(must include semicolon for statement to execute) -
Open the PomeloMariaDbTest solution in your preferred .NET IDE (Rider, Visual Studio, etc.)
- Optional: Any changes made to the DB configuration in the
docker-compose.yml
file should be copied to the connection string in theappsettings.development.json
file
- Optional: Any changes made to the DB configuration in the
-
Running the solution will run the test migrations located in the
PomeloMariaDbTest.Data.Migrations
project
Additional migrations can be added using the CreateMigration.ps1
PowerShell script provided in the powershell
directory.