On Tuesday, September 18, 2012 3:09:03 PM UTC-5, rohit wrote: > > On Tuesday, September 18, 2012 10:50:08 AM UTC-5, Jeremy Evans wrote: >> >> On Monday, September 17, 2012 6:36:48 PM UTC-7, Ben Sullivan wrote: >>> >>> Can I use Sequel to determine the size of table fields - that is the >>> maximum number of characters in a string/varchar field, precision on a >>> float field, max value in an integer field. >>> >> >> For max length of a char/varchar field, yes, you can, but I don't think >> this information is directly exposed. >> > > DB.schema(table) returns some of that information but is database specific: >
Jeremy, This difference (and others) causes the schema_dumper extension to generate incorrect migrations for SQL Server: PostgreSQL create_table(:visitors, :ignore_index_errors=>true) do primary_key :id foreign_key :site_id, :sites, :null=>false, :key=>[:id] String :token, :size=>40, :null=>false String :useragent, :size=>1024, :null=>false DateTime :created_at, :null=>false Bignum :buoy, :null=>false index [:buoy] end SQL Server create_table(:visitors, :ignore_index_errors=>true) do primary_key :id Integer :site_id, :null=>false String :token, :fixed=>true, :null=>false String :useragent, :null=>false DateTime :created_at, :null=>false Bignum :buoy, :null=>false index [:buoy] end SQL Server migration is missing foreign keys and :size for String columns. I am working on a fix. Will submit a pull request sometime next week. Rohit -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/DSjNckacCvkJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
