Version ie <v5.10.30>
5.11.6
Environment <Docker/Shared Hosting/Zip/Other>
Shared Hosting
Checklist
Have you inspected the logs in storage/logs/laravel.log for any errors?
Laravel log is giving
[previous exception] [object] (PDOException(code: 42S21): SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘expense_mailbox_active’ at /home/servitwebbe/domains/servitweb.be/facturatie.servitweb.be/vendor/laravel/framework/src/Illuminate/Database/Connection.php:571)
[stacktrace]
Describe the bug
Steps To Reproduce
Expected Behavior
Additional context
Screenshots
Logs
hillel
December 30, 2024, 3:30pm
2
Hi,
I believe a database migration is failing. You can run php artisan migrate
to manually migrate, it will still fail but will show you which files need to be modified. You’ll need to comment out parts of the files which have already run.
hillel:
php artisan migrate
Hi,
And where do i Do this ? As a cron job?
hillel
December 30, 2024, 3:44pm
4
You can run the command from the command line in the root folder of the project
hillel
December 30, 2024, 3:45pm
5
I believe this is the relevant file:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('companies', function (Blueprint $table) {
$table->boolean("expense_mailbox_active")->default(false);
$table->string("expense_mailbox")->nullable();
$table->boolean("inbound_mailbox_allow_company_users")->default(false);
$table->boolean("inbound_mailbox_allow_vendors")->default(false);
$table->boolean("inbound_mailbox_allow_clients")->default(false);
$table->boolean("inbound_mailbox_allow_unknown")->default(false);
$table->text("inbound_mailbox_whitelist")->nullable();
$table->text("inbound_mailbox_blacklist")->nullable();
});
}
hillel:
php artisan migrate
INFO Running migrations.
2023_12_10_110951_inbound_mail_parsing … 10.28ms FAIL
In Connection.php line 825:
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘expense
_mailbox_active’ (Connection: mysql, SQL: alter table companies
add expe nse_mailbox_active
tinyint(1) not null default ‘0’)
In Connection.php line 571:
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘expense
_mailbox_active’
This is the result.
hillel
December 30, 2024, 4:13pm
7
You’ll need to comment out the parts of the migration file that have already been run