Skip to content

Commit b7d44e0

Browse files
committed
fix: resolve self-referencing FK constraint error in abac_chains migration
1 parent cfebfec commit b7d44e0

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zennit/abac",
33
"description": "Attribute-Based Access Control (ABAC) for Laravel",
4-
"version": "2.0.2",
4+
"version": "2.0.3",
55
"type": "library",
66
"license": "MIT",
77
"keywords": [

database/migrations/create_abac_tables.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ public function up(): void
4141
$table->uuid('_id')->primary();
4242
$table->timestamps();
4343
$table->enum('operator', LogicalOperators::values());
44-
$table->foreignUuid('_chain')->nullable()->constrained('abac_chains', '_id')->cascadeOnDelete();
44+
$table->uuid('_chain')->nullable();
4545
$table->foreignUuid('_policy')->unique()->nullable()->constrained('abac_policies', '_id')->cascadeOnDelete();
4646
});
4747

48+
Schema::table('abac_chains', function (Blueprint $table) {
49+
$table->foreign('_chain')->references('_id')->on('abac_chains')->cascadeOnDelete();
50+
});
51+
4852
Schema::create('abac_checks', function (Blueprint $table) {
4953
$table->uuid('_id')->primary();
5054
$table->timestamps();

0 commit comments

Comments
 (0)