Model next:
KladrState: options: type: MyISAM collate: utf8_general_ci charset: utf8 columns: code_state: { type: string(3), notnull: true, unique: true, default: '000' } name: { type: string(40), notnull: true, unique: true } socr: { type: string(10), notnull: true } code: { type: string(13), notnull: true, unique: true } zipcode: { type: string(6), notnull: true } KladrLocality: options: type: MyISAM collate: utf8_general_ci charset: utf8 columns: state_id: { type: integer, notnull: true } code_city: { type: string(3), notnull: true, default: '000' } code_locality: { type: string(3), notnull: true, default: '000' } name: { type: string(40), notnull: true } socr: { type: string(10), notnull: true } code: { type: string(13), notnull: true, unique: true } zipcode: { type: string(6) } relations: KladrState: { onDelete: CASCADE, local: state_id, foreign: id, foreignAlias: KladrLocalities } KladrStreet: options: type: MyISAM collate: utf8_general_ci charset: utf8 columns: locality_id: { type: integer, notnull: true } code_street: { type: string(4), notnull: true, default: '0000' } name: { type: string(40), notnull: true } socr: { type: string(10), notnull: true } code: { type: string(17), notnull: true, unique: true } zipcode: { type: string(6), notnull: true } relations: KladrLocality: { onDelete: CASCADE, local: locality_id, foreign: id, foreignAlias: KladrStreets } Compania: columns: name: { type: string(255), notnull: true, unique: true } product: { type: string(255), notnull: true} address_id: { type: integer, notnull: true} sfera_id: { type: integer, notnull: true} okved_id: { type: integer, notnull: true} gruppa_id: { type: integer, notnull: true} kladr_id: { type: integer, notnull: true} relations: KladrStreet: { onDelete: CASCADE, local: kladr_id, foreign: id, foreignAlias: Comp} Okved: { onDelete: CASCADE, local: okved_id, foreign: id, foreignAlias: companias1 } Sfera: { onDelete: CASCADE, local: sfera_id, foreign: id, foreignAlias: companias2 } Grup : { onDelete: CASCADE, local: gruppa_id, foreign: id, foreignAlias: companias3 } Address: { onDelete: CASCADE, local: address_id, foreign: id, foreignAlias: companias4 }
When building a model, MySQL swears on the compania_kladr_id and Kladr_street_id communications. Help me to understand