Created
August 1, 2021 10:35
Revisions
-
jpswade created this gist
Aug 1, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <?php namespace App\Traits; use Illuminate\Database\SQLiteConnection; use Illuminate\Support\Facades\DB; trait SqliteTrait { protected static function setUpSqlite(): void { $db = DB::connection(); if ($db instanceof SQLiteConnection) { /** Fix: no such function: CONCAT */ $db->getPdo() ->sqliteCreateFunction( 'concat', function (...$input) { return implode('', $input); } ); /** Fix: Cannot add a NOT NULL column with default value NULL */ $db->getSchemaBuilder()->enableForeignKeyConstraints(); } } }