vendredi 19 mai 2023

what are the ways that i can use in laravel 10 to change the engine in my sql by creating a new migration?

i want to change the mysql innoDB engine to MyISAM using laravel migration i created the migration that is names alter_products_engine that is suppose to change the table products but that is not happining

i made the table migration like below and i am expected the change happens but it dose not

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('products');
    }
};

and also the alter table migration

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('products',function(Blueprint $table){
            $table->engine = 'MyISAM';
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('products',function(Blueprint $table){
            $table->engine = 'MyISAM';
        });
    }
};


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire