![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/Corals/modules/Ecommerce/update-batches/ |
<?php use \Corals\Modules\Ecommerce\Models\Product; \DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); if (\Schema::hasTable('ecommerce_products') && !\Schema::hasColumn('ecommerce_products', 'slug')) { \Schema::table('ecommerce_products', function ($table) { $table->string('slug')->index(); }); } $products = Product::all(); foreach ($products as $product) { //Generate dlug $product->save(); } \Schema::table('ecommerce_products', function ($table) { $table->string('slug')->unique()->index()->change(); }); if (\Schema::hasTable('ecommerce_sku') && !\Schema::hasColumn('ecommerce_sku', 'allowed_quantity')) { \Schema::table('ecommerce_sku', function ($table) { $table->integer('allowed_quantity')->default(0); }); }