cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write a declarative schema that references a column from an existing table?

How do I write a declarative schema that references a column from an existing table?

I'm a novice so am struggling to work out how to write a schema that inserts a column ("manufacturer") with the values pulled in from the existing table but can't find any clear guides to help me.

The data I need is referenced across three tables:

  1. The Attribute_id "83" refers to the field "manufacturer" in "Table 1"
  2. The option_id refers to the text string for manufacturer name in "Table 2"
  3. The attribute_id and option_id are linked in "Table 3"

The Magento developer guide shows this format for the constraint but I don't know how to apply that to my needs:

 

constraint xsi:type="foreign" referenceId="COMPANY_CREDIT_COMPANY_ID_DIRECTORY_COUNTRY_COUNTRY_ID" table="company_credit" column="company_id" referenceTable="company" referenceColumn="entity_id" onDelete="CASCADE"/>

 



Screenshot 2020-12-07 211319.pngScreenshot 2020-12-07 232449.pngScreenshot 2020-12-07 211445.png