Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix migration process #10205

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Domain/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ protected function init() {
$this->register_dependencies();
$this->register_payment_methods();

if ( is_admin() ) {
if ( $this->package->get_version() !== $this->package->get_version_stored_on_db() ) {
$this->migration->run_migrations();
$this->package->set_version_stored_on_db();
}
// This is just a temporary solution to make sure the migrations are run. We have to refactor this. More details: https://github.com/woocommerce/woocommerce-blocks/issues/10196.
if ( $this->package->get_version() !== $this->package->get_version_stored_on_db() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noting here that on every page get_version_stored_on_db() will run get_option(). There was conversations around performance but given that this is a temporary fix, and that get_option() has caching this was a trade off we were willing to temporarily take.

$this->migration->run_migrations();
$this->package->set_version_stored_on_db();
}

add_action(
Expand Down