Update Extension => Database Migration

  • Hey,

    i'd like to write an update for my extension. It's necessary to modify one of my tables. For that i added following snippet to my scripts.php

    My current version is 1.0.0. So if i'm right this should run my migration, right? It don't and i have really no idea why....

    Has someone any ideas?

  • Hi. So your old version is 1.0.0 and you are updating it to 1.0.1, right?

    You increased the version in composer.json, right? So in this case the migration should work. Please try not to echo out stuff during updates.

    First of all: For me it seems your tables are not being migrated? I did not do that for a long time and I am on mobile at the moment, but, shouldn't there be something like $util->migrate() somewhere?


  • Hey,

    yes actually i'm on version 1.0.0and want to update to 1.0.1.

    I also updated composer.json to version 1.0.1, and removed the echo stuff.

    I did not added $util->migrate() somewhere but now i have. Unfortunally it still would'nt mutatse my table... it seems that it would'nt run in the update-section of my scripts.php. For this reason it tried to echo out some stuff for debugging.

  • I think i found the issue... My mistake was, that i first installed the update, and $util->migrate() was not included.

    For the next try i just modified the composer.json on my server, so that i can install the update again...

    The problem is, that the number of the currently installed version seems to be stored on some other place additionaly. During the update, pagekit will use this other place to detect what version is installed. In my case that was still 1.0.1 although i changed it in composer.json. 

    I fixed it by installing version 1.0.0. When i update from that, the update-section will be called.

    So this is resolved for me now :-)

  • The installed version of the extension is also stored in one of the system tables (I have no db to check which one now). This is used to check whether the upgrade script shall be executed. So, you can modify this value or simply do what you did (install the old version). However, installing the old version will fail as soon as the migration was done, as the database will not be adjusted. Then, you need to uninstall and install again.