Ruby on Rails Foreigner plugin not working for SQL Server

Well, now that I've finally got my stupid ODBC stuff configured, I took a schema.rb file that I dumped from a Postgres database and did a db:schema:load on it in a Rails project configured for SQL Server.

Well, it sets up all the schema in the SQL Server database except for a minor detail: No foreign keys are created.

The rake command doesn't show any errors and does say it is adding foreign keys. But they don't actually get added. This is the last bit from the command:

-- add_foreign_key("workhistoryform", "form", {:name=>"workhistoryform_form_rid_fkey", :column=>"form_rid", :primary_key=>"form_rid"})
   -> 0.0002s
-- initialize_schema_migrations_table()
   -> 0.0092s
-- assume_migrated_upto_version(0)
   -> 0.0942s
[earlz@earlzarch avp_msql_migrations]$

So what is the problem? Does the Foreigner plugin not work in SQL Server? If it didn't I'd expect to see an error or something...

Answers


Ok, I fixed it. Well, hacked it anyway. Foreigner doesn't actually have built in support for SQL Server, but it is close enough to SQL_2003 that it works (minus removing Foreign Keys and detecting the Schema)

I made a post about it on my blog which basically boiled down to adding a to the list of adapters and creating a very simple new adapter for SQL Server(use the PostgreSQL adapter as a template). (modifying the Foreigner gem)


I fixed this properly and sent a pull request to foreigner's author. Meantime, you can use the version from my repository: https://github.com/cjheath/foreigner


Need Your Help

UIImageView Array not showing contents?

ios swift uitableview uiimageview uiimage

I have an array of UIImageViews that I want to display to the screen. However, I can't seem to be able to do so. I declared my array of UIImageViews like so:

phpmailer throwing intermittent error : EOF found while checking if connected

php smtp phpmailer

I am trying to send mail via SMTP using PHPMailer class. My problem is , for the first attempt , the mail sender is working oerfect , but for all subsequent attempts it's throwing error :