Best method fulfill column after Migration?

Hi all!

i have one question about some problem that now I have in my website.
In the website the moderators has a control of some trainings, and for calculate the state of one user,
it is calculated depending the value of some tables and fields in DB. That was ok for few users per moderator,
but now we have some dozens and the performances is not so good.

We want to save in the DB the state of the users, instead calculate that for each one.
For achieving that we need to add a new column in one table in our DB. For that we can program a migration.
And create some field like “user_state” in the table. But this value will be empty.
But then, how can we fulfill the value of this column “user_state”? How can we automate the process of fulfilling this value?
What is the best way to do that in a Yii2 project?

I am thinking about create a script with the console, but I want to know your opinion.

Thank you