PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

Wave/Laravel Migration Hell :(

Solved
keegenk

Aug 22nd, 2023 04:00 AM

I'm in Laravel migrations hell. I ran: php artisan migrate:reset and now I'm getting: INFO Rolling back migrations

2014_10_12_000000_create_users_table ........................................................................ 4ms FAIL

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 3730 Cannot drop table 'users' referenced by a foreign key constraint 'airtable_details_user_id_foreign' on table 'airtable_details'. (SQL: drop table if exists users)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760 756// If an exception occurs when attempting to run a query, we'll format the error 757▕ // message to include the bindings with SQL, which will make this exception a 758▕ // lot more helpful to the developer instead of just the database's errors. 759▕ catch (Exception $e) { ➜ 760▕ throw new QueryException( 761▕ $query, $this->prepareBindings($bindings), $e 762▕ ); 763▕ } 764▕ }

  +12 vendor frames 
13 wave/database/migrations/2014_10_12_000000_create_users_table.php:34 Illuminate\Support\Facades\Facade::__callStatic("dropIfExists")

  +26 vendor frames 
40 artisan:35 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
bobbyiliev

Aug 22nd, 2023 04:03 AM

Best Answer

Hey!

The php artisan migrate:reset command should only be executed on your local dev environment as it essentially drops all tables and recreates your database schema.

The error that you are getting is saying that you've had other changes made to that database not done via a migration causing the problem. This is not really a bug in Wave.

To fix this, what you could do is just drop your database and recreate it. That way you will start from scratch run your migrations as usual.

Let me know how it goes!

Best,

Bobby

keegenk

Aug 26th, 2023 01:29 PM

Thanks. It is a local environment. I've dumped and am recreating. That seemed to solve my problems. Thanks!