Error when deploying using Laravel Forge, DigitalOcean, and Github. Column does not exists
Hello,
I try to deploy to my server using Laravel Forge, DigItalOcean, and Github. When I deploy, it fails with the following message:
Fri May 26 20:32:29 UTC 2023
INFO Application is already down.
From github.com:hjm-app/hjm
* branch main -> FETCH_HEAD
Already up to date.
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
barryvdh/laravel-dompdf ............................................... DONE
intervention/image .................................................... DONE
laravel/sail .......................................................... DONE
laravel/sanctum ....................................................... DONE
laravel/tinker ........................................................ DONE
laravel/ui ............................................................ DONE
laravelcollective/html ................................................ DONE
nesbot/carbon ......................................................... DONE
nunomaduro/collision .................................................. DONE
nunomaduro/termwind ................................................... DONE
spatie/laravel-ignition ............................................... DONE
spatie/laravel-permission ............................................. DONE
yajra/laravel-datatables-buttons ...................................... DONE
yajra/laravel-datatables-editor ....................................... DONE
yajra/laravel-datatables-fractal ...................................... DONE
yajra/laravel-datatables-html ......................................... DONE
yajra/laravel-datatables-oracle ....................................... DONE
92 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Restarting FPM...
INFO Running migrations.
2022_11_21_092105_alter_table_users .............................. 35ms FAIL
Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist
There is no column with name "user_id" on table "users".
at vendor/doctrine/dbal/src/Schema/Exception/ColumnDoesNotExist.php:16
12▕ final class ColumnDoesNotExist extends SchemaException
13▕ {
14▕ public static function new(string $columnName, string $table): self
15▕ {
➜ 16▕ return new self(
17▕ sprintf('There is no column with name "%s" on table "%s".', $columnName, $table),
18▕ self::COLUMN_DOESNT_EXIST,
19▕ );
20▕ }
+11 vendor frames
12 database/migrations/2022_11_21_092105_alter_table_users.php:18
Illuminate\Support\Facades\Facade::__callStatic()
+25 vendor frames
38 artisan:35
Illuminate\Foundation\Console\Kernel::handle()
I have checked that the database contains a table users with a column user_id. What do I do wrong? The migration just makes a rename of all the columns in the users' table.
The error message suggests that there is no column named "user_id" in the "users" table. The migration file "2022_11_21_092105_alter_table_users.php" is trying to rename all the columns in the "users" table, but it seems that the "user_id" column does not exist.
To fix this issue, you can try the following steps:
Check the migration file "2022_11_21_092105_alter_table_users.php" and make sure that the "user_id" column is defined in the "up" method.
Check the database schema and make sure that the "users" table has a column named "user_id".
If the "user_id" column is missing, you can create it using a new migration file. For example, you can create a new migration file using the following command: