# \`Shopware\\Core\\Framework\\Migration\\InheritanceUpdaterTrait\` and \`KEY\`/\`CONSTRAINT\`

**URL:** <https://forum.shopware.com/t/shopware-core-framework-migration-inheritanceupdatertrait-and-key-constraint/67827>\
**Category:** Programming (EN)\
**Created:** [21. Juni 2020 um 12:35 UTC](https://forum.shopware.com/t/shopware-core-framework-migration-inheritanceupdatertrait-and-key-constraint/67827 "2020-06-21T12:35:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hansibert](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@Hansibert](https://forum.shopware.com/u/Hansibert)\
**Post date:** [21. Juni 2020 um 12:35 UTC](https://forum.shopware.com/t/shopware-core-framework-migration-inheritanceupdatertrait-and-key-constraint/67827/1 "2020-06-21T12:35:31Z")

</div>

Looking at the InheritanceUpdaterTrait ([platform/InheritanceUpdaterTrait.php at 42c8e52ea24366f3f19da913356b3356fc9dac0a · shopware/platform · GitHub](https://github.com/shopware/platform/blob/42c8e52ea24366f3f19da913356b3356fc9dac0a/src/Core/Framework/Migration/InheritanceUpdaterTrait.php)) I can see that it only creates a `BINARY(16)` column and no `KEY` or `CONSTRAINT`.

- When I generate the schema with `./bin/console ...` I get `KEY` and `CONSTRAINT` SQL.
- When I look at core entity tables in the DB (e.g. `customer_address.country`) I can see that there are keys and constraints defined.

What should I do?

- Use explicit SQL in my migration to create `KEY`s and `CONSTRAINT`s instead of using `$this-\>updateInheritance(...)`?
- Use `$this-\>updateInheritance(...)` and just live without `KEY`s and `CONSTRAINT`s?
- Do further investigation because I misunderstood how to associate my own entity to a core entity?

---

<div class="post-metadata">

**Author:** ![Hansibert](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@Hansibert](https://forum.shopware.com/u/Hansibert)\
**Post date:** [21. Juni 2020 um 12:57 UTC](https://forum.shopware.com/t/shopware-core-framework-migration-inheritanceupdatertrait-and-key-constraint/67827/2 "2020-06-21T12:57:37Z")

</div>

… also: the last argument of `updateInheritance` seems to be the storage name (e.g. ‚my\_custom\_entity\_id‘) and not the the property name (e.g. ‚myCustomEntity‘ or ‚myCustomEntityId‘ as suggested by the argument name ‚$propertyName‘).
