I have a Rails 3.2.14 app which uses a SQLServer database. I'm using the usual combination of sqlserver-foreigner, foreigner and activerecord-sqlserver-adapter to make this all work.
I'm using foreigner methods in my migrations such as
def change
change_table :readings do |t|
t.foreign_key :reading_states
end
end
After running rake db:migrate on my development machine, I get this added to the schema file
And looking in the db/schema.rb file on the server, all the add_foreign_key statements are missing. I've confirmed via EXEC sp_fkeys 'Readings' that no foreign keys exist on the server.
There are some very minor environmental differences between my development and the deployment. My development database is SQLServer Express 11.0.2100 whereas the deployment db is 10.50.2500.
So, do we need to upgrade the version in the deployment environment to be 11.x or is there something else I'm missing?
Hi,
I have a Rails 3.2.14 app which uses a SQLServer database. I'm using the usual combination of
sqlserver-foreigner
,foreigner
andactiverecord-sqlserver-adapter
to make this all work.I'm using
foreigner
methods in my migrations such asAfter running
rake db:migrate
on my development machine, I get this added to the schema fileThis is all good and I can see that the foreign key actually gets created in the database. Life is sweet.
However, if I deploy to my server, the foreign keys aren't created. Running a db:migrate has the following error:
I certainly don't get this error in development. Looking at the code in
lib/sqlserver/foreigner.rb
, I see that you register exactly the string is says isn't registered.And looking in the
db/schema.rb
file on the server, all theadd_foreign_key
statements are missing. I've confirmed viaEXEC sp_fkeys 'Readings'
that no foreign keys exist on the server.There are some very minor environmental differences between my development and the deployment. My development database is
SQLServer Express 11.0.2100
whereas the deployment db is10.50.2500
.So, do we need to upgrade the version in the deployment environment to be
11.x
or is there something else I'm missing?Thanks, Dave