Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 26, 2009 @ 15:14
    Kim Andersen
    1

    Possible to add fields to a document type, using a package?

    For some weeks ago I made a site running Umbraco (surprise! :D ). I created  the content, images, subpages etc. etc.

     

    But now I have made som improvements, and developed some new features that I would like to deploy to the website. I made all the changes and improvements on my local machine, so I didn't destroy something on the working, "old" site. Actually the content of the "old" website is the newest and best, so the only thing I want to move is the new functionality.

     

    When I say new functionality, I mean some new XSLT files, changes in some templates/CSS etc. This is easy to move in the file system so no problem there.

    But it also means some extra new fields on some of the document types, new macros in Umbraco and other small things. Things that are stored in the database. So I am thinking of making some packages I can use to move the changes in the database, from my local development-site, to my already working site.

     

    But what happens if I put a document type in a package, and installs that package on the site where the same document type already exists? Only difference is that there are some more fields on the newly packed doc type.

    Will Umbraco automatically update the "old" doc type with the new fields or what will happen?

     

    I know that I could just manually create the fields on the already existing doc type, but still I'm interested in knowing how Umbraco will behave in the above scenario?

  • Vanja Tesin 30 posts 55 karma points
    Oct 26, 2009 @ 16:11
    Vanja Tesin
    2

    Hi Kim,

    We had the same dillema on our last Umbraco project. Here's what we found out with simple try-and-error: if there are new fields in the dtype, Umbraco will manage the additions fine, but if you remove fields, it won't remove the fields while installing.

    In  your case it is fine to create the package and to install it. Of course make full backup (filesystem and database) before doing that.

     

    Regards,

    Vanja

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 26, 2009 @ 22:37
    Kim Andersen
    0

    Okay, that sounds great Vanja.

    I have not removed any fields, so I could actually make a package with all of my document types and my new macros, and this would probably work without any errors - Even though theres always a small risk...

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 26, 2009 @ 22:40
    Aaron Powell
    1

    Provided that the aliases of the doc types are the same any missing properties will be added, and any matching properties will be updated (ie - changed description, regex or data type), again, matched on alias

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 26, 2009 @ 23:18
    Kim Andersen
    0

    Thanks for the answer as well slace. I'll try it out tomorrow (it's almost midnight here in Denmark now :) )

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 27, 2009 @ 16:20
    Kim Andersen
    0

    Thanks Slace and Vanja.

     

    This worked just like it was intended. I tried out the same with my macros, but this resulted in double macro's :P

    But both of your answers where great. If I could I would mark both of them as the correct answer :)

  • Daniil 10 posts 31 karma points
    Sep 20, 2013 @ 11:10
    Daniil
    0

    Sorry for necropost, but it might be important. Umbraco v6.1.4 (Assembly version: 1.0.4958.23183)

    "Provided that the aliases of the doc types are the same any missing properties will be added, and any matching properties will be updated (ie - changed description, regex or data type), again, matched on alias"

    Witnessed behaviour: missing properties are added, any matching properies are unchanged. This means description, mandatory flag, field type. Didn't check validation.

    For a test case I made both document type and package locally. Saved package to hdd, changed document type then installed package as local one.

Please Sign in or register to post replies

Write your reply to:

Draft