I am trying to set up the laravel project.
When I am running the migrations the following error is received.
demongod@Abhisheks-MacBook-Air-2 factoring % php artisan migrate
Migrating: 2022_02_25_173457_add_morph_columns_in_payment_accounts_table
DoctrineDBALSchemaExceptionColumnDoesNotExist
There is no column with name "employee_id" on table "payment_accounts".
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▕ }
+9 vendor frames
10 database/migrations/2022_02_25_173457_add_morph_columns_in_payment_accounts_table.php:18
IlluminateDatabaseSchemaBuilder::table("payment_accounts", Object(Closure))
+22 vendor frames
33 artisan:35
IlluminateFoundationConsoleKernel::handle(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
I only ran php artisan migrate
and the following error came.
2
Answers
because of your account type table not migrate first migrate specific acount type table after that migrate the payment account table
OR
migrate specific one by one table
I agree with Sahil Markana, you have to migrate "payment_accounts" table first, then "2022_02_25_173457_add_morph_columns_in_payment_accounts_table".
Maybe the best solution is to rename your "payment_accounts" migration file, because migration files contain timestamps (like in this above -> 2022-02-25 17:34:57). So, you should rename "payment_accounts" migration file and set time less than this.
Hope this helps! 🙂