Skip to content

Migrations

Ângelo Tadeucci edited this page Apr 27, 2024 · 1 revision

Creating a migration

When making changes to the schema (Maple2.Database.Model), you will need to generate a migration to apply the changes to existing tables. This can be done by running in the terminal inside the Maple2.Server.World folder:

dotnet ef migrations add $NAME

If you need to regenerate the migration, first remove it:

dotnet ef database update $OLD_VERSION
dotnet ef migrations remove

Note: Ensure that Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs is also reverted properly. (The tool always seems to mess it up, so you might have to manually revert it through git)

Applying a Migration:

To apply the latest migration, you can again just run:

dotnet ef database update

You can also specify and optional migration name to switch between older versions:

dotnet ef database update $NAME

Clone this wiki locally