Database schema inconsistent with clean install
aspark21 opened this issue · 24 comments
Run: php admin/cli/check_database_schema.php
Database schema inconsistent with clean install. Running this for a core issue in 3.9 where there were some steps missing from the db/upgrade.php compared to the install.xml (MDL-69049) we have picked up on the following inconsistencies with this plugin:
-------------------------------------------------------------------------------
plagiarism_turnitin_files
* column 'student_read' should allow NULL (I)
-------------------------------------------------------------------------------
plagiarism_turnitin_users
* column 'userid' should be NOT NULL (I)
* column 'turnitin_uid' should be NOT NULL (I)
* column 'turnitin_utp' should be NOT NULL (I)
-------------------------------------------------------------------------------
plagiarism_turnitin_courses
* column 'courseid' should be NOT NULL (I)
* column 'ownerid' should be NOT NULL (I)
* column 'turnitin_ctl' should be NOT NULL (X)
* column 'turnitin_cid' should be NOT NULL (I)
Sorry, haven't really had a chance to go through this in any detail and about to go on leave but this seems to roughly be doing what's needed - i.e. either fix install.xml or upgrade.php for fields and then have an upgrade script which cleans things up.
Would it be worth us upgrading on one of our test sites?
If so, @cybernotic can pick up while I'm away
I've just run an upgrade with develop branch of plagiarism plugin (+ PR 553 which is not relevant to this issue but is for our own pre-3.9 testing)
plagiarism_turnitin_users
- column 'userid' should be NOT NULL (I)
plagiarism_turnitin_courses
- column 'courseid' should be NOT NULL (I)
Just had a look back at https://github.com/turnitin/moodle-plagiarism_turnitin/pull/542/files#diff-fcb317575e9e6245fdf1590e51a86685b61c2cc9573a9df8034323ccb3ef614fR447 and it does seem like there was no upgrade steps for those 2 fields.
Might have been intentional as I can see it was reverted here - e009474
Yeah, I got the same @aspark21
userid and courseid columns still allow NULLs because there was no update step to alter then, just e009474 that changes existing upgrade steps which are never called twice, so this didin't work for existing sites.
I'm happy to make a new PR for to fix remaning columns @jmcgettrick
Hey @aspark21 @jmcgettrick could you please check if #585 would work for you?
I had to drop and recreate a unique index in these columns because moodle has a dependency check and throws column "plagiarism_turnitin_users->userid" cannot be modified. Dependency found with index "mdl_plagturnuser_use_uix (userid)"
I'll have a look
Hey @aspark21 @jmcgettrick
Is there a chance you could have a look at #585 ?
I've rebased my pull branch.
Cheers,
Mikhail
Please feel free to let me know if there anything I can help with this one.
The PR seems straightforward, but if there is anything you'd want to discuss please let me know.
I'm looking forward to seeing this integrated.
Kind regards,
Misha
Ah yes sorry this dropped off my radar, I'll try and look at it this week.
Hi @aspark21
Sorry for chasing you, but we have an open ticket wich I can't close untill this is fixed. Is there any chance to have a look at the issue? If there anything that needs to be changed in the PR I'm happy to do so.
Kind regards,
Misha
I've finally taken a look apologies for delay.
Starting point:
Moodle 3.9.11+ & plagiarism_turnitin 2021060801
-------------------------------------------------------------------------------
plagiarism_turnitin_users
* column 'userid' should be NOT NULL (I)
-------------------------------------------------------------------------------
plagiarism_turnitin_courses
* column 'courseid' should be NOT NULL (I)
* column 'ownerid' is not expected (I)
-------------------------------------------------------------------------------
Upgraded to latest plagiarism_turnitin origin master (2021091501)
-------------------------------------------------------------------------------
plagiarism_turnitin_users
* column 'userid' should be NOT NULL (I)
-------------------------------------------------------------------------------
plagiarism_turnitin_courses
* column 'courseid' should be NOT NULL (I)
-------------------------------------------------------------------------------
Upgraded to golenkovm/issue517_v2
No more warnings from
php admin/cli/check_database_schema.php
Unfortunately John has left Turnitin so it looks like @dominicgunn or @stvleung as the current owners of the Turnitin Github will have to review instead
Hi @dominicgunn @stvleung @dwinn
Is there a chance you could have a look at this PR? Thanks in advance. Appreciate this.
Kind regards,
Misha
Hi @dominicgunn @stvleung @dwinn
Please feel free to let me know if I can do anything to help you with this PR. Appreciate this.
Kind regards,
Misha
Please, anyone @dominicgunn @stvleung @dwinn
Hi @golenkovm ,
Thank you for reporting the issue and the pull request, we will try to get this released as soon as we can.
Thank you for reporting this. Because the latest version of the plagiarism plugin is supported for versions of Moodle 4.1 and higher, I am closing this ticket. However, if you find this issue is occurring with the latest version of the plugin in any of the supported Moodle versions, please create a new ticket and we will address it.