Answer the question
In order to leave comments, you need to log in
Is it possible to transfer the database function during migration?
Hello.
PostgreSQL. Is it possible to somehow pass the database function as a default value in a field, for example, in "id"
Schema::create('users', function (Blueprint $table) {
<b> $table->BigIncrements('id')->default("bounded_pseudo_encrypt(nextval('users_id_seq'::regclass)::integer)");</b>
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
Answer the question
In order to leave comments, you need to log in
That won't work.
You have options either using model events (creating) and writing all the logic in php, or implement it in a trigger in PostgreSQL that will fire when a new record is created.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question