Description
This guide describe how to change enum type name/namespace, after this enum was used in database enum fields. Two options are available:
OPTION #1: Changing enum type manually
-
Let's say you have
MyEnum
enum, which is used inTest.enumField
database field, and you want to rename enum's type name toMyEnumNewName
-
Create the copy of
MyEnum
enum with some unique name, let's sayMyEnumTemp
-
Change database field's enum type (
MyEnum
->MyEnumTemp
). Save database. -
Change C# enum type name in your IDE (
MyEnum
->MyEnumNewName
) -
Change database field's enum type (
MyEnumTemp
->MyEnumNewName
). Save database. -
Delete C# temporary enum
MyEnumTemp
OPTION #2: Using "Settings->Enumerations" tool
- Rename enum type/namespace using your IDE
- Switch to BGDatabase window and click on Reload button. Database will not be loaded, cause enum type can not be loaded using old name/namespace
- Select "Settings->Enumerations" and add enum type name mappings (Old name->New name) for each change.
- Click on "Reload" button. Once database is loaded, click on both "Clear the mappings" and "Save repo" buttons
Extra tip
Use custom Attribute to mark enums, which are used inside database