I’m new to the ruby-based schemas and migrations. As I’m looking over
examples and such online, I see that many of them don’t make use of
schema-enforced attributes. For example, instead of:
t.column “post_id”, :integer, :default => 0, :null => false
t.column “post_id”, :integer
So I’m wondering – is this just due to the simplicity of the examples
that don’t get hung up in details? Or, is this the general philosophy
to follow – let the model set the constraints and leave the schema to
be very simple.
I also notice that strings are not setup with :limit => xxx. Is there
any advantage to putting a limit on strings in the schema? It seems
that with MySQL, a VARCHAR(255) is just as efficient as a VARCHAR(10).