# Where to override ActiveRecord::ConnectionAdapters::SQLServerAdapter?

**URL:** <https://www.ruby-forum.com/t/where-to-override-activerecord-sqlserveradapter/121548>\
**Category:** Rails\
**Created:** [November 28, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/where-to-override-activerecord-sqlserveradapter/121548 "2007-11-28T21:15:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@student](https://www.ruby-forum.com/u/student)\
**Post date:** [November 28, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/where-to-override-activerecord-sqlserveradapter/121548/1 "2007-11-28T21:15:25Z")

</div>

I’m working on an existing global database running on MS SQL Server.  
The appropriate primary key is uniqueidentifier, so I want to set  
ActiveRecord::ConnectionAdapters::SQLServerAdapter#native\_database\_types[:primary\_key]  
= “uniqueidentifier NOT NULL newid() PRIMARY KEY”.

Obviously, I need to override the native\_database\_types definition,  
but I really don’t know where I should put the code so rails picks it  
up. I want to do this in migrations.
