Clint Hill wrote:
I have no strong reason for defaulting to 255 other than the model in
question has around 20 attributes that are strings (name, agency,
policy, etc) and I didn't feel adding the ":limit => 255" to the
migration for each and every column was a good idea. I don't have to
for MySQL, SQLite etc. Moreover it felt _wrong_ to have a reasonably
normalized model to have such a high byte size per entry.
I guess my inexperience and lack of deep knowledge of Oracle is
getting in the way here.
As I've mentioned - these are implemented using varchars, so you will
not waste more bytes than you use anyway.
On Dec 12, 2008, at 7:35 AM, Ola Bini wrote:
Clint Hill wrote:
If I choose to limit the size to 255 as a default - is the proper
place to do that in the modify_types method call like so?
def modify_types(tp)
tp[:primary_key] = "NUMBER(38) NOT NULL PRIMARY KEY"
tp[:integer] = { :name => "NUMBER", :limit => 38 }
tp[:datetime] = { :name => "DATE" }
tp[:timestamp] = { :name => "DATE" }
tp[:time] = { :name => "DATE" }
tp[:date] = { :name => "DATE" }
tp[:string][:limit] = 255 <==========
tp
end
No, definitely not. The default value _should_ be 4000. If I remember
correctly, there are some tests in Rails that hinge on that for
Oracle. Or at least there used to be.
So modify your own code to take that into account - not the adapter
code.
Why do you want to limit it to 255, btw? There is no real reason
unless you have a business need to not store strings longer than 255
- and in that case that should be expressed in your application anyway.
Cheers
--
Ola Bini (http://olabini.com) JRuby Core Developer
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)
"Yields falsehood when quined" yields falsehood when quined.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
Ola Bini (http://olabini.com)
JRuby Core Developer
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)
"Yields falsehood when quined" yields falsehood when quined.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email