From bccabb47a4c9aad15f0c9a4286d2bcbd77773d6b Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Mon, 5 Feb 2024 20:08:32 +0100 Subject: [PATCH] feat(technical): add session, cache, jobs and notifications tables (#22) --- ...024_02_03_110529_create_sessions_table.php | 31 ++++++++++++++++ .../2024_02_03_110544_create_cache_table.php | 35 +++++++++++++++++++ ..._02_03_110611_create_job_batches_table.php | 35 +++++++++++++++++++ ...2_03_110625_create_notifications_table.php | 31 ++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 database/migrations/2024_02_03_110529_create_sessions_table.php create mode 100644 database/migrations/2024_02_03_110544_create_cache_table.php create mode 100644 database/migrations/2024_02_03_110611_create_job_batches_table.php create mode 100644 database/migrations/2024_02_03_110625_create_notifications_table.php diff --git a/database/migrations/2024_02_03_110529_create_sessions_table.php b/database/migrations/2024_02_03_110529_create_sessions_table.php new file mode 100644 index 0000000..f60625b --- /dev/null +++ b/database/migrations/2024_02_03_110529_create_sessions_table.php @@ -0,0 +1,31 @@ +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('sessions'); + } +}; diff --git a/database/migrations/2024_02_03_110544_create_cache_table.php b/database/migrations/2024_02_03_110544_create_cache_table.php new file mode 100644 index 0000000..b9c106b --- /dev/null +++ b/database/migrations/2024_02_03_110544_create_cache_table.php @@ -0,0 +1,35 @@ +string('key')->primary(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + + Schema::create('cache_locks', function (Blueprint $table) { + $table->string('key')->primary(); + $table->string('owner'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('cache'); + Schema::dropIfExists('cache_locks'); + } +}; diff --git a/database/migrations/2024_02_03_110611_create_job_batches_table.php b/database/migrations/2024_02_03_110611_create_job_batches_table.php new file mode 100644 index 0000000..50e38c2 --- /dev/null +++ b/database/migrations/2024_02_03_110611_create_job_batches_table.php @@ -0,0 +1,35 @@ +string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('job_batches'); + } +}; diff --git a/database/migrations/2024_02_03_110625_create_notifications_table.php b/database/migrations/2024_02_03_110625_create_notifications_table.php new file mode 100644 index 0000000..d738032 --- /dev/null +++ b/database/migrations/2024_02_03_110625_create_notifications_table.php @@ -0,0 +1,31 @@ +uuid('id')->primary(); + $table->string('type'); + $table->morphs('notifiable'); + $table->text('data'); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('notifications'); + } +};