aboutsummaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
Diffstat (limited to 'database')
-rw-r--r--database/.gitignore1
-rw-r--r--database/migrations/2025_03_06_091820_create_players_table.php40
-rw-r--r--database/seeders/DatabaseSeeder.php23
3 files changed, 64 insertions, 0 deletions
diff --git a/database/.gitignore b/database/.gitignore
new file mode 100644
index 0000000..9b19b93
--- /dev/null
+++ b/database/.gitignore
@@ -0,0 +1 @@
+*.sqlite*
diff --git a/database/migrations/2025_03_06_091820_create_players_table.php b/database/migrations/2025_03_06_091820_create_players_table.php
new file mode 100644
index 0000000..d078edf
--- /dev/null
+++ b/database/migrations/2025_03_06_091820_create_players_table.php
@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::create('players', function (Blueprint $table) {
+ $table->id();
+ $table->timestamps();
+ $table->string('name');
+ $table->string('team');
+ $table->integer('score');
+ });
+
+ Schema::create('sessions', function (Blueprint $table) {
+ $table->string('id')->primary();
+ $table->foreignId('user_id')->nullable()->index();
+ $table->string('ip_address', 45)->nullable();
+ $table->text('user_agent')->nullable();
+ $table->longText('payload');
+ $table->integer('last_activity')->index();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('players');
+ Schema::dropIfExists('sessions');
+ }
+};
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
new file mode 100644
index 0000000..d01a0ef
--- /dev/null
+++ b/database/seeders/DatabaseSeeder.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Database\Seeders;
+
+use App\Models\User;
+// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
+use Illuminate\Database\Seeder;
+
+class DatabaseSeeder extends Seeder
+{
+ /**
+ * Seed the application's database.
+ */
+ public function run(): void
+ {
+ // User::factory(10)->create();
+
+ User::factory()->create([
+ 'name' => 'Test User',
+ 'email' => 'test@example.com',
+ ]);
+ }
+}