Skip to content

General Error returned when running Migrations on 3.x with Sqlite #120

@dakotawashok

Description

@dakotawashok

I think this error is because the migration didn't specify that this field can be nullable. Altering the line to $table->json('payload')->nullable()->after('locked'); allows the migrations to run successfully.

$table->json('payload')->after('locked');

 2023_08_30_212242_make_incident_updates_columns_nullable ............................................................................ 42.45ms DONE
  2023_08_30_212242_make_metrics_columns_nullable ..................................................................................... 51.24ms DONE
  2023_09_18_105838_add_engine_column_to_incident_templates_table ...................................................................... 8.65ms DONE
  2024_01_22_202432_update_settings_table ............................................................................................. 18.04ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL (Connection: sqlite, SQL: alter table "settings" add column "payload" text not null)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
    821▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822▕                 );
    823▕             }
    824▕
  ➜ 825▕             throw new QueryException(
    826▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827▕             );
    828▕         }
    829▕     }

      +36 vendor frames 

  37  artisan:13
      Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

➜  status_page git:(main) ✗

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions