Copied to clipboard

Flag this post as spam?

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


  • dantiago 9 posts 89 karma points
    6 days ago
    dantiago
    0

    Re-creating an Umbraco site's database with custom migrations

    Hi all,

    For context, this post follows an issue I raised with Umbraco here: https://github.com/umbraco/Umbraco-CMS/issues/7065#issuecomment-550971305

    I don't think that the response actually addresses my issue but I'm being a good boy, following Sebastiaan's advice and posting it here instead of replying to him.

    I understand that migrations are run once and that their state is stored in the database. However, my question is how that state is added to a new database. The application doesn't run without the presence of the database and configuration within it (i.e. the umbracoLock table) but I can't seem to run the installer in order to create that database!

    I'd be grateful if anyone has any guidance they could offer or thoughts on whether this is actually a bug that I need to go back to Sebastiaan with.

    Thanks,

    Antony

  • dantiago 9 posts 89 karma points
    2 days ago
    dantiago
    0

    Bump - anyone had this issue at all? How are other people managing development of Umbraco sites in multi-developer environments?

  • Snow lizard 35 posts 105 karma points
    2 days ago
    Snow lizard
    0

    I'd like to know what's best practice here as well!

  • David Brendel 752 posts 2819 karma points c-trib
    1 day ago
    David Brendel
    0

    Hi,

    not sure if I get the problem. For multi dev we actually use backups of databases or actually shared ones.

    For the installer, if you remove the connection string and the version from the web.config then the normal installer should be execuded installing all tables in the database. Shouldn't that solve your problem?

    As said not actually sure what your problem is, so maybe I'm way off.

    Regards David

  • dantiago 9 posts 89 karma points
    1 day ago
    dantiago
    0

    Thanks for your reply David.

    I'm trying to get away from using backups because, for a complete source control environment, that would require checking a backup into source control and keeping it up to date which is a bit of a pain.

    The approach that you've outlined is exactly what I tried (and what I understood was the correct way to have the installer run again) but that's where I've got an issue.

    The installer is not running and I'm getting runtime errors when trying to run the site instead. I've traced those errors to the Initialize method of one of the custom migrations that have been added.

    It therefore looks to me as if the custom migrations are being run before Umbraco does the check to determine whether it needs to run the installer or not, which is obviously causing an issue because it's trying to run migrations in a non-existent database!

    Hope that clears up the issue.

  • Kevin Jump 1515 posts 9722 karma points MVP 3x c-trib
    1 day ago
    Kevin Jump
    100

    Hi,

    How are your custom migrations being initialized?

    are you using a composer/component model to kick off a migration?

    if so, you should check if you are using a composer that implements IUserComposer, as that will not run until Umbraco is installed..

  • dantiago 9 posts 89 karma points
    1 day ago
    dantiago
    0

    Ah! This may well be it. All of the composers are inheriting from the ComponentComposer base class.

    I'll update these to inherit from IUserComponent and give that a go. Sounds like the right solution to me though.

    I'll be at the developer meetup you're speaking at tomorrow so I'll be sure to thank you if that solves it!

    Thanks Kevin

  • Snow lizard 35 posts 105 karma points
    1 day ago
    Snow lizard
    0

    Thanks for your great Usync package Kevin. I was just watching a video of yours on it

  • Kevin Jump 1515 posts 9722 karma points MVP 3x c-trib
    1 day ago
    Kevin Jump
    0

    cool, if it doesn't -

    you can also explicitly set the runtime level (but you shouldn't have too) https://our.umbraco.com/documentation/Implementation/Composing/#runtimelevel

    .. now to go and write that talk for tomorrow ;)

  • dantiago 9 posts 89 karma points
    1 day ago
    dantiago
    0

    Thanks Kevin, that did indeed sort it!

Please Sign in or register to post replies

Write your reply to:

Draft