But even without Yii considering them, foreign-keys are a vital part of maintaining referential integrity of your database; there are many tutorials on the web on how to learn about them.
DO name your foreign key fields ending in "id"
----------------------------------------------
Related to the prior note, if a you have a field that holds the ID of a user, call the field `userid` rather than `user`. This is because for every foreign key you include in a table, you'll almost certainly wish to define a **relation** for it.
In Yii, class variables, db fields, virtual attributes, relations all share a single namespace, so it's not possible to have `$model->user` be **both** the foreign key in the table **and** the relation.
By calling the FK `userid`, the BELONGS_TO relation of `$model->user` forms naturally and easily: