Hi,
I am trying to build some tests and use an in_memory sqlite database. As I run my first test I get the following error on my last table
SQLSTATE[HY000]: General error: 1 near "SET": syntax error (SQL: SET SESSION sql_require_primary_key=0)
.
.
.
8 database/migrations/2022_09_12_153840_create_notifications_table.php:2
I've tried some workaround on my notifications table such as
Schema::create('notifications', function (Blueprint $table) {
if (env('APP_ENV' == 'production')) {
$table->uuid('id')->primary();
} else {
$table->id();
}
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
But I still fail to run my tests.
My testing setup is:
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite_testing"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
//database connection configuration
'sqlite_testing' => [
'driver' => 'sqlite',
'database' => ':memory:'
],
I am not sure what is going on. I looked on the web and tried different techniques but it still fails.
Thank you!