Skip to content

Conversation

@vedanshujain
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

Note that this PR targets cot/meta_migrations and not trunk. In case #32640 is merged earlier, target for this PR would need to be updated to trunk.

Partially closes #32663. Handles migration part of that change. DB schema will be handled as part of separate PR.

How to test the changes in this Pull Request:

  1. Make sure that you have {prefix}_wc_orders, {prefix}_wc_order_addresses, {prefix}_wc_order_operational_data and {prefix}_wc_orders_meta table created by following steps from Add DB table structure for custom order tables. #31811.
  2. Run migration using the following snippet:
namespace Automattic\WooCommerce\Database\Migrations\CustomOrderTable;
$done = false;
$migrator = new WPPostToCOTMigrator();
delete_option( 'wc_cot_migration' );
$start_time = microtime( true );
while( ! $done ) {
	$batch_start = microtime( true );
	$done = $migrator->process_next_migration_batch( 500 );
	echo 'Batch completed in ' . ( microtime( true ) - $batch_start ) . ' seconds' . "\n";
}
$duration = microtime( true ) - $start_time;
echo $duration;
  1. Make sure that migrated order records have the same ID as their corresponding posts id.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file by running pnpm nx affected --target=changelog?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 20, 2022
Copy link
Member

@barryhughes barryhughes left a comment

Choose a reason for hiding this comment

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

Left a few notes: I'd like to do a second pass, though, because I'm still feeling out how this sub-system (COT) pieces together.


Not directly related to this PR, and doesn't need to be addressed here, but noting so we can follow-up when convenient: now we have a custom table, does it make sense to disambiguate our order statuses from other post statuses via the wc-* prefix (to re-phrase, in the context of wp_wc_orders, why wc-completed and not simply completed)?

@barryhughes barryhughes merged commit e422aea into cot/meta_migrations Apr 21, 2022
@barryhughes barryhughes deleted the cot/32663 branch April 21, 2022 15:33
@github-actions
Copy link
Contributor

Hi @barryhughes, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add changelog label
  • Add the release: add testing instructions label

@vedanshujain vedanshujain restored the cot/32663 branch April 22, 2022 10:07
@kalessil kalessil deleted the cot/32663 branch September 24, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants