On Tuesday, October 22, 2013 12:56:58 PM UTC+10, Jeremy Evans wrote:
>
> On Monday, October 21, 2013 7:22:46 PM UTC-7, Douglas Teoh wrote:
>
>> I am wondering if it is possible, whether through the API or monkey 
>> patching, such that when I make a migration, eg.
>>
>> create_table :users do
>>   String :name
>> end
>>
>> That the generated column type for 'name' is 'VARCHAR(255 CHAR)' instead 
>> of 'VARCHAR(255)'. The significance of this is that the column will use 
>> character semantics instead of byte semantics, which is important when 
>> dealing with character sets such as UTF8.
>>
>
> Here's two options, you probably want the first:
>
>   self.default_string_column_size = '255 CHAR'
>   create_table :users do
>     String :name
>   end
>   # or
>   create_table :users do
>     String :name, :size=>'255 CHAR'
>   end
>
>
Thanks Jeremy, that seems to work, but I found a couple of issues.

In the generated "schema.rb" file, I end up with:

   create_table(:users) do
      column :id, "NUMBER(38)", :null=>false
      column :name, "VARCHAR2(255"

      primary_key [:id]
    end

The column type is incomplete.

The second issue is that if I go down this path, the migrations are no 
longer database agnostic. Is there a hook or extension I can write against 
the Oracle adapter to make this DB agnostic?

Thanks,

Douglas




Thanks,
> Jeremy
>




 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to