Refined database warning message to reflect specific versions

refs https://github.com/TryGhost/Toolbox/issues/175
refs c4083967df

- the referenced commit added a warning message to the What's New page
  to notify the user that we're going to be requiring MySQL 8 in
  production as of v5
- this would also show if the user was already using MySQL 8, which
  isn't ideal
- I've added a library to Ghost which will return the specific version
  of MySQL used, so we can now detect that
- eb68e8d339 has updated the config endpoint to return `mysql5`, `mysql8` etc,
  so we can now change the logic here to reflect that
- this commit also adds another warning if we're in development mode and
  using mysql5, as this will not be supported as of v5
This commit is contained in:
Daniel Lockyer 2022-01-17 17:50:19 +00:00
parent f47fee86e2
commit 4994e27838
2 changed files with 12 additions and 5 deletions

View File

@ -13,12 +13,19 @@ export default class WhatsNewController extends Controller {
return date.getFullYear(); return date.getFullYear();
} }
get showDatabaseWarning() { get databaseWarning() {
const isProduction = !!this.config.get('environment').match?.(/production/i); const isProduction = !!this.config.get('environment').match?.(/production/i);
const isPro = !!this.config.get('hostSettings')?.siteId; const isPro = !!this.config.get('hostSettings')?.siteId;
const database = this.config.get('database');
if (isProduction && !isPro) { // Show a warning if we're in production and not using MySQL 8
return true; if (isProduction && !isPro && database !== 'mysql8') {
return 'MySQL 8 will be the required database in the next major release of Ghost.';
}
// Show a warning if we're in development and using MySQL 5
if (!isProduction && !isPro && database === 'mysql5') {
return 'MySQL 5 will no longer be supported in the next major release of Ghost.';
} }
return false; return false;

View File

@ -59,10 +59,10 @@
{{/if}} {{/if}}
</ul> </ul>
{{#if this.showDatabaseWarning}} {{#if this.databaseWarning}}
<section class="gh-upgrade-notification"> <section class="gh-upgrade-notification">
<p> <p>
<strong>Warning:</strong> MySQL 8 will be the required database in the next major release of Ghost. Make sure your database is up to date to ensure forwards compatibility. <strong>Warning:</strong> {{this.databaseWarning}} Make sure your database is up to date to ensure forwards compatibility.
</p> </p>
</section> </section>
{{/if}} {{/if}}