Unique Attribute for an existing Enity with existing records

Unique Attribute for an existing Enity with existing records

  

Hi,
I have a static Entity. It contains some records. I want to add a unique attribute, lets' say: Code. I've added this attribute, added a new unique index on it, filled all records with unique values. But when I'm trying to publish it, the message is:

Unable to upgrade database schema. Error trying to create index on database "table" over "field"

It seems that the index is tried to be created before this column is filled. Can I do anything?

Regards
Tomasz
since it's a static entity, why not make it non-unique, fill the values, publish it, then make it unique, publish it again?


Yes, it will work in my development environment. But if I would like to deploy the application to the production environment (where the old version of this Entity, without the Code attribute, exists), the issue would immedietely be back :)

Regards
Tomasz
Also, I don't know how large the static entitiy is, but do you really need an Index?

And if so, can't you first publish without the index, and then with it?

The index is just to be sure, that the developer fills the Code attribute properly. Of course it is not a "must". I treat it as an example of a potential issue.
The (obvious) two stage publishing is good only for development, not for publishing the application in the production environment - as i have mentioned previously.
As I can see, there is no solution for this issue. And it is understandable.

Regards
Tomasz
I'm not sure I understand why you need that solution. Can't you create the static entity to have the code as identifier? That's what we usually do.
Well, you're right. I've been thinking of identifiers as autonumbers only. Thanks for the tip :-)

Regards
Tomasz
The added benefit is that in tables that have a foreign key to the static entity, it's easier to see what's in the content when querying when developing or trouble shooting (e.g. test query or via an external tool), without joining the static entity itself (e.g. if your attribute CarTypeId says "SED" or "HBK" for sedan and hatchback, that says a lot more than 5 and 7).