On Friday, September 21, 2012 10:45:01 AM UTC-7, rohit wrote: > > 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. >
I would say that the dumped migrations are not incorrect, only incomplete. It's missing the foreign key constraint and the exact size of the string columns. The schema_dumper extension will always be a best effort type of thing, one should never expect perfect results from it. For example, the schema_dumper extension doesn't dump CHECK constraints, and I don't think it ever will. Database#foreign_key_list is only currently supported on SQLite, PostgreSQL, MySQL, and Access. On other databases, the schema_dumper extension won't dump foreign keys. You'll have to add support for Database#foreign_key_list to the shared mssql adapter to get foreign_key support in the schema_dumper. For the :size info for String columns, you may have to modify the schema_dumper extension to pick up the actual size, assuming SQL Server makes that available. Jeremy -- 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/-/-ymS9o2tGuEJ. 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.
