product photos first commit - only upload base photo
This commit is contained in:
87
config/Migrations/20250810031402_CreateProductPhotos.php
Normal file
87
config/Migrations/20250810031402_CreateProductPhotos.php
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
return [
|
||||
'CakeProducts' => [
|
||||
'photos' => [
|
||||
'directory' => WWW_ROOT . 'images' . DS . 'products' . DS,
|
||||
],
|
||||
/**
|
||||
* internal CakeProducts settings - used in the source of truth/internal only system.
|
||||
* Can optionally manage external catalogs
|
||||
|
||||
Reference in New Issue
Block a user