Convert accessories over to the new Product collateral methods.

Add a method to get the JSON collateral indexed, for easy access to indeces.
Add tests for the new getIndexedCollateralData method.
In the upgrade script, put variants in all versions of the Product.  Begin
work on converting the collateral tables over to JSON.
This commit is contained in:
Colin Kuskie 2008-05-04 16:06:31 +00:00
parent 9d2b810a05
commit 4da1f8314f
3 changed files with 129 additions and 29 deletions

View file

@ -682,9 +682,29 @@ EOSQL1
weight => 0,
quantity => 0,
});
my $json = $product->get('variantsJSON');
$session->db->write('update Product set variantsJSON=? where assetId=?',[$json, $product->getId]);
}
$productQuery->finish;
##Add the collateral columns to Product
$session->db->write('alter table Product add column accessoryJSON mediumtext');
$session->db->write('alter table Product add column benefitJSON mediumtext');
$session->db->write('alter table Product add column featureJSON mediumtext');
$session->db->write('alter table Product add column relatedJSON mediumtext');
$session->db->write('alter table Product add column specificationJSON mediumtext');
##Get all Product assetIds
##For each assetId, get each type of collateral
##Convert the data to JSON and store it in Product with setCollateral (update)
##To duplicate across all revision, do a get and SQL update (with no revisionDate)
##Drop collateral tables
#$session->db->write('drop table Product_accessory');
#$session->db->write('drop table Product_benefit');
#$session->db->write('drop table Product_feature');
#$session->db->write('drop table Product_related');
#$session->db->write('drop table Product_specification');
## Remove productNumber from Product;
$session->db->write('alter table Product drop column productNumber');
## Remove price from Product since prices are now stored in variants