From 210d83db4541c3fc66f91253988a5ef9f7385977 Mon Sep 17 00:00:00 2001
From: Frankie B <git@diskfloppy.me>
Date: Wed, 31 Jan 2024 21:17:56 +0000
Subject: Add database migrations

---
 .../2014_10_12_000000_create_users_table.php       | 32 --------------------
 ...2_100000_create_password_reset_tokens_table.php | 28 ------------------
 ...31_204730_create_bookmark__categories_table.php | 29 ++++++++++++++++++
 ...4_01_31_204742_create_bookmark__sites_table.php | 33 +++++++++++++++++++++
 ...4_01_31_204815_create_guestbook__bans_table.php | 29 ++++++++++++++++++
 ...1_31_204820_create_guestbook__entries_table.php | 33 +++++++++++++++++++++
 ..._210227_populate_bookmark__categories_table.php | 34 ++++++++++++++++++++++
 7 files changed, 158 insertions(+), 60 deletions(-)
 delete mode 100644 database/migrations/2014_10_12_000000_create_users_table.php
 delete mode 100644 database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php
 create mode 100644 database/migrations/2024_01_31_204730_create_bookmark__categories_table.php
 create mode 100644 database/migrations/2024_01_31_204742_create_bookmark__sites_table.php
 create mode 100644 database/migrations/2024_01_31_204815_create_guestbook__bans_table.php
 create mode 100644 database/migrations/2024_01_31_204820_create_guestbook__entries_table.php
 create mode 100644 database/migrations/2024_01_31_210227_populate_bookmark__categories_table.php

diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php
deleted file mode 100644
index 444fafb..0000000
--- a/database/migrations/2014_10_12_000000_create_users_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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('users', function (Blueprint $table) {
-            $table->id();
-            $table->string('name');
-            $table->string('email')->unique();
-            $table->timestamp('email_verified_at')->nullable();
-            $table->string('password');
-            $table->rememberToken();
-            $table->timestamps();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     */
-    public function down(): void
-    {
-        Schema::dropIfExists('users');
-    }
-};
diff --git a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php
deleted file mode 100644
index 81a7229..0000000
--- a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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('password_reset_tokens', function (Blueprint $table) {
-            $table->string('email')->primary();
-            $table->string('token');
-            $table->timestamp('created_at')->nullable();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     */
-    public function down(): void
-    {
-        Schema::dropIfExists('password_reset_tokens');
-    }
-};
diff --git a/database/migrations/2024_01_31_204730_create_bookmark__categories_table.php b/database/migrations/2024_01_31_204730_create_bookmark__categories_table.php
new file mode 100644
index 0000000..68bf949
--- /dev/null
+++ b/database/migrations/2024_01_31_204730_create_bookmark__categories_table.php
@@ -0,0 +1,29 @@
+<?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('bookmark__categories', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name');
+            $table->float('priority');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('bookmark__categories');
+    }
+};
diff --git a/database/migrations/2024_01_31_204742_create_bookmark__sites_table.php b/database/migrations/2024_01_31_204742_create_bookmark__sites_table.php
new file mode 100644
index 0000000..775c6bb
--- /dev/null
+++ b/database/migrations/2024_01_31_204742_create_bookmark__sites_table.php
@@ -0,0 +1,33 @@
+<?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('bookmark__sites', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name', 50);
+            $table->string('description', 150);
+            $table->string('url', 100);
+            $table->float('priority');
+            $table->integer('category_id')->unsigned();
+            $table->foreign('category_id')->references('id')->on('bookmark__categories');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('bookmark__sites');
+    }
+};
diff --git a/database/migrations/2024_01_31_204815_create_guestbook__bans_table.php b/database/migrations/2024_01_31_204815_create_guestbook__bans_table.php
new file mode 100644
index 0000000..6f0a959
--- /dev/null
+++ b/database/migrations/2024_01_31_204815_create_guestbook__bans_table.php
@@ -0,0 +1,29 @@
+<?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('guestbook__bans', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('ip_address', 40);
+            $table->string('reason', 50);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('guestbook__bans');
+    }
+};
diff --git a/database/migrations/2024_01_31_204820_create_guestbook__entries_table.php b/database/migrations/2024_01_31_204820_create_guestbook__entries_table.php
new file mode 100644
index 0000000..baaf862
--- /dev/null
+++ b/database/migrations/2024_01_31_204820_create_guestbook__entries_table.php
@@ -0,0 +1,33 @@
+<?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('guestbook__entries', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name', 255);
+            $table->bigInteger('timestamp');
+            $table->string('ip_address', 40);
+            $table->string('agent', 2048)->default('Agent unavailable');
+            $table->boolean('site_owner')->default(0);
+            $table->string('message', 512);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('guestbook__entries');
+    }
+};
diff --git a/database/migrations/2024_01_31_210227_populate_bookmark__categories_table.php b/database/migrations/2024_01_31_210227_populate_bookmark__categories_table.php
new file mode 100644
index 0000000..fb81e1f
--- /dev/null
+++ b/database/migrations/2024_01_31_210227_populate_bookmark__categories_table.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        // Check if table exists and is empty
+        if (Schema::hasTable('bookmark__categories') && DB::table('bookmark__categories')->count() == 0) {
+            // Insert placeholder categories
+            DB::table('bookmark__categories')->insert([
+                ['name' => 'Friends\' Websites', 'priority' => 1],
+                ['name' => 'Cool Projects', 'priority' => 2],
+                ['name' => 'Other Cool Sites', 'priority' => 3],
+                ['name' => 'Miscellaneous Resources', 'priority' => 4]
+            ]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};
-- 
cgit v1.2.3-54-g00ecf