activerecord-sqlserver-adapter icon indicating copy to clipboard operation
activerecord-sqlserver-adapter copied to clipboard

Support for multiple schema types when dumping schema; potential fix for #317

Open alexggordon opened this issue 7 years ago • 1 comments

This is what I got. PR for specs and questions.

This PR allows rake db:schema:dump to dump the database schema for all microsoft table schemas.

It does this through exposing a method that can be monkey patched in an initializer:

module ActiveRecord
  module ConnectionAdapters
    class SQLServerAdapter < AbstractAdapter

      def configure_connection
        raw_connection_do "SET TEXTSIZE #{64.megabytes}"
      end

      def configure_application_name
        "myapp_#{$$}_#{Thread.current.object_id}".to(29)
      end

    end

    module SQLServer
      module SchemaStatements
        def server_schema
          ['dbo', 'schema2', 'schema3']
        end
      end
    end
  end

end

A couple of questions I have, because I don't know the internals of sql server super well.

  1. Should the dbo schema always be present in the information_schema.tables query?
  2. Is there a way to put the alternative schemas in the database.yml file that you know of?
  3. When writing to the schema.rb should we include the [schema_name]. in the create_table definition? 3b. How do we create the table in the same schema it was dumped in during rake db:schema:load?

alexggordon avatar Aug 15 '18 15:08 alexggordon

@alexggordon can you:

  1. Explain better what you want to achieve this this and maybe give an example
  2. Rebase your branch if you want to go ahead this this?

wpolicarpo avatar May 15 '20 12:05 wpolicarpo

Closing as stale

bf4 avatar Oct 05 '23 23:10 bf4