category id not null but product id can be null same with sku id - product photos

This commit is contained in:
2025-11-01 23:39:15 -07:00
parent d239a98e8e
commit dc2f422247
5 changed files with 93 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ class AllowProductIdToBeNullInProductPhotos extends BaseMigration
* https://book.cakephp.org/migrations/4/en/migrations.html#the-change-method
* @return void
*/
public function change(): void
public function up(): void
{
$table = $this->table('product_photos');
$table->changeColumn('product_id', 'uuid', [
@@ -20,6 +20,34 @@ class AllowProductIdToBeNullInProductPhotos extends BaseMigration
'limit' => 11,
'null' => true,
]);
$table->changeColumn('product_category_id', 'uuid', [
'default' => null,
'limit' => 11,
'null' => false,
]);
$table->update();
}
/**
* Change Method.
*
* More information on this method is available here:
* https://book.cakephp.org/migrations/4/en/migrations.html#the-change-method
* @return void
*/
public function down(): void
{
$table = $this->table('product_photos');
$table->changeColumn('product_id', 'uuid', [
'default' => null,
'limit' => 11,
'null' => false,
]);
$table->changeColumn('product_category_id', 'uuid', [
'default' => null,
'limit' => 11,
'null' => true,
]);
$table->update();
}
}