Copied to clipboard

Flag this post as spam?

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


  • Joe Dirte 21 posts 163 karma points
    Mar 08, 2017 @ 16:08
    Joe Dirte
    1

    Custom Table Best Practices

    When creating custom tables in the Umbraco DB, is it best to do this in the web project, or the core project?

    I can see arguments either way, but am curious if the community is leaning one way or another.

    Thanks!

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 09, 2017 @ 07:43
    Sebastiaan Janssen
    101

    Since you mention a Core and Web project, are you doing this on Umbraco Cloud?

    In either case, I blogged about this: https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/

    Do check out Shannon's comment at the bottom though and have a look at how we write those migrations in Umbraco's core: https://github.com/umbraco/Umbraco-CMS/tree/dev-v7/src/Umbraco.Core/Persistence/Migrations/Upgrades

    For example, here's one for adding a new table: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/AddRedirectUrlTable.cs

  • Joe Dirte 21 posts 163 karma points
    Mar 09, 2017 @ 17:20
    Joe Dirte
    0

    Thanks for the resources they have come in handy. Yes this is for Umbraco Cloud, but now that I think about it, I suppose it's an anti-pattern to build this up in the Web project.

    The migration guide is unbelievably helpful!

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 09, 2017 @ 17:23
    Sebastiaan Janssen
    0

    Ah yes, I forgot to say, make sure to do all your C# coding in the .Core project :-)

  • 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