product photos first commit - only upload base photo

This commit is contained in:
2025-08-10 02:35:25 -07:00
parent 82b3ca59ed
commit a1012b4054
15 changed files with 1021 additions and 1 deletions

View File

@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
use Migrations\BaseMigration;
class CreateProductPhotos 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('product_photos', ['id' => false, 'primary_key' => ['id']]);
$table->addColumn('id', 'uuid', [
'default' => null,
'null' => false,
]);
$table->addColumn('product_id', 'uuid', [
'default' => null,
'null' => false,
]);
$table->addColumn('product_sku_id', 'uuid', [
'default' => null,
'null' => true,
]);
$table->addColumn('photo_dir', 'text', [
'default' => null,
'length' => 255,
'null' => false,
]);
$table->addColumn('photo_filename', 'string', [
'default' => null,
'length' => 255,
'null' => false,
]);
$table->addColumn('primary_photo', 'boolean', [
'default' => false,
'null' => false,
]);
$table->addColumn('photo_position', 'integer', [
'default' => 100,
'limit' => 11,
'null' => false,
]);
$table->addColumn('enabled', 'boolean', [
'default' => false,
'null' => false,
]);
$table->addColumn('created', 'datetime', [
'default' => null,
'null' => false,
]);
$table->addColumn('modified', 'datetime', [
'default' => null,
'null' => true,
]);
$table->addColumn('deleted', 'datetime', [
'default' => null,
'null' => true,
]);
$table->addIndex([
'product_id',
], [
'name' => 'PRODUCT_PHOTOS_BY_PRODUCT_ID',
'unique' => false,
]);
$table->addIndex([
'product_sku_id',
], [
'name' => 'PRODUCT_PHOTOS_BY_PRODUCT_SKU_ID',
'unique' => true,
]);
$table->create();
}
}