N
Neon2y ago
fascinating-indigo

Laravel migrations are failing

Preface: Testing Vercel for Laravel deployments. Created a PostgreSQL database through Vercel UI. Deployment of Laravel app is successful, a test endpoint without any DB connection works and responds as expected. I have added php artisan migrate to composer.json's scripts section. It runs after deps are installed. The first SQL command (creating the first table) goes through, the second one fails with the following error:
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block (Connection: pgsql, SQL: alter table "users" add primary key ("id"))
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block (Connection: pgsql, SQL: alter table "users" add primary key ("id"))
Local instance runs perfectly fine. Versions between local instance and Neon's instance is almost the same version. Local version: Debian 15.5-1.pgdg120+1 Neon's version: Ubuntu 15.5-1.pgdg22.04+1 What am I missing here? Why are the transactions being aborted? I spent about half an hour googleing and reading results, yet to found relevant information.
2 Replies
fascinating-indigo
fascinating-indigoOP2y ago
Resolved by adding a flag to Laravel's migration files to not use transactions and it resolved it 🤷‍♂️
xenial-black
xenial-black15mo ago
What happen if there is migration errors? Will it rollback?

Did you find this page helpful?