running upgrade script on initial deployrunning upgrade script on initial deployhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1148741322024-03-29T11:59:39Z2024-03-29T11:59:39ZRE: running upgrade script on initial deployALEX KEILhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1148793892019-08-25T05:34:45Z2019-08-25T05:34:45Zthanks!! I've just seen that in a bunch of tutorials and forums to have this dummy upgrade step before all the others.<br />thanks again for your helpALEX KEIL2019-08-25T05:34:45ZRE: running upgrade script on initial deployDavid H Nebingerhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1148770542019-08-25T05:33:03Z2019-08-25T05:33:03ZOn a new deployment, Liferay considers the current version to be 0.0.0, so no you don't need that 0.0.0 -> 0.0.0 thing. Just build them for the version you'll be at once the deployment is done.David H Nebinger2019-08-25T05:33:03ZRE: running upgrade script on initial deployALEX KEILhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1148767192019-08-25T00:29:24Z2019-08-25T00:29:24ZHello.Thanks for that detailed reply!<br /><br />I'll give a few more things a try and see how I go. Once question.. do you need that dummy upgrade step at the start or is the optional?<br />I have the dummy step going from 0.0.0 to 0.0.0, and then all the other steps go from 0.0.1 to 0.0.2, then 0.0.2 to 0.0.3, then 0.0.3 to 0.0.4.<br /><br />Based on what you wrote I would expect the initial deploy to run, stay at 0.0.0 and then all the upgrades would run step by step to 0.0.4.<br /><br />Is that a correct assumption? Each step that increments by 0.0.1 just makes some changes to the database (e.g. add fields to a table)<br />Thanks again ALEX KEIL2019-08-25T00:29:24ZRE: running upgrade script on initial deployDavid H Nebingerhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1148760192019-08-24T19:06:36Z2019-08-24T19:06:36ZThe upgrade processes are an implementation of a directed graph. From any node in the graph, you can only move if there is a directed path to another node. If no path exists, you stop.<br /><br /><br />Think of it like a map. If you are standing at one point in the map, and you want to get to another point, there has to be a route to get there. Unlike normal maps, you cannot go backward, you can only go forward. Another rule, if given two path options, you must always pick the shortest route (fewest stops) to your destination.<br /><br />So if you have one route, say 0.0.0 -> 0.0.1 -> 0.0.2 -> 0.0.3 and another route 0.0.0 -> 0.0.4, in new deployments your upgrade processes will run the 0.0.0 -> 0.0.4 step and get to that version.<br /><br />But if you deployed this previously and that environment is at 0.0.3, it is going to stay there. Why? Because there's no path to take from 0.0.3 -> 0.0.4.<br /><br />So you don't really have to know what version any environment might possibly be in, but you do have to build your routes so you don't leave any dangling endpoints (like at 0.0.3 before) otherwise they can't get on the track to the latest version you want them to be.<br /><br />Note that schema version cannot change anything for those nodes that are at 0.0.3; if they have no path to get to the schema version, there is nothing that can be done from a systems perspective to force the jump. You have to actually build the path to get off of 0.0.3.<br /><br />This whole process can get hairy, certainly. When possible I really try to avoid forking the path. A single route from 0.0.0 -> 0.0.1 -> 0.0.2 -> 0.0.3 -> 0.0.4 will always just work. And if your schema version is set to 0.0.1, upgrade processes won't stop there, they will continue until they get to the end, so it will always end at 0.0.4. So I typically won't change schema version at all (service builder is a different story, of course, because you want to change schema version when you change the service.xml file in some way) in order to keep the path simple and not have endpoints.<br /><br />But if you do need to support forks in the road, that's fine, just make sure you build in the necessary paths to get back on the main road.David H Nebinger2019-08-24T19:06:36Zrunning upgrade script on initial deployALEX KEILhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1148741312019-08-24T13:05:16Z2019-08-24T13:05:16ZHello all.<br />I have a question about writing a custom update script. I have written one for a portlet, and it will run if I set the required schema version accordingly, but I just cannot seem to get a full upgrade to run on an initial deploy. Apologes i do not have the codd handy.<br />For example the dummy upgrade step goes from 0.0.0 to 0.0.4I set required schema version to 0.0.4 in the service builder.<br />I have several upgrade scripts 0.0.0 to 0.0.10.0.1 to 0.0.2 etc<br />on initial deploy a record is created in the r