Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing upgrade script to account for db changes in version 2019080211 [ADS-61] #31

Merged
merged 6 commits into from
Apr 29, 2020

Conversation

nano1895pearson
Copy link
Contributor

@nano1895pearson nano1895pearson commented Apr 23, 2020

https://acclaim.atlassian.net/projects/ADS/board?issue-key=ADS-61

This PR adds a missing file upgrade.php which the moodle api docs specify needs to be added to allow for moodle to upgrade an existing plug in database from one version to another.

The code here looks a bit out of nowhere but all of it is pretty much auto generated by moodle's XMLEditorTool which you can access by launching a local moodle server and installing this plug in.

This basically adds the missing db migrations that the previous version should have had and slaps on a new version so in order for the client who is experiencing this problem to fix they can just upgrade to a new version.

I worried a while about the scenario where
A - This version
B - Previous version (problem version missing upgrade.php)
C - Previous previous version

If a user happened to upgrade from C -> B -> A that it would duplicate the db changes but that actually is something we wouldnt have to worry about because in version B upgrade.php doesnt exist.

- Update version
- Add upgrade.php to add missing table and rename existing table in previous version
- Update README to specify that the top level directory needs to be renamed into just acclaim
Copy link
Contributor

@zioth zioth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I haven't tested it, but I can base my branch off of yours, so I'll end up using it during development.

db/upgrade.php Outdated
@@ -0,0 +1,36 @@
function xmldb_qtype_myqtype_upgrade($oldversion) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this comment to the top of the file, so it will match up with the upcoming development work.

/**
 * Credly's Acclaim Moodle Block Plugin
 * Credly: http://youracclaim.com
 * Moodle: http://moodle.org/
 *
 * @package    block_acclaim
 * @copyright  2020 Credly, Inc. <http://youracclaim.com>
 * @license    https://opensource.org/licenses/MIT
 */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- Add comment to upgrade.php (PR Feedback)
- Update read me to use releases
- Rename upgrade function to reference plugin name
@nano1895pearson nano1895pearson merged commit a3faa8f into master Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants