Copied to clipboard

Flag this post as spam?

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


  • Nicholas Westby 2054 posts 7104 karma points c-trib
    Dec 01, 2015 @ 05:52
    Nicholas Westby
    0

    How Do Umbraco DB Migrations Work (NOT Upgrades)?

    Note: This question has nothing to do with upgrading Umbraco.

    Stumbled across this: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AlterDataTypePreValueTable.cs

    Basically, it shows something related to the namespace Umbraco.Core.Persistence.Migrations. I'm thinking this allows one to change the database when users upgrade your package.

    Trouble is, I can't find any documentation about it.

    In my case, I found that I needed to add a primary key column in order for my package to work with Azure. It's easy enough to release a version that includes that column, but I'm thinking this Umbraco migrations functionality would give me an elegant way of modifying the existing table (rather than requiring the developer to delete the table and losing all the data).

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Dec 01, 2015 @ 07:14
    David Brendel
    0

    Hi Nicholas,

    I'm using the migrations feature in my package to update tables that have changed. Will try to write some starting guide and post it here.

    It's fairly simple to use.

    Regards David

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Dec 01, 2015 @ 11:39
    David Brendel
    101

    Hi Nicholas,

    here's a small getting started guide. Hacked together in my lunch time. In fact nothing special to do to use migrations.

    http://www.davidbrendel.de/en/news/2015/12/1/migrations-in-umbraco/

    Regards David

  • Nicholas Westby 2054 posts 7104 karma points c-trib
    Dec 03, 2015 @ 17:23
    Nicholas Westby
    0

    Awesome, that is exactly what I was looking for. I think the piece I was missing was the migration runner.

    My assumption is that migration results are stored in the database so that even if you request they run again, they will not be run a second time.

    I'll do some testing to confirm that.

  • Nicholas Westby 2054 posts 7104 karma points c-trib
    Mar 29, 2016 @ 18:27
    Nicholas Westby
    0

    UPDATE: There is now an article that explains migrations very clearly and in detail: https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies