Migrate old tax data into the nex tax data script.
Tested this manually and it works okay.
This commit is contained in:
parent
cebb684536
commit
4323114a89
1 changed files with 17 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ my $session = start(); # this line required
|
|||
# upgrade functions go here
|
||||
|
||||
insertCommerceTaxTable($session);
|
||||
migrateOldTaxTable($session);
|
||||
insertCommerceShipDriverTable($session);
|
||||
migrateToNewCart($session);
|
||||
createSkuAsset($session);
|
||||
|
|
@ -157,6 +158,22 @@ EOSQL
|
|||
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub migrateOldTaxTable {
|
||||
my $session = shift;
|
||||
print "\tMigrate old tax data into the new tax table.\n" unless ($quiet);
|
||||
# and here's our code
|
||||
my $oldTax = $session->db->prepare('select * from commerceSalesTax');
|
||||
my $newTax = $session->db->prepare('insert into tax (taxId, field, value, taxRate) VALUES (?,?,?,?)');
|
||||
$oldTax->execute();
|
||||
while (my $oldTaxData = $oldTax->hashRef()) {
|
||||
$newTax->execute([$oldTaxData->{commerceSalesTaxId}, 'state', $oldTaxData->{regionIdentifier}, $oldTaxData->{salesTax}]);
|
||||
}
|
||||
$oldTax->finish;
|
||||
$newTax->finish;
|
||||
$session->db->write('drop table commerceSalesTax');
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub insertCommerceShipDriverTable {
|
||||
my $session = shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue