Probably needs to be sent raw:
$table->uuid('ID')->default(DB::raw('newid()'));
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to set a function as default in migration? For example I use the code bellow: $table->uuid('ID')->default('newid()'); I am using MS SQL database and I need to autogenerate the uuid itself, but when I run the migration the default will be a string not the function and If I remove the quotation marks then I got the error at migration. The problem is that I have a lot of tables which needs the autogenerate function as default.
Please or to participate in this conversation.