{"action":"created","issue":{"url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2783","repository_url":"https://api.github.com/repos/OrchardCMS/OrchardCore","labels_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2783/labels{/name}","comments_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2783/comments","events_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2783/events","html_url":"https://github.com/OrchardCMS/OrchardCore/issues/2783","id":387107965,"node_id":"MDU6SXNzdWUzODcxMDc5NjU=","number":2783,"title":"How to alter the type of field?","user":{"login":"zl2fxy","id":19570956,"node_id":"MDQ6VXNlcjE5NTcwOTU2","avatar_url":"https://avatars3.githubusercontent.com/u/19570956?v=4","gravatar_id":"","url":"https://api.github.com/users/zl2fxy","html_url":"https://github.com/zl2fxy","followers_url":"https://api.github.com/users/zl2fxy/followers","following_url":"https://api.github.com/users/zl2fxy/following{/other_user}","gists_url":"https://api.github.com/users/zl2fxy/gists{/gist_id}","starred_url":"https://api.github.com/users/zl2fxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zl2fxy/subscriptions","organizations_url":"https://api.github.com/users/zl2fxy/orgs","repos_url":"https://api.github.com/users/zl2fxy/repos","events_url":"https://api.github.com/users/zl2fxy/events{/privacy}","received_events_url":"https://api.github.com/users/zl2fxy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-12-04T03:50:15Z","updated_at":"2018-12-06T20:39:42Z","closed_at":"2018-12-06T20:39:42Z","author_association":"NONE","body":"hi，\r\nIf I want to amend fieldtype，how will i do it，\r\nUsing  OfType(),like as it,but it seems useless.\r\ni want to alter but to add field，it is just useful for adding field.   \r\n_contentDefinitionManager.AlterPartDefinition(model.PartName, partBuilder =>\r\n               {\r\n                      partBuilder.WithField(model.Name, fieldBuilder =>\r\n                        {\r\n                                 fieldBuilder.OfType(model.Type);\r\n                                 fieldBuilder.WithDisplayName(model.DisplayName);\r\n                       });\r\n               });\r\nthank you!"},"comment":{"url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/comments/445021703","html_url":"https://github.com/OrchardCMS/OrchardCore/issues/2783#issuecomment-445021703","issue_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2783","id":445021703,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTAyMTcwMw==","user":{"login":"sebastienros","id":1165805,"node_id":"MDQ6VXNlcjExNjU4MDU=","avatar_url":"https://avatars0.githubusercontent.com/u/1165805?v=4","gravatar_id":"","url":"https://api.github.com/users/sebastienros","html_url":"https://github.com/sebastienros","followers_url":"https://api.github.com/users/sebastienros/followers","following_url":"https://api.github.com/users/sebastienros/following{/other_user}","gists_url":"https://api.github.com/users/sebastienros/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastienros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastienros/subscriptions","organizations_url":"https://api.github.com/users/sebastienros/orgs","repos_url":"https://api.github.com/users/sebastienros/repos","events_url":"https://api.github.com/users/sebastienros/events{/privacy}","received_events_url":"https://api.github.com/users/sebastienros/received_events","type":"User","site_admin":false},"created_at":"2018-12-06T20:39:42Z","updated_at":"2018-12-06T20:39:42Z","author_association":"MEMBER","body":"Let me rephrase the issue. You want to be able to change the types of field, and if the physical types are compatible then you would expect the data to be kept intact. For instance, converting from Html to Text, or Markdown to Html, which are store as strings, would be allowed. \r\n\r\nUnfortunately that would be a huge breaking change for OC as we would have to use the same property names based on a physical type, so we can't do it. And it would also make things harder to use, as instead of typing `myField.Markdown` we would type `myField.Text` so we'd lose some information.\r\n\r\nThe best solution is to do a script that will process all content items and change their state.\r\nThat could be something we would provide, I assume lots of scenarios might require content items migrations like this. We would provide a javascript script that would convert the content items.\r\n\r\nAnother option is to use the Activating event which will be triggered when a content item is loaded from the content manager. You could update the inner content at that point.\r\n\r\nI will close this issue as there is nothing directly actionable, but will create another issue to provide a migration utility.\r\n\r\nhttps://github.com/OrchardCMS/OrchardCore/issues/2808"}}
{"actor":{"display_login":"sebastienros"}}