Skip to content

Commit f760dde

Browse files
committed
fix migration and seed
1 parent c185c7b commit f760dde

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

database/migrations/2025_11_10_001656_create_properties_table.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
*/
1212
public function up(): void
1313
{
14-
Schema::create('properties', function (Blueprint $table) {
15-
$table->id();
16-
$table->timestamps();
17-
});
1814
Schema::create('properties', function (Blueprint $table) {
1915
$table->id();
2016
$table->string('organisation');
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use Illuminate\Database\Seeder;
6+
use Illuminate\Support\Facades\DB;
7+
use Illuminate\Support\Facades\File;
8+
9+
class DataDumpSeeder extends Seeder
10+
{
11+
public function run(): void
12+
{
13+
$sqlPath = database_path('seeders/rawsql/datadump.sql');
14+
15+
// Safety: disable FKs while bulk loading
16+
DB::statement('SET FOREIGN_KEY_CHECKS=0');
17+
DB::unprepared(File::get($sqlPath)); // inserts properties, certificates, notes from your dump
18+
DB::statement('SET FOREIGN_KEY_CHECKS=1');
19+
}
20+
}
21+

database/seeders/DatabaseSeeder.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ public function run(): void
1515
{
1616
// User::factory(10)->create();
1717

18-
User::factory()->create([
19-
'name' => 'Test User',
20-
'email' => '[email protected]',
21-
]);
18+
// User::factory()->create([
19+
// 'name' => 'Test User',
20+
// 'email' => '[email protected]',
21+
// ]);
22+
23+
$this->call(DataDumpSeeder::class);
2224
}
2325
}

0 commit comments

Comments
 (0)