Generate SQL tables from Models?

I am looking for a solution like Doctrine2 has. Because The Doctrine can create/generate SQL tables from the entities. (Ruby cans do too). But is it possible in Yii too?

For me it this is more easer then the opposite way.

(Because the Gii cannot handle well the relations between the tables)

Not that i know of. If you set your foreign keys then GII will create the relations. You can also use things like phpmyadmin (MySQL) and just click to create MySQL tables. You can just click to create indexs, FKs, etc. and then run GII.