Add migration to create default site and test user

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-19 23:22:39 +00:00
parent c8d87f47b7
commit d341d7a2e2
2 changed files with 70 additions and 0 deletions

View File

@@ -306,6 +306,11 @@
"created_at": "2025-11-19T05:40:00+00:00",
"created_by": "root",
"command": "php artisan make:migration:safe rename_system_tables_to_underscore_prefix"
},
"2025_11_19_231708_create_test_user_record.php": {
"created_at": "2025-11-19T23:17:08+00:00",
"created_by": "root",
"command": "php artisan make:migration:safe create_test_user_record"
}
}
}

View File

@@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*
* Creates a default site and user record for the test user.
*
* Assumptions:
* - Running in fresh/reset database
* - login_users table has record with id=1 (created by prior migration)
* - sites table is empty
* - users table is empty
*
* @return void
*/
public function up()
{
// Create default site
DB::statement("
INSERT INTO sites (
id,
slug,
name,
is_enabled,
created_at,
updated_at
) VALUES (
1,
'test',
'Test Site',
1,
NOW(3),
NOW(3)
)
");
// Create user record for test user and associate with site
DB::statement("
INSERT INTO users (
id,
login_user_id,
site_id,
email,
first_name,
last_name,
created_at,
updated_at
) VALUES (
1,
1,
1,
'test@example.com',
'Test',
'User',
NOW(3),
NOW(3)
)
");
}
};