Sha256: d5f891a30e96442f38c0fa3640f45b8c8526e68deba6d31f3e7a85064fe2d5f8
Contents?: true
Size: 1.29 KB
Versions: 8
Compression:
Stored size: 1.29 KB
Contents
module ActiveRecord module ConnectionAdapters module MSSQL class SchemaCreation < AbstractAdapter::SchemaCreation private def visit_TableDefinition(o) if o.as table_name = quote_table_name(o.temporary ? "##{o.name}" : o.name) projections, source = @conn.to_sql(o.as).match(%r{SELECT\s+(.*)?\s+FROM\s+(.*)?}).captures select_into = "SELECT #{projections} INTO #{table_name} FROM #{source}" else o.instance_variable_set :@as, nil super end end def add_column_options!(sql, options) sql << " DEFAULT #{quote_default_expression(options[:default], options[:column])}" if options_include_default?(options) sql << ' NOT NULL' if options[:null] == false sql << ' IDENTITY(1,1)' if options[:is_identity] == true sql << ' PRIMARY KEY' if options[:primary_key] == true sql end # There is no RESTRICT in MSSQL but it has NO ACTION which behave # same as RESTRICT, added this behave according rails api. def action_sql(action, dependency) case dependency when :restrict then "ON #{action} NO ACTION" else super end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems