crater icon indicating copy to clipboard operation
crater copied to clipboard

DB should be empty error, but the database migrations happened. Can't get to next step.

Open melaniecarr23 opened this issue 3 years ago • 9 comments

Describe the bug I created a blank crater db, got to the Site URL & Database step of installation and saw the database should be empty error when clicking Save & Continue. Went into MySQL Workbench, and the tables had been populated. Dropped all tables from crater db, and tried again. Got the internet connectivity issue, so restarted the installation and got the empty database error (with all the tables re-populated). Is there a way to skip this step? It's creating them, but not recognizing it.

Expected behavior I expected to drop the tables, restart the setup wizard and move to the next step. It just re-populates the tables and gives me an error about the db should be empty.

Screenshots Screen Shot 2022-01-05 at 2 20 47 PM Screen Shot 2022-01-05 at 2 20 32 PM Screen Shot 2022-01-05 at 2 43 21 PM

Please complete the following information:

  • Crater version: 5.0.6
  • PHP version: 8.0.12
  • Database type and version: mysql 8.0.17 innodb

Optional info

  • OS: Mac OS Catalina 10.15.7
  • Browser: brave (shields down), also tried safari with same cycle of errors

melaniecarr23 avatar Jan 05 '22 19:01 melaniecarr23

I tried to do a video, but it was too large. If I try to run php artisan migrate, all the tables are created in the crater db. It's like the wizard stops halfway through creating all the tables. Is there a manual way to get around this step?

melaniecarr23 avatar Jan 06 '22 01:01 melaniecarr23

Try create an empty file with the name "database_created" in the /storage/app folder of the installation.

sanch03 avatar Jan 06 '22 22:01 sanch03

That still brings me to the installation wizard, but now I get CSRF Mismatch and another error when trying to continue from the database page.

Screen Shot 2022-01-07 at 11 10 52 AM

melaniecarr23 avatar Jan 07 '22 16:01 melaniecarr23

Ok, I see it tends to just migrate 4 tables, companies, currencies, users, and migrations. Then I get an error that sql_require_primary_key must be false, yet I don't know how to set that up on a managed digital ocean cluster. Is there something we can change in the migrations to make this work even with that enabled? I'm assuming, based on the order of migration file creation, that the problem might be in the password resets (which would be next on the list, no?)

melaniecarr23 avatar Jan 08 '22 21:01 melaniecarr23

I wasn't able to resolve the issue on my local machine's testing setup but I WAS able to resolve it on my hosted machine by doing the following:

Changed the following code in crater/database/migrations/2014_10_12_100000_create_password_resets_table.php:

  • Added the line to set sql_require_primary_key to false.
  • changed $table->string('email')->index(); to $table->string('email')->primary();

public function up() { \Illuminate\Support\Facades\DB::statement('SET SESSION sql_require_primary_key=0'); Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->primary(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); }

  • from the terminal in the crater folder, ran php artisan config:cache

Once I did this, I was able to successfully get through to setting up my user and company information using the installation wizard.

melaniecarr23 avatar Jan 09 '22 01:01 melaniecarr23

Hi I did everything as described above, but it didn't work for me... Maybe there is an error in the file crater/database/migrations/2014_10_12_100000_create_password_resets_table.php?

Or what else can I try to make the installation continue ? Thanks

<?php

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

class CreatePasswordResetsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
    	\Illuminate\Support\Facades\DB::statement('SET SESSION sql_require_primary_key=0'); 
        Schema::create('password_resets', function (Blueprint $table) {
            $table->string('email')->primary();
            $table->string('token');
            $table->timestamp('created_at')->nullable();
        });
    }

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

MediaElf avatar Jan 09 '22 15:01 MediaElf

Got exactly the same issue. Can't install the application because of this.

bdeb1337 avatar Jan 16 '22 22:01 bdeb1337

same issue. it looks like it populated all the databases. but then it says error and when I try to continue it says the database should be empty. If I delete everything in the database, it does the same thing. create all the tables, then error

SecureCPU avatar Feb 06 '22 17:02 SecureCPU

Please check this video for installation steps: https://www.youtube.com/watch?v=waheY7LHBdc

starpunjabi avatar May 21 '22 01:05 starpunjabi