Not sure this is the good way to go, but the yiic tool already generates automatically rules based on db definition. I think this approach is clearer and more efficient.
I think mh has a good point here. One of the framework goals should be: Do not repeat yourself. If you have to change the length of a text field (i.e. varchar(255) to varchar(50)) then you currently have to change that in 3 places: in the database, in the rules of the model and in the view. It should be enough to change it in the database. If NOT NULL is set for a field in the DB it should automatically be considered as "required". The rules method can then be used to override the standard rules derived from the database.
The model already has all the the necessary information in the CMysqlColumnSchema objects. The CHtml methods could also use that information to automatically limit a text field.
I don't like this idea. This might cause rules to be put into place that I do not expect.
For instance, I may have an attribute that has a max length of 100 in the database, but should have a larger max of 200 in the application. The reason for this might be if for instance the field is parsed in some way (that shrinks the size) before being saved.
Currently you have the same problem when you use scaffolding, the database would say length 100 and the model rule as well. Then you would change that model rule to length 200. With the new approach there would initially be no model rule, but you would add that rule stating length 200. Its just less code for the standard cases.