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.
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.
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!
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
Bump - anyone had this issue at all? How are other people managing development of Umbraco sites in multi-developer environments?
I'd like to know what's best practice here as well!
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
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.
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..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
Thanks for your great Usync package Kevin. I was just watching a video of yours on it
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 ;)
Thanks Kevin, that did indeed sort it!
is working on a reply...