How to fill some table fields with default values from another table

Hello Guys!

I have a table that needs to populate some values ​​from another table by default. I am currently using:;

How do I get the default values ​​from another table to fill this field?

Thank you

Hi @DanielObara

You can use database triggers for it. They are little bit different based on database and version that you are using.

You can set triggers in AdonisJS migration as doing raw DB query in migration and define trigger in there.

Here is one not too good example of triggers in Postgres, but you should get the idea from here.