Added user and organization deletion system; Added coverage annotations

This commit is contained in:
Constantin Graf
2024-06-07 19:17:40 +02:00
committed by Constantin Graf
parent 8857befc6c
commit 86f5ea47bb
65 changed files with 2651 additions and 135 deletions

View File

@@ -20,14 +20,14 @@ return new class extends Migration
$table->foreign('project_id')
->references('id')
->on('projects')
->onDelete('restrict')
->onUpdate('cascade');
->restrictOnDelete()
->cascadeOnUpdate();
$table->uuid('user_id');
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('restrict')
->onUpdate('cascade');
->restrictOnDelete()
->cascadeOnUpdate();
$table->timestamps();
$table->unique(['project_id', 'user_id']);
});

View File

@@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
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::table('time_entries', function (Blueprint $table) {
$table->dropForeign(['member_id']);
$table->foreign('member_id')
->references('id')
->on('members')
->restrictOnDelete()
->cascadeOnUpdate();
$table->dropForeign(['client_id']);
$table->foreign('client_id')
->references('id')
->on('clients')
->restrictOnDelete()
->cascadeOnUpdate();
});
Schema::table('project_members', function (Blueprint $table) {
$table->dropForeign(['member_id']);
$table->foreign('member_id')
->references('id')
->on('members')
->restrictOnDelete()
->cascadeOnUpdate();
});
Schema::table('organization_invitations', function (Blueprint $table) {
$table->dropForeign(['organization_id']);
$table->foreign('organization_id')
->references('id')
->on('organizations')
->restrictOnDelete()
->cascadeOnUpdate();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('time_entries', function (Blueprint $table) {
$table->dropForeign(['member_id']);
$table->foreign('member_id')
->references('id')
->on('members')
->cascadeOnDelete()
->cascadeOnUpdate();
$table->dropForeign(['client_id']);
$table->foreign('client_id')
->references('id')
->on('clients')
->cascadeOnDelete()
->cascadeOnUpdate();
});
Schema::table('project_members', function (Blueprint $table) {
$table->dropForeign(['member_id']);
$table->foreign('member_id')
->references('id')
->on('members')
->cascadeOnDelete()
->cascadeOnUpdate();
});
Schema::table('organization_invitations', function (Blueprint $table) {
$table->dropForeign(['organization_id']);
$table->foreign('organization_id')
->references('id')
->on('organizations')
->cascadeOnDelete()
->cascadeOnUpdate();
});
}
};