Merge pull request #8612 from micmania1/docs/upgrade-docs

DOCS add step to upgrade existing database class references
This commit is contained in:
Robbie Averill 2018-11-22 07:25:33 +01:00 committed by GitHub
commit 661d2567fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1126,7 +1126,22 @@ All your assets should be loading properly now.
This is a good point to commit your changes to your source control system before moving on to the next step.
## Step 10 - Running your upgraded site for the first time {#step10}
## Step 10 - Update database class references {#step10}
If you've updated your class names to use namespaces you will need to reflect those changes in any existing database fields. For example, if you've renamed your `HomePage` class to `App\HomePage` then the database `ClassName` column needs to be updated to point to the `App\HomePage` class, otherwise the CMS will tell you that the page is obsolete. This also applies to polymorphic relationships.
There is no automated way to do this, but you can use the list generated in .upgrade.yml and copy it to `app/_config/legacy.yml`, removing any classes that don't extend DataObject.
```
SilverStripe\ORM\DatabaseAdmin:
classname_value_remapping:
HomePage: App\HomePage
```
This will automatically update affected columns when you first build the database.
## Step 11 - Running your upgraded site for the first time {#step11}
You're almost across the finish line.