rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
972 stars 558 forks source link

table_name_prefix dbo. won't work for me #165

Closed thbar closed 12 years ago

thbar commented 12 years ago

(I'm just discovering the adapter so please bear with me!)

I have a user whose default schema is not dbo. I tried to use this to work-around it (as recommended on the readme):

ActiveRecord::Base.table_name_prefix = 'dbo.'

but this leads to:

TinyTds::Error: Incorrect syntax near '.'.: CREATE UNIQUE INDEX [dbo].[unique_schema_migrations] ON [dbo].[schema_migrations] ([version])

I was able to work around that with by changing the default schema on the user (but that's not always doable):

ALTER USER "DOMAIN\USER" WITH DEFAULT_SCHEMA = dbo;

Is the table_name_prefix trick supposed to handle what I supposed it was?

rails-sqlserver commented 12 years ago

Some DDL statements blow up with schema prefix, obviously. I tend to use a rails initializer for ActiveRecord and extend the Migration class with this helper that I sometimes use in migrations.

https://gist.github.com/1861074

thbar commented 12 years ago

Hi Ken - thanks! Good to know. Can I add a note on the README about that maybe to point to this?

(In this case I will just ensure I stick with the dbo schema).

rails-sqlserver commented 12 years ago

Sure!

On Feb 18, 2012, at 4:44 PM, Thibaut Barrère wrote:

Hi Ken - thanks! Good to know. Can I add a note on the README about that maybe to point to this?

(In this case I will just ensure I stick with the dbo schema).


Reply to this email directly or view it on GitHub: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/165#issuecomment-4037579

metaskills commented 12 years ago

Wont fix, documentation issue with possible later pull request.