From 1fc09e20abf300b8c1acfa0d63559d2c7591f50f Mon Sep 17 00:00:00 2001 From: miladev-ent Date: Thu, 6 Apr 2023 11:34:12 +0330 Subject: [PATCH] add uuid in migration --- config/laravel-attributes.php | 2 +- migrations/2022_08_04_155610_create_attributes_table.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/laravel-attributes.php b/config/laravel-attributes.php index f4287b0..884f84b 100644 --- a/config/laravel-attributes.php +++ b/config/laravel-attributes.php @@ -15,7 +15,7 @@ /* * Use uuid as primary key. */ - 'uuids' => false, + 'uuids' => false, // Also in beta !!! ], /* diff --git a/migrations/2022_08_04_155610_create_attributes_table.php b/migrations/2022_08_04_155610_create_attributes_table.php index afefc96..f10e57f 100644 --- a/migrations/2022_08_04_155610_create_attributes_table.php +++ b/migrations/2022_08_04_155610_create_attributes_table.php @@ -16,7 +16,11 @@ public function up() $table->id(); $table->string('title'); $table->text('value'); - $table->unsignedBigInteger('attributable_id'); + if (config('laravel-attributes.tables.uuids', false)) { + $table->uuid('attributable_id'); + } else { + $table->unsignedBigInteger('attributable_id'); + } $table->string('attributable'); $table->timestamps(); });