cp6 / my-idlers

Web app for displaying, organizing and storing information about servers (VPS), shared hosting, reseller hosting, domains and more.
https://demo.myidlers.com
MIT License
213 stars 30 forks source link

On install from git, getting Can't DROP FOREIGN KEY `ds_fk_yabs` #107

Closed AhmadShamli closed 1 month ago

AhmadShamli commented 1 month ago

Following install instruction using git clone, got stuck at php artisan migrate:fresh --seed. Error as below:

php artisan migrate:fresh --seed

Dropping all tables .............................................................................................. 7ms DONE

INFO Preparing database.

Creating migration table ......................................................................................... 7ms DONE

INFO Running migrations.

2014_10_12_000000_create_users_table ............................................................................. 8ms DONE 2014_10_12_100000_create_password_resets_table ................................................................... 4ms DONE 2021_02_10_122904_create_servers_table ........................................................................... 3ms DONE 2022_01_30_112059_create_providers_table ......................................................................... 5ms DONE 2022_01_30_112350_create_locations_table ......................................................................... 4ms DONE 2022_02_01_031629_create_os_table ................................................................................ 5ms DONE 2022_02_01_233932_create_domains_table ........................................................................... 3ms DONE 2022_02_02_005352_create_d_n_s_table ............................................................................. 3ms DONE 2022_02_03_035702_create_labels_table ............................................................................ 4ms DONE 2022_02_03_040140_create_shareds_table ........................................................................... 3ms DONE 2022_02_03_040152_create_resellers_table ......................................................................... 3ms DONE 2022_02_05_104355_create_yabs_table .............................................................................. 5ms DONE 2022_02_05_104551_create_disk_speed_table ........................................................................ 1ms DONE 2022_02_05_104919_create_network_speed_table ..................................................................... 6ms DONE 2022_02_05_105219_create_pricing_table ........................................................................... 4ms DONE 2022_02_08_010323_create_labels_assigned_table ................................................................... 8ms DONE 2022_02_09_032438_create_settings_table .......................................................................... 3ms DONE 2022_02_11_022150_create_miscs_table ............................................................................. 3ms DONE 2022_02_21_001233_create_ips_table ............................................................................... 7ms DONE 2022_03_05_125635_add_cols_to_settings ........................................................................... 4ms DONE 2022_03_09_022939_add_homepage_amount_cols_to_settings ........................................................... 4ms DONE 2022_05_09_114227_add_foreign_keys .............................................................................. 26ms DONE 2022_05_09_154509_add_dark_mode_setting .......................................................................... 2ms DONE 2022_05_15_105254_create_seedboxes_table ......................................................................... 4ms DONE 2022_05_29_105255_add_dash_currency_setting ...................................................................... 5ms DONE 2022_06_24_010658_alter_yabs_foreign_key ......................................................................... 1ms FAIL

Illuminate\Database\QueryException

SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY ds_fk_yabs; check that it exists (Connection: mysql, SQL: alter table disk_speed drop foreign key ds_fk_yabs)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829 825▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 826▕ ); 827▕ } 828▕ ➜ 829▕ throw new QueryException( 830▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 831▕ ); 832▕ } 833▕ }

  +9 vendor frames 

10 database/migrations/2022_06_24_010658_alter_yabs_foreign_key.php:18 Illuminate\Support\Facades\Facade::__callStatic() +35 vendor frames

46 artisan:37 Illuminate\Foundation\Console\Kernel::handle()

AhmadShamli commented 1 month ago

I have to comment below two lines as the fk is not exist,

2022_06_24_010658_alter_yabs_foreign_key.php

    Schema::table('disk_speed', function (Blueprint $table) {
        if (env('DB_CONNECTION') !== 'sqlite') {
            //$table->dropForeign('ds_fk_yabs');
        }

        $table->foreign('id', 'ds_fk_yabs')->references('id')->on('yabs')->onDelete('cascade');
    });

    Schema::table('network_speed', function (Blueprint $table) {
        if (env('DB_CONNECTION') !== 'sqlite') {
            //$table->dropForeign('ns_fk_yabs');
        }

        $table->foreign('id', 'ns_fk_yabs')->references('id')->on('yabs')->onDelete('cascade');
    });