This project is read-only.

When adding a part to a content type all existing instances should be updated


Ideally this should be done automatically from the updatefromx method in the migration.
Minimally there should be a check on the number of existing instances and a notification warning to incitate updating the existing items.


Piedone wrote Jun 19, 2013 at 12:14 PM

Could you elaborate? You can specify default values for record properties (from the record's ctor), that will be used when a part with a record is saved for a content item for the first time.

BertrandLeRoy wrote Jun 20, 2013 at 3:01 AM

I disagree. What's the scenario justifying this change? Also, don't forget that content type metadata is not a strict definition of what instances of that type contain. For example, code can weld and remove parts on the fly.

CSADNT wrote Jun 20, 2013 at 6:03 AM

I am not speaking of very special constructs where code add and remove parts on the fly, that's art of programming....
I just point that in 90% of situations, when you add a part using Migration and UpdateFromx, it is because something is missing and you have to:
1) add the new feature for new items
2) update the old ones to this missing feature.

An exemple would be the IdentityPart, you discover that it has been forgotten. But to be able to import / export you need to read and save all the existing entities.

Take the sample of a non programming Orchard user (?), he gets an update from the gallery concerning a module (following 1.7 as a factual sample).
If the update only adds the part to meta data engine, what about all the existing instances of the updated content item.
What if he tries to explot the new feature (lets say export) and 99% of its DB is NOK ?

nunez wrote Jun 21, 2013 at 1:44 AM

I an think of a few scenarios where this would be useful. Boss says: I want a custom link back to an Exchange data base. Or "We're going to expose part of the site to the external world: go add google tracking to all the pages".

Basically, refactoring.

For a site with 100's of pages, I'd not want to re-enter all of the data for that page just because I added something to the pages definition.

BertrandLeRoy wrote Jun 26, 2013 at 6:01 AM

@csadnt: the identity part and export/import scenario makes sense, yes, but it may be more a problem in the import/export feature than in the type management.

@nunez: you don't need this to add google tracking. Look at Contrib.GoogleAnalytics for an example of how to do it right, using a filter.