Regenerate Data Model Error

Our customer_ud table has a few fields, with one called ARCollectionNotes_c. This field is a String x(500). We are needing more space, so I changed it to x(1000). Hit Save. Went into EAC, stopped task agent, stopped application pool, then went to regenerate the data model. I’m now getting the “not synchronized due to errrors” error. I’ve seen some posts on this, but none have provided clarity of what I should do.

I’m running 10.2.100.15 and this error was repeatable on the refreshed Pilot and Test servers. The log referenced in the error is:

Start time: 3/12/2019 9:23:44 AM
Database server: EP10SQL1
Database name: EpicorERPPilot
Using Windows authentication: True
User ID: GLCT\epicor
Schemas to include: 
Tables to exclude: Ice.SysSequence, Ice.DBMigrationLog
Generator version: 3.2.100.0
Server version: 3.2.100.9
Folder C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Source is deleted successfully.
Extracting "Epicor.ServiceModel.dll" from "C:\Program Files (x86)\Common Files\Epicor Software\Database Manager Extensions\3.2.100\DataModelGenerator\..\DbMigration.zip" to "C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Deployment\Server\Bin".
Extracting "Epicor.System.dll" from "C:\Program Files (x86)\Common Files\Epicor Software\Database Manager Extensions\3.2.100\DataModelGenerator\..\DbMigration.zip" to "C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Deployment\Server\Bin".
Extracting "EntityFramework.dll" from "C:\Program Files (x86)\Common Files\Epicor Software\Database Manager Extensions\3.2.100\DataModelGenerator\..\DbMigration.zip" to "C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Deployment\Server\Assemblies".
Synchronizing schema changes.
The object 'DF_Customer_UD_ARCollectionNotes_c' is dependent on column 'ARCollectionNotes_c'.
ALTER TABLE ALTER COLUMN ARCollectionNotes_c failed because one or more objects access this column.
ALTER TABLE [Erp].[Customer_UD] ALTER COLUMN [ARCollectionNotes_c] nvarchar(max)  NOT NULL  
EXEC Ice.DropColumn N'Erp', N'Customer_UD', N'ARCollectionNotes_c', 1
ALTER TABLE [Erp].[Customer_UD] ADD CONSTRAINT [DF_Customer_UD_ARCollectionNotes_c] DEFAULT '' FOR [ARCollectionNotes_c]

Error Generating the Data Models: The following tables were not synchronized due to errors. Review the log for more detailed information. Tables:
Erp.Customer_UD

You can’t just change the field. You have to delete (with all of the steps) and re-add (with all of the steps) the field. It’s annoying, but it’s how it currently works.

What do I do about the 100s of entries we already have?

Capture them somehow, (BAQ to excel) then DMT them back in afterwards.

That’s incredible. In the future, if I’m unsure about the length of UD string field, should I just default to using ‘max’ instead of trying to put a restraint on length?

That all depends on what you need. Just think carefully about it when you do it. You can also make another field, and move to that field. Just depends on which way is more work.

That’s not true. You can increase, but you cannot decrease without truncating.
I had this same problem–lemme dig up the resolution.

This is your problem: The object ‘DF_Customer_UD_ARCollectionNotes_c’ is dependent on column ‘ARCollectionNotes_c’.

What I ended up doing was going into the database and dropping that constraint.
Then I ran the data model regen, it increased my field for me, and it also added the constraint back in.

Please test this on a test database before taking my word for it.

5 Likes

Good to know. I guess I was assuming since you couldn’t change type, that you couldn’t change size too. Thanks for the correction @hmwillett.

Excellent! Dropping the constraint worked fine.

… now, do I dare regenerating the data model on production, or must I wait until after hours?..

It’s best to do it after hours.

2 Likes