ctyler
6 months ago

MSSQL Getting Segmentation fault With Foreign Key

Posted 6 months ago by ctyler

Having trouble with Foreign key constraints with MSSQL Here is my setup: Laravel 7, PHP 7.3, Laravel on Centos 7, MSSQL 14 on Windows Server, FreeTDS version 1.12 2007-12-25 06:02:36

Everything is working great except the migration:

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('guid')->unique()->nullable();
            $table->string('domain')->nullable();
            $table->string('firstName');
            $table->string('lastName');
            $table->string('displayName');
            $table->string('password');
            $table->unsignedBigInteger('title_id')->nullable();
            $table->string('username')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();

            $table->foreign('title_id')->references('id')->on('titles');
        });
    }

The foreign key constraint seems to be causing the issue. If I run the migration I get:

[[email protected] dev-cls-admin-com]$ php artisan migrate:fresh
Dropped all tables successfully.
Migration table created successfully.
Migrating: 2013_03_19_190016_create_cache_table
Migrated:  2013_03_19_190016_create_cache_table (0.01 seconds)
Migrating: 2014_10_12_000000_create_users_table
Segmentation fault

If I comment the constraint the migrate works with out issue. Also, you can see the migration stops at the users_table migration. I am not sure how to fix this. Does anyone have any ideas? All queries work without issue so for.

Please sign in or create an account to participate in this conversation.