Expand my Community achievements bar.

SOLVED

Error when trying to update database structure

Avatar

Level 2

Hello, 

Itried to extend the schema nms Recipient so i can use the extension to do my tests, but when i try to update the database structure so i can use the extension   i have this error 

amir1b98132711_0-1623060688921.png

 do you have any ideas on how to fix this problem 

nms recipient is factory configured object, i can't edit it.

 

Regards 

Amir 

1 Accepted Solution

Avatar

Correct answer by
Level 2
Thank you very much Cedric there was some issues with the schema cus Recipient, there was some links that points to inexisting tables, i cleaned that and it works

View solution in original post

9 Replies

Avatar

Level 6

Hello Amir,

Can you copy your schema extension here ? It's difficult to help without more elements. It can come from your extension, but to be sure we have so see it.

Also, when you go to the nms:recipient schema edition, even if you can't edit it, you can see the generated schema (with its extensions) on the second tab 'preview' on the bottom. I don't know if it can fit into a message, but it would be very usefull if you can copy it here.

 

Thank you,

Cedric

Avatar

Level 2

Hello Cedric,

this is the extension preview  : 

<?xml version='1.0'?>
<schema/>

 

and this is nms recipient xml file , you can donwload it from my drive : 

 

nms Recipient Preview 

Regards 

 

Amir

 

 

 

 

Avatar

Level 2
Hello Cedric , sorry i copy past the edit tab and not the preview here is the preview tab,

Avatar

Level 6
Something strange appears on the generated schema : from the cus:recipient schema, a 'recipient' element exists into the main recipient root element, with dbIndex. It seems the extension is not well formed. Can you share the cus:recipient xml please ?

Avatar

Level 2
it s the same as abo recipient : <?xml version='1.0'?> <schema/>

Avatar

Level 2

and this is the edit tab :

 

<srcSchema _cs="Recipients (cus)" created="2020-07-16 12:42:15.803Z" createdBy-id="0"
desc="Recipient table (profiles" entitySchema="xtk:srcSchema" extendedSchema="nms:recipient"
img="nms:recipient.png" label="Recipients" labelSingular="Recipient" lastModified="2020-07-16 12:51:07.769Z"
mappingType="sql" md5="6AEF746D4B3D9C35AA415878E503528E" modifiedBy-id="0"
name="recipient" namespace="cus" xtkschema="xtk:srcSchema">


<element desc="Recipient table (profiles" img="nms:recipient.png" label="Recipients"
labelSingular="Recipient" name="recipient"/>

<enumeration basetype="byte" name="typeClient">
<value label="N/A" name="na" value="0"/>
<value label="Optique" name="optique" value="1"/>
<value label="Contacto" name="contacto" value="2"/>
<value label="Solaire" name="solaire" value="3"/>
<value label="Mixte" name="mixte" value="9"/>
</enumeration>

<element desc="Table des consommateurs (profils)" img="nms:recipient.png" label="Consommateurs"
labelSingular="Consommateur" name="recipient">
<!--
<dbindex name="code_mag">
<keyfield xpath="@code_magasin"/>
</dbindex>
-->

<dbindex name="code_mag">
<keyfield xpath="@code_magasin"/>
<keyfield xpath="@id_client_magasin"/>
</dbindex>
<dbindex name="client_uni">
<keyfield xpath="@id_client_unique"/>
</dbindex>
<dbindex name="phoneNumber">
<keyfield xpath="@mobilePhone"/>
</dbindex>
<dbindex name="phoneNumberCorrect">
<keyfield xpath="@mobilePhoneCorrect"/>
</dbindex>


<attribute label="Retour data" name="retourDWH" type="string"/>
<attribute advanced="true" name="company"/>
<attribute advanced="true" name="age"/>
<attribute advanced="true" name="salutation"/>
<attribute advanced="true" name="id"/>
<element advanced="true" name="comment"/>
<attribute advanced="true" name="created"/>
<attribute advanced="true" name="lastModified"/>
<attribute advanced="true" name="middleName"/>
<attribute advanced="true" name="domain"/>
<attribute advanced="true" name="fax"/>
<attribute advanced="true" name="emailFormat"/>
<attribute advanced="true" name="gender"/>
<attribute advanced="true" name="cryptedId"/>
<attribute advanced="true" name="language"/>
<attribute advanced="true" name="blackList"/>
<attribute advanced="true" name="blackListPostalMail"/>
<attribute advanced="true" name="blackListEmail"/>
<attribute advanced="true" name="blackListFax"/>
<attribute advanced="true" name="blackListMobile"/>
<attribute advanced="true" name="blackListPhone"/>
<attribute advanced="true" name="account"/>
<attribute advanced="true" name="origine"/>
<attribute advanced="true" name="status"/>
<element advanced="true" name="postalAddress"/>
<element advanced="true" name="location"/>
<element advanced="true" name="country"/>
<element advanced="true" name="stateLink"/>
<attribute expr="[base_mr/@groupe_enseigne]" label="Enseigne calculé" name="enseigne_calcule"/>
<attribute label="Code du magasin" name="code_magasin" type="long"/>
<attribute label="Identifiant unique du client" name="id_client_unique" type="string"/>
<attribute label="Identifiant client du magasin" name="id_client_magasin" type="long"/>
<attribute label="Civilité" name="civilite" userEnum="kry_enum_ouv_civilite"/>
<attribute label="Genre" name="genre" type="string" userEnum="kry_enum_ouv_genre"/>
<attribute label="Décédé" name="decede" type="boolean"/>
<attribute label="Code foyer" name="code_foyer" type="long"/>
<attribute label="Signalement du consommateur" name="signalement_client" type="long"/>
<attribute label="Encarté" name="encarte" type="boolean"/>
<attribute label="Appartient à un foyer" name="presence_foyer" type="boolean"/>
<attribute label="Enseigne" name="enseigne" type="string" userEnum="kry_enum_ouv_enseigne"/>
<attribute label="Portable corrigé" length="32" name="mobilePhoneCorrect" type="string"/>

<attribute default="true" label="Fiche active" name="actif" type="boolean"/>
<attribute label="Date de droit a l'oubli" name="dateDroitOubli" type="date"/>

<!-- Ajout KPC 20191021 -->
<attribute advanced="true" desc="Nom corrigé pour URL" label="Nom corrigé pour URL"
length="50" name="nomCorrige" type="string"/>
<attribute advanced="true" label="MD ref vente" name="md_ref_vente" type="long"/>
<!-- Fin Ajout KPC -->

<!-- Ajout KPC 20180712 -->
<attribute label="Date de dernière prescription" name="dateDernierePrescription"
type="date"/>
<!-- Fin Ajout KPC -->

<!-- Ajout KPC 20190227: Medecin Direct -->
<attribute label="Date d'inscription MD" name="dateInscriptMD" type="date"/>
<!-- Fin Ajout KPC -->

<attribute default="1" enum="typeClient" label="Type de client" name="typeClient"
type="byte"/>
<attribute desc="Date renouvellement pour ses lentilles journalieres (denormalisation)"
label="Date renouvellement Journalier" name="renouvellementJournalier"
type="date"/>
<attribute desc="Date renouvellement pour ses lentilles mensuelles (denormalisation)"
label="Date renouvellement Mensuel" name="renouvellementMensuel" type="date"/>

<!-- Ajout KPC - 31/10/2017 -->
<attribute label="Date dernier achat externe" name="dernierAchatExt" type="date"/>
<!-- Fin Ajout KPC -->

<!-- Ajout KPC Client unique- 31/01/2018 -->
<attribute label="Magasin prioritaire" name="flagClientUnique" type="long"/>
<!-- Fin Ajout KPC 31/01/2018 -->

<!-- Ajout KPC Medecin Direct- 15/04/2019 -->
<attribute label="Date inscription Medecin Direct" name="dtInscriptionMD" type="date"/>
<!-- Fin Ajout KPC 31/01/2018 -->

<element label="01 - Coordonnées postales" name="coordonnees_postales">
<!-- <attribute label="Adresse postale" length="255" name="adresse" type="string"/> -->
<attribute label="Complément d'adresse" length="255" name="complement_adresse"
type="string"/>
<!-- <attribute label="Code Postal" length="255" name="code_postal" type="string"/>-->
<attribute label="Ville" length="255" name="ville" type="string"/>
<attribute label="Pays" length="255" name="pays" type="string" userEnum="kry_enum_ouv_pays"/>
</element>
<element label="02 - Contactabilité" name="contactabilite">
<attribute label="NPAI" name="npai_postal" type="boolean"/>
<attribute label="Média préféré" name="media_favori" type="string" userEnum="kry_enum_ouv_media"/>
<attribute label="Mailing autorisé" name="mailing_autorise" type="boolean"/>
<attribute label="SMS autorisé" name="sms_autorise" type="boolean"/>
<attribute label="E-mail autorisé" name="email_autorise" type="boolean"/>
</element>
<element label="03 - Centre d'intérêt" name="centre_interet">
<attribute label="Activité principale 1" name="id_activite1" type="long"/>
<attribute label="Activité principale 2" name="id_activite2" type="long"/>
<attribute label="Activité principale 3" name="id_activite3" type="long"/>
</element>
<!-- <element name="postalAddress">
<attribute expr="AllNonNull3([../coordonnees_postales/@code_postal], [../coordonnees_postales/@ville], [../@lastName])"
name="addrDefined"/>
</element> -->

<!-- Ajout Velvet - 21/07/2015 -->
<attribute advanced="true" label="Source" length="1" name="source" type="string"/>
<!-- Fin Ajout Velvet -->

<!-- Ajout KPC 20161107 -->
<attribute label="Valeur du segment KRYS (old)" name="IdSegmKrys" type="long"/>
<element externalJoin="true" label="Segment Krys (old)" name="conso_segmKrys"
revIntegrity="normal" revLabel="Consommateur" revLink="segmKrys_conso"
target="kry:Segment_Ref" type="link">
<join xpath-dst="@IdSegm" xpath-src="@IdSegmKrys"/>
</element>
<!-- Fin KPC 20161107 -->

<!-- Ajout KPC 20180524 -->
<attribute label="Valeur du segment Contacto" name="IdSegmContacto" type="long"/>
<element externalJoin="true" label="Segment Contacto" name="conso_segmContacto"
revIntegrity="normal" revLabel="Consommateur segmContacto" revLink="segmContacto_conso"
target="kry:Segment_Ref" type="link">
<join xpath-dst="@IdSegm" xpath-src="@IdSegmContacto"/>
</element>
<attribute label="Valeur du segment Optique" name="IdSegmOptique" type="long"/>
<element externalJoin="true" label="Segment Optique" name="conso_segmOptique"
revIntegrity="normal" revLabel="Consommateur segmOptique" revLink="segmOptique_conso"
target="kry:Segment_Ref" type="link">
<join xpath-dst="@IdSegm" xpath-src="@IdSegmOptique"/>
</element>
<attribute label="Valeur du segment Audio" name="IdSegmAudio" type="long"/>
<element externalJoin="true" label="Segment Audio" name="conso_segmAudio" revIntegrity="normal"
revLabel="Consommateur segmAudio" revLink="segmAudio_conso" target="kry:Segment_Ref"
type="link">
<join xpath-dst="@IdSegm" xpath-src="@IdSegmAudio"/>
</element>
<!-- Fin KPC 20180524 -->

<!-- Ajout KPC 20/06/2019 -->
<attribute label="Nom interlocuteur" name="NomInterlocuteur" type="string"/>
<attribute label="Prenom interlocuteur" name="PrenomInterlocuteur" type="string"/>
<!-- Ajout KPC 20/06/2019 -->

<element label="Base MR" name="base_mr" revIntegrity="normal" revLabel="Consommateur"
target="kry:base_mr" type="link">
<join xpath-dst="@code" xpath-src="@code_magasin"/>
</element>

<!-- Ajout KPC CCU 08/07/2020 -->

<element label="Désabonnement" name="desabo" revIntegrity="normal" revLabel="Consommateur"
target="kry:desabonement" type="link">
<join xpath-dst="@id_client_unique" xpath-src="@id_client_unique"/>
</element>

<!-- Ajout KPC CCU 08/07/2020 -->

<sysFilter>
<condition enabledIf="hasNamedRight('local')=false and hasNamedRight('admin')=false and hasNamedRight('kry_right_servConso')=false"
expr="@enseigne_calcule=[currentOperator/@enseigne]"/>
<!-- KPC 20180426 - Gestion du droit a l'oubli -->
<!-- KPC 20180611 - Gestion des fichers actives ou non -->
<condition enabledIf="!(hasNamedRight('admin'))" expr="(@dateDroitOubli IS NULL) and (@actif=true)"/>
</sysFilter>
</element>
<createdBy _cs="KPC pvaidie (kpc)"/>
<modifiedBy _cs="KPC pvaidie (kpc)"/>
</srcSchema>

Avatar

Level 6
ok Amir, this a strange thing, because the sub element 'Consommateurs' is called 'recipient'. So, when you want to access to those 'consommateurs' info, the xpath is '[recipient/recipient]' ? But it's ok, you can do it. The thing is that if you want declare indexes (with <dbindex> elements), I think you have to put them not into this sub element, but directly into the main recipient' element. You can put them near the <enumeration name="typeClient"/> element (just before of after). I think this is the reason of the error you see. Beware, if the columns targeted by the indexes already exist and are populated, the database structure upgrade can take some times. Cedric

Avatar

Correct answer by
Level 2
Thank you very much Cedric there was some issues with the schema cus Recipient, there was some links that points to inexisting tables, i cleaned that and it works