diff options
author | Frankie B <git@diskfloppy.me> | 2024-01-31 21:17:56 +0000 |
---|---|---|
committer | Frankie B <git@diskfloppy.me> | 2024-01-31 21:17:56 +0000 |
commit | 36c66c75fb6fd72dfb36e4e9b9b8c332737aeb1d (patch) | |
tree | 17484ca3136e6a477e80a16e3bb8c32026aceabf /database/migrations | |
parent | 278abdbcfaacf1fc8ee0f7d4289b85aa14cc3735 (diff) |
Add database migrations
Diffstat (limited to 'database/migrations')
-rw-r--r-- | database/migrations/2024_01_31_204730_create_bookmark__categories_table.php (renamed from database/migrations/2014_10_12_000000_create_users_table.php) | 11 | ||||
-rw-r--r-- | database/migrations/2024_01_31_204742_create_bookmark__sites_table.php | 33 | ||||
-rw-r--r-- | database/migrations/2024_01_31_204815_create_guestbook__bans_table.php (renamed from database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php) | 11 | ||||
-rw-r--r-- | database/migrations/2024_01_31_204820_create_guestbook__entries_table.php | 33 | ||||
-rw-r--r-- | database/migrations/2024_01_31_210227_populate_bookmark__categories_table.php | 34 |
5 files changed, 110 insertions, 12 deletions
diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2024_01_31_204730_create_bookmark__categories_table.php index 444fafb..68bf949 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2024_01_31_204730_create_bookmark__categories_table.php @@ -11,13 +11,10 @@ return new class extends Migration */ public function up(): void { - Schema::create('users', function (Blueprint $table) { - $table->id(); + Schema::create('bookmark__categories', function (Blueprint $table) { + $table->increments('id'); $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); + $table->float('priority'); $table->timestamps(); }); } @@ -27,6 +24,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('users'); + 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/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations/2024_01_31_204815_create_guestbook__bans_table.php index 81a7229..6f0a959 100644 --- a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php +++ b/database/migrations/2024_01_31_204815_create_guestbook__bans_table.php @@ -11,10 +11,11 @@ return new class extends Migration */ public function up(): void { - Schema::create('password_reset_tokens', function (Blueprint $table) { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); + Schema::create('guestbook__bans', function (Blueprint $table) { + $table->increments('id'); + $table->string('ip_address', 40); + $table->string('reason', 50); + $table->timestamps(); }); } @@ -23,6 +24,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('password_reset_tokens'); + 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 + { + // + } +}; |