First Commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cookie_consents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('session_id')->nullable()->index();
|
||||
$table->string('ip_address')->nullable();
|
||||
$table->string('user_agent')->nullable();
|
||||
$table->json('consents')->nullable();
|
||||
$table->timestamp('accepted_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
});
|
||||
|
||||
Schema::create('legal_documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('type')->unique();
|
||||
$table->string('title');
|
||||
$table->text('content');
|
||||
$table->string('version');
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->foreignId('published_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['type', 'version']);
|
||||
});
|
||||
|
||||
Schema::create('user_document_acceptances', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('legal_document_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('document_version');
|
||||
$table->string('ip_address')->nullable();
|
||||
$table->string('user_agent')->nullable();
|
||||
$table->timestamp('accepted_at');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'legal_document_id']);
|
||||
$table->index(['user_id', 'accepted_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_document_acceptances');
|
||||
Schema::dropIfExists('legal_documents');
|
||||
Schema::dropIfExists('cookie_consents');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user