Skip to content

Commit

Permalink
Use table constants
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Dec 4, 2024
1 parent 6eb58c4 commit 251b19a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace craft\commerce\migrations;

use craft\commerce\db\Table;
use craft\db\Migration;
use craft\db\Query;
use craft\helpers\App;
Expand All @@ -18,7 +19,7 @@ public function safeUp(): bool
{
// Get all the stores current data
$stores = (new Query())
->from('{{%commerce_stores}}')
->from(Table::STORES)
->all();

// Get the store settings for each store from the project config
Expand All @@ -42,7 +43,7 @@ public function safeUp(): bool

// Update stores env var DB columns
foreach ($storeProperties as $storeProperty) {
$this->alterColumn('{{%commerce_stores}}', $storeProperty, $this->string()->notNull()->defaultValue('false'));
$this->alterColumn(Table::STORES, $storeProperty, $this->string()->notNull()->defaultValue('false'));
}

// Loop through each store and update values in the DB to match the PC values
Expand Down Expand Up @@ -80,7 +81,7 @@ public function safeUp(): bool
continue;
}

$this->update('{{%commerce_stores}}', $updateData, ['id' => $store['id']]);
$this->update(Table::STORES, $updateData, ['id' => $store['id']]);
}

return true;
Expand Down

0 comments on commit 251b19a

Please sign in to comment.