set('database.connections.legacy', [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', 'foreign_key_constraints' => false, ]); DB::purge('legacy'); $schema = Schema::connection('legacy'); $schema->dropIfExists('institution'); $schema->create('institution', function (Blueprint $table) { $table->unsignedBigInteger('id')->primary(); $table->unsignedBigInteger('category'); $table->string('name', 255); $table->string('abbreviation', 5); $table->string('address', 255); $table->decimal('lat', 10, 6); $table->decimal('lon', 10, 6); $table->string('url', 2000)->nullable(); $table->string('logo', 255); $table->string('uuid', 36); $table->string('color', 50)->nullable(); $table->string('city', 100); $table->boolean('is_storage_place'); }); } /** * Inserisce una riga `institution` legacy e ne restituisce l'id. * * @param array $overrides */ protected function insertLegacyInstitution(array $overrides = []): int { $row = array_merge([ 'id' => fake()->unique()->numberBetween(1, 1_000_000), 'category' => 3, 'name' => 'Some Museum', 'abbreviation' => 'SM', 'address' => 'Main Street 1', 'lat' => 55.704660, 'lon' => 13.191007, 'url' => 'https://example.org/', 'logo' => 'default.jpg', 'uuid' => (string) Str::uuid(), 'color' => '#abcdef', 'city' => 'Lund', 'is_storage_place' => 1, ], $overrides); DB::connection('legacy')->table('institution')->insert($row); return (int) $row['id']; } }