Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

Delete on cascade , it is not working on go Daddy Hosting / MYSQL

Hello guys , does some one there have deployed your website on go Daddy ? I have just deployed a website , I migrated the database , it is working fine . but it is not deleting on cascade . I don´t know if I have to make some configuration . In my localhost it is deleting on cascade , but on go daddy don`t . I am using MySQL DB .

I have a gallery files , and those files must be deleted if the gallery is deleted . I migrated like this -

 public function up()
    {
 $table->integer('gallery_file_id')->unsigned();
 $table->foreign('gallery_file_id')->references('id')->on('file_gallery')->onDelete('cascade');

}

public function down()
    {
    .....
}

the code is not wrong becose it is working on localhost , I migrated in godaddy via composer , and it didn´t gave any errors . but if I delete the gallery is not deleting the gallery files , and should be deleted on cascade .

Does some one know if I have to do some configuration on go Daddy ?

I am using this version of DB -

  • Mysql Version - 14.14 ( Go Daddy ) *in my Localhost - 15.1 ( Localhost )

Thanks

0 likes
3 replies
Snapey's avatar

I never use it, but shouldn't the cascade be on the 'parent' model?

when you delete file_gallery(5) it should cascade to this table?

file_gallery, gallery_file? i'm confused...

murilo's avatar
murilo
OP
Best Answer
Level 10

I solved the problem , thanks my friends . I added this code - In config/database.php

    'mysql' => [
        'engine' => 'InnoDB',
    ]

instead

    'mysql' => [
        'engine' => '',
    ]

In database/migrations I added -

     public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
    .......
     }

Instead

     public function up()
    {
        Schema::create('users', function (Blueprint $table) {
    .....
     }

It is working now .

1 like

Please or to participate in this conversation.