title | description | ms.author | ms.date | ms.tgt_pltfrm | ms.topic | author |
---|---|---|---|---|---|---|
AppSourceCop Error AS0043 |
The clustered key must not be deleted. |
solsen |
02/26/2024 |
na |
reference |
SusanneWindfeldPedersen |
The clustered key must not be deleted
The clustered key must not be deleted.
It is not allowed to rename or remove the clustered key in a table. For more information on table keys, see Table Keys.
Note
This rule validates tables independently of their Accessibility or ObsoleteState, because tables are always used when synchronizing the schema defined in the extension to the database.
In order to fix this diagnostic, you must rename the clustered key or add it back so that it matches its definition in your baseline extension.
Version 1.0 of the extension:
table 50100 MyTable
{
fields
{
field(1; MyIntegerField; Integer) { }
field(2; MyTextField; Text[50]) { }
}
keys
{
key(PK; MyIntegerField) { }
key(ClusteredKey; MyTextField)
{
Clustered = true;
}
}
}
Version 2.0 of the extension:
table 50100 MyTable
{
fields
{
field(1; MyIntegerField; Integer) { }
field(2; MyTextField; Text[50]) { }
}
keys
{
key(PK; MyIntegerField) { }
}
}
In version 2.0 of the extension, the clustered key ClusteredKey
has been removed. This change is not allowed by the synchronization engine.
table 50100 MyTable
{
fields
{
field(1; MyIntegerField; Integer) { }
field(2; MyTextField; Text[50]) { }
}
keys
{
key(PK; MyIntegerField) { }
key(NewClusteredKey; MyTextField)
{
Clustered = true;
}
}
}
In version 2.0 of the extension, the clustered key has been renamed from ClusteredKey
to NewClusteredKey
. This change is detected as a removal of ClusteredKey
and is not allowed by the synchronization engine.
AppSourceCop Analyzer
Get Started with AL
Developing Extensions