You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI4: Migrate migrations from CI3 to CI4 versions #3647
In CI3 the migrations table (ospos_migrations) was simple with a single column (version) and a single row which contained the last run migration. In CI4 the migrations table is more complex so we need a means of migrating the table, if one exists, from the CI3 version to CI4 without re-running migrations which have already run.
There are four scenarios that will be encountered on the OSPOS 3.4.0 install/upgrade
A clean install with no migrations table in the initial schema.
An existing install with OSPOS version 3.0.2 - 3.3.8 with a CI3 style migration table.
An existing install with OSPOS version 3.0.2 with no migration table.
An existing install with a pre-3.0.2 OSPOS version.
We only need to account for scenarios 1-3. In scenario 4 users will need to manually run scripts found in \app\Database\Migrations\sqlscripts\pre-3.0.2\ manually in order. The result will be that their database that is identical to scenario 3.
We need a migration table checker that checks to see if the CI3 migration table exists and if so, what version it's at. The function should return FALSE if the CI3 specific table doesn't exist (even if the CI4 table exists) or return the version number if it does exist.
If the CI3 migration table exists, we need to run a function that will convert it to CI4 and place the proper rows so that no migrations are re-run.
In the Login controller we need to modify its migrations version checker. It needs to probably call the CI3 table checker, call the CI3 migrations to CI4 migrations converter passing the version number received from the checker and then we need to update the version comparitor function that checks to see if there's an update. The current function works for CI3 but since there is more than one row in CI4, the current version always thinks there is a migration to be run. Instead it needs to ORDER BY version DESC and LIMIT 1 so that it shows the actual latest version run in the app.
Activity
objecttothis commentedon Feb 5, 2023
Done