<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>UK Ruby on Rails, Exalead, AWS, Consultancy - Unsigned integers for MySQL on Rails Comments</title>
  <id>tag:thewebfellas.com,2011:/blog/2008/6/2/unsigned-integers-for-mysql-on-rails/comments</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails/comments.xml" rel="self" type="application/atom+xml"/>
  <link href="/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
  <updated>2009-07-21T20:41:20Z</updated>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>LnddMiles</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:7781</id>
    <published>2009-07-21T17:40:13Z</published>
    <updated>2009-07-21T17:40:13Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by LnddMiles</title>
<content type="html">&lt;p&gt;The best information i have found exactly here. Keep going Thank you&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>Rob Anderton</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:3807</id>
    <published>2009-04-07T07:10:26Z</published>
    <updated>2009-04-07T07:10:26Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by Rob Anderton</title>
<content type="html">&lt;p&gt;I think it's safe to say now that this will not make it into core :(&lt;/p&gt;

&lt;p&gt;I have made a start on a plugin version of the patch myself, and want to solve the whole primary key thing too, but haven't had chance to finish it yet. Good work on your plugin: I'm glad this post helped you out!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>blythe</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:3701</id>
    <published>2009-04-02T21:23:41Z</published>
    <updated>2009-04-02T21:23:41Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by blythe</title>
<content type="html">&lt;p&gt;Hey Rob, this is great. I was also trying to find a way to use unsigned integers and this inspired me to write a little plugin that leverages the existing scale and precision fields to support integer column width and UNSIGNED, respectively.&lt;/p&gt;

&lt;p&gt;http://github.com/blythedunham/mysql_migration_optimizer/tree/master&lt;/p&gt;

&lt;p&gt;add_column :giraffe, :beer_count, :integer, :scale =&gt; 8, :precision =&gt; :unsigned
 SQL: ALTER TABLE &lt;code&gt;giraffe&lt;/code&gt; ADD &lt;code&gt;beer_count&lt;/code&gt; int(8) UNSIGNED&lt;/p&gt;

&lt;p&gt;I got the schema dumping for free by reusing those fields, however, I also had some fun times trying to rewrite it for the other features intended to let you customize table PRIMARY KEY. I ended up gsubing into the original generated schema for each table rather than rewrite the whole thing. I dunno, but you are right there is no good way.&lt;/p&gt;

&lt;p&gt;Anyhoo, this is super young and only tested on Rails 2.3 really, but maybe helpful if the patch never gets in.&lt;/p&gt;

&lt;p&gt;script/plugin git://github.com/blythedunham/mysql_migration_optimizer.git&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>Rob Anderton</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:3147</id>
    <published>2009-02-26T08:44:11Z</published>
    <updated>2009-02-26T08:44:11Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by Rob Anderton</title>
<content type="html">&lt;p&gt;Putting it in &lt;kbd&gt;~/web/lib&lt;/kbd&gt; is correct, but did you also require it from an initializer?&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Create an initializer in &lt;kbd&gt;~/web/config/initializers&lt;/kbd&gt; called &lt;kbd&gt;patches.rb&lt;/kbd&gt;&lt;/li&gt;
  &lt;li&gt;In the file put &lt;code&gt;require File.join(Rails.root, 'lib', 'active_record_ndbcluster.rb')&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Restart your webserver/Rails console&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It should then work&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>sygvin</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:3145</id>
    <published>2009-02-25T22:53:23Z</published>
    <updated>2009-02-25T22:53:23Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by sygvin</title>
<content type="html">&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;In&lt;/p&gt;

&lt;p&gt;/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.0/lib/active_record/connection_adapters/mysql_adapter.rb (class Mysql adapter)&lt;/p&gt;

&lt;p&gt;there is a call def create_table(table_name, options = {}) #:nodoc:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;super(table_name, options.reverse_merge(:options =&amp;gt; &quot;ENGINE=InnoDB&quot;))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I have a monkey patch in the name active_record_ndbcluster.rb and it has&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;module ActiveRecord 
  module ConnectionAdapters
    class MysqlAdapter
      def create_table(table_name, options = {}) #:nodoc:
        super(table_name, options.reverse_merge(:options =&gt; &quot;ENGINE=NDBCLUSTER&quot;))
      end
    end
  end
end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;now where do i place this patch.&lt;/p&gt;

&lt;p&gt;when i placed it in ~/web/lib/&lt;/p&gt;

&lt;p&gt;it doesn't work. ~/web is the ruby on rails directory.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>Rob Anderton</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:1924</id>
    <published>2008-09-30T10:05:47Z</published>
    <updated>2008-09-30T10:05:47Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by Rob Anderton</title>
<content type="html">&lt;p&gt;As my patch hasn't yet made it into Rails core and our crazy-busy schedule here has prevented me from getting around to turning this into a plugin, I've uploaded a &lt;a href=&quot;http://thewebfellas.com/assets/2008/9/30/active_record_unsigned.rb&quot; title=&quot;Download the monkey-patch&quot;&gt;monkey-patch version&lt;/a&gt; for your enjoyment. Simply drop it into your &lt;kbd&gt;lib&lt;/kbd&gt; folder, require it in an initializer and you'll be good to go.&lt;/p&gt;

&lt;p&gt;I've been using this patch for the last few months on all my new Rails projects without any problems (it still works with the latest Rails edge). In in the next few weeks I'm hoping to finally get around to offering either a more flexible Rails patch or a plugin: stay tuned for more information!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>Rob Anderton</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:970</id>
    <published>2008-06-04T22:58:50Z</published>
    <updated>2008-06-04T22:58:50Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by Rob Anderton</title>
<content type="html">&lt;p&gt;You can find the &lt;a href=&quot;http://www.ruby-forum.com/forum/16&quot; title=&quot;Read the Rails-core mailing list&quot;&gt;Rails-core&lt;/a&gt; discussion of the patch &lt;a href=&quot;http://www.ruby-forum.com/topic/155218&quot; title=&quot;Read the discussion of this patch&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://thewebfellas.com/">
    <author>
      <name>Thom Parkin</name>
    </author>
    <id>tag:thewebfellas.com,2008-06-02:957:964</id>
    <published>2008-06-02T20:08:07Z</published>
    <updated>2008-06-02T20:08:07Z</updated>
    <category term="Blog"/>
    <link href="http://thewebfellas.com/blog/2008/6/2/unsigned-integers-for-mysql-on-rails" rel="alternate" type="text/html"/>
    <title>Comment on 'Unsigned integers for MySQL on Rails' by Thom Parkin</title>
<content type="html">&lt;p&gt;An excellent contribution to the Rails community.
This is something that has also bugged me for quite a while!&lt;/p&gt;</content>  </entry>
</feed>

