add soft delete via muffin/trash to all product related tables

This commit is contained in:
2025-04-08 01:30:40 -07:00
parent 013bec1b54
commit cf7c67763c
33 changed files with 188 additions and 11 deletions

View File

@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
use Migrations\BaseMigration;
class AddSoftDeleteToAllTables extends BaseMigration
{
/**
* 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 change(): void
{
$table = $this->table('products');
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->update();
$table = $this->table('product_category_attributes');
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->update();
$table = $this->table('product_category_attribute_options');
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->update();
$table = $this->table('product_categories');
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->update();
$table = $this->table('product_catalogs');
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->update();
$table = $this->table('external_product_catalogs_product_catalogs');
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->update();
}
}