Forum: Ruby on Rails db_schema_dump for SQL Server

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cb6f29d740e3a8d7f407ca335031bd32?d=identicon&s=25 Steve Eichert (Guest)
on 2006-01-19 23:20
(Received via mailing list)
We're using migrations to manage a SQL Server project and have been
running
into a number of issues with db_schema_dump/migrations.  Can anyone
confirm
that these are actual issues with the SQL Server adapter and not issues
with
me :)

1) Fields are not properly setup with proper null settings (:null =>
true /
false).  I'm wondering if we need to update the  def columns method in
activerecord/lib/activerecord/connection_adapters/sqlserver_adapter.rb
to
include "IS_NULLABLE as NULL" in the sql we use to retrieve the columns
so
that the following line in schema_dumper.rb will work: "tbl.print ",
:null
=> false" if !column.null".  That's a total guess and I'm new to Rails
so am
not exactly sure how to figure out if that would fix the issue.

2) Primary key fields are not defined as :primarykey.  This brings up
another issue in general, within migrations if we're not using the
default
"id" for primary key's are we screwed?

3) Some default's are not working in a way that would make sense.  For
instance a datetime column with a default of getdate() results in a
default
that looks like: :default => Sat Jan 01 00:00:00 Eastern Standard Time
2000.  Are there any defaults for built in RDBMS functions such as
getdate/sysdate.  If not how is that handled?

4) db_schema_dump seems to blow up when ActiveRecord::
Base.connection.instance_variable_get("@connection")["AutoCommit"] =
false
is not set in environment.rb, however, all other commands don't work
unless
AutoCommit is set to true.

rake aborted!
DBI::DatabaseError: Count
    OLE error code:8000FFFF in Microsoft OLE DB Provider for SQL Server
      ITransaction::Commit or ITransaction::Abort was called, and object
is
in a
 zombie state.
    HRESULT error code:0x80020009
      Exception occurred.: EXEC sp_helpindex TABLENAME

Thanks for any assistance!

- Steve
This topic is locked and can not be replied to.