Forcing AR metadata to be refreshed

I’m using ActiveRecord in my yii-migrations library.

However, I stumble accross a very annoying problem.

Let’s say we have the following scenario:

  • Migration 1 creates some new users using the Users model.

  • Migration 2 adds a column to the users table

  • Migration 3 writes something in the new column in the users table

Since this all happens in the same PHP script, the 3rd migration fails as it doesn’t know about the new column. From what I can see in the source code, the metadata is determined the first time you issue User::model() but is never updated again after this. It also seems to be cached in the CDbConnection class.

Is there any way to force the system to update the database metadata?



Could you submit a ticket for this? Thanks.