Any idea how to recreate SQL from models generated with gii?

Hi all, i lost one db (mysql) with above 100 tables. I have an old backup but after that i do alot of changes.

From that db i generated with gii alle the models in Yii2.

The question is: have you any idea if there is a way (or a tool) to obtain the sql of a table starting from a model generated with gii?

Thanks for any help or idea.

You would need to write a script to parse the model files.

Each file has a list of all the attributes and their type:




 * @property integer $id

 * @property string $ban_filename

 * @property string $ban_alt

 * @property string $ban_description

 * @property string $ban_text

 * @property integer $ban_active

 * @property integer $ban_count

 * @property string $ban_created_date



You would need to parse these lists and decide what to make each attribute by default, then manually adjust the tables. It would still take some time, but probably faster than manually creating the tables just by reading the lists.