plone / plone.app.contenttypes

Dexterity-based content types for Plone
https://pypi.org/project/plone.app.contenttypes
13 stars 48 forks source link

Migration of custom types #133

Closed thet closed 9 years ago

thet commented 10 years ago

Regarding schema extenders: wouldn't it possible to even do migrations for schema extended types and other arbitrary types? I know, I always doubted that, but now I rethought that... We can of course get the extended schema with it's fields, properties and widgets and create just a new FTI type with a custom schema for that, as long as those schemata don't use custom fields and widgets, where we don't have an equivalent.

That's a shout in the blue - I don't know exactly how much effort this would be... But given a complete Dexterity API, this task sounds like it could be done in a few sprinting days.

thet commented 10 years ago

@davisagli - I posted that originally at https://github.com/plone/Products.CMFPlone/issues/184 but moved it over here.

pbauer commented 10 years ago

I really like the idea of having something to help with the migration. A full automatic-migration including creating and registering types is maybe to much.

As a first step we could allow mapping AT- to DX-Types and then AT-schema-fields (regardless if they are from a extender or a real field) to DX-schema-fields. With this information we could run a automatic migration. This way admins will szill have to model their new types in DX but won't have to write custom migrations (which is much harder than creating types).

thet commented 10 years ago

On Fri, 2014-02-28 at 01:23 -0800, Philip Bauer wrote:

I really like the idea of having something to help with the migration. A full automatic-migration including creating and registering types is maybe to much.

As a first step we could allow mapping AT- to DX-Types and then AT-schema-fields (regardless if they are from a extender or a real field) to DX-schema-fields. With this information we could run a automatic migration. This way admins will szill have to model their new types in DX but won't have to write custom migrations (which is much harder than creating types).

that sounds good. this way, it's also clear that the responsibility is more on the admin than us :)

i'd also love to have that. i expect that would help a lot with migrations, which otherwise are hard to sell because there is too much effort involved.

pbauer commented 10 years ago

Great, let's put in on the agenda for the wine-and-beer-sprint

davisagli commented 10 years ago

Yes, should not be too hard to do at least in the cases where the field/widget is recognized.

thet commented 10 years ago

i've recently done a bigger migration with a lot of custom types and schema extended ones. i'd love to discuss what i've done there at the sprint. my conclusion is, writing a custom migrator is no problem.

in short:

some useful and necessary additions in p.a.c: https://github.com/plone/plone.app.contenttypes/commits/thet (to be pull-requested). e.g. i've integrated an ICustomMigrator adapter interface. this one should then be called for every content type (e.g. when a schema extender is used for many content types, and you don't exactly know which ones because you provide that adapter within a migration script of the schema extender addon-package).

custom content type migration for collective.folderishtypes: https://github.com/collective/collective.folderishtypes/blob/dxmigration/collective/folderishtypes/dx/migration/__init__.py

schemaextended type migration for collective.richdescription (where the ICustomMigrator is used): https://github.com/collective/collective.richdescription/blob/dxmigration/collective/richdescription/dx/migration/__init__.py

timitos commented 10 years ago

This is a small blueprint which we discussed at the wine and beer sprint:

Goal

Provide a migration interfaces for custom/extended contenttypes from archetypes to dexterity.

Requirements

The dexterity contenttype already must be implemented and available.

Thoughts about the implementation

Migration Process

  1. The user starts the migration
  2. The migration configuration will be saved to an annotation
  3. Commit
  4. Start of Migration in a new Transaction (Maybe one Transaction per Contenttype)
  5. If there is an error at the migration -> Rollback Transaction
  6. If migration is successfull -> Commit
  7. Safe new state of migrated contenttypes in annotation
  8. Commit
  9. Show updated view.
timitos commented 10 years ago

This is a quick and dirty mockup of the migration view

This is a quick and dirty mockup of the migration view

pbauer commented 10 years ago

This is the revised mockup for the migration-form done by Vilmos Somogyi: plone_content_type2

pbauer commented 10 years ago

Work on this is done in the branch issue133_custom_types_migration: https://github.com/plone/plone.app.contenttypes/compare/issue133_custom_types_migration