Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 5.2 #636

Closed
cvkmohan opened this issue Jan 24, 2018 · 56 comments
Closed

Rails 5.2 #636

cvkmohan opened this issue Jan 24, 2018 · 56 comments
Assignees

Comments

@cvkmohan
Copy link

Hi, When I add the Gem into a rails app with 5.2.0.beta - It is raising an error. Can not think of any breaking changes between 5.1 and 5.2 regarding ActiveRecord. Can you please suggest how to make it work?

@metaskills
Copy link
Contributor

No work has been done for 5.2 yet. It'll be a few weeks. Sorry.

@juice
Copy link

juice commented Mar 29, 2018

Any updates? Rails 5.2 is now a rc2. Time to update the Adapter so we can use Rails 5.2 when it is released. Or even better test our Apps before it is released.

@juice
Copy link

juice commented Apr 10, 2018

Rails 5.2 is released, any idea when we will see a working version?

@benbarber
Copy link

Any update on 5.2 support, has any progress been made?

@spacerobotTR
Copy link

+1 to this. Would love to fire up a new 5.2 project with SQL server.

@brentdodell
Copy link

+1 Trying to update to 5.2 now.

@codiemullins
Copy link

@metaskills Are there known issues that prevent the gem from being compatible with Rails 5.2?

I'm working to upgrade an enterprise application and would like to take it to 5.2, but this is the only critical gem that doesn't support it.

I'm happy to assist in testing its compatibility with 5.2, but unsure where to start. Thank you for the great work!

@mauro-ni
Copy link

+1 for Rails 5.2 support.
I'm upgrading an ecosystem of apps (15 apps) to Rails 5.2 and one of those is using your gem.
Many thanks for your great work!!

Mauro

@BenMcH
Copy link
Contributor

BenMcH commented Jun 20, 2018

@metaskills Do you have any updates on Rails 5.2 compatibility? I am currently in the process of updating an old Rails app and this is the only gem that is stopping me from doing that.

@metaskills
Copy link
Contributor

Not yet, I do want to work on it but I've been doing some AWS training in my free time in the evenings. I already made the 5-1-stable branch so master can start taking small patches to get us there. Usually these upgrades need a few small tweaks to start the ball rolling towards a logical hit list of other fixes. I'm open to receiving PRs on those. Typically the first one is getting the tests to change the target version to 5.2 and coping with any ActiveRecord test harness changes, if any.

@BenMcH
Copy link
Contributor

BenMcH commented Jun 21, 2018

Thanks for the update! If I get a chance, I'll try to pull down the code and start looking at it, but I'm not sure how much help I would be. If I'm successful, I'll send a PR!

@matthewdunbar
Copy link
Contributor

I've made some progress on upgrading to Rails 5.2. I currently only have about 40 tests failing, though it seems to mostly work in use in a real application. Here's my fork, changes are on master: https://github.com/matthewdunbar/activerecord-sqlserver-adapter

@wpolicarpo
Copy link
Member

@matthewdunbar don't you want to open a PR here so we can help you? I've made some progress as well, but noticed we have more or less the same changes. It might be a good idea we concentrate our efforts so we don't duplicate work.

@matthewdunbar
Copy link
Contributor

@wpolicarpo It looks like your changes weren't committed yet last time I looked through the network tab, but I like what you have. Its a little more succinct than what I came up with. I did open a PR on this project late last week.

@wpolicarpo
Copy link
Member

@matthewdunbar Cool, I haven't seen you PR before, sorry. I pulled some of your changes into my branch and this is what I have so far:

Finished in 396.715748s, 13.4857 runs/s, 39.9127 assertions/s.

5350 runs, 15834 assertions, 28 failures, 60 errors, 5 skips

I'll try to make a list on your PR so we can track our progress there if you don't mind.

@matthewdunbar
Copy link
Contributor

@wpolicarpo Awesome! Thanks for the feedback on this.

@skukx skukx mentioned this issue Jul 9, 2018
2 tasks
@UnConundrum
Copy link

Hi. Are there any updates?

@spacerobotTR
Copy link

Any news on this?

@metaskills
Copy link
Contributor

See here right? #653 (comment)

@spacerobotTR
Copy link

Thank you!

@thomasfedb
Copy link

Signed up as a $50/mo backer, given that this gem is important for my freelance work. Hope that helps a little to keep things going.

@gr8bit
Copy link

gr8bit commented Nov 13, 2018

@thomasfedb We're 3 patr(e)ons already! Far from the $3k target though :( If anyone else loves this gem and wants to join us: https://www.patreon.com/metaskills/overview :)

@rhuanbarreto
Copy link
Contributor

+1 on this. Important to update the gem!

@wpolicarpo
Copy link
Member

Just a quick note here: I've been using master branch in a production application for 2 weeks or so now without any issues.

I'd appreciate If anyone is interested in trying master and helping with eventual bugfixes in #662.

@thomasfedb
Copy link

@wpolicarpo to clarify, using the master branch with a Rails 5.2 project?

@juice
Copy link

juice commented Dec 3, 2018

We are using the master branch for a few weeks now on some smaller projects but in our production system. We want to use it in our biggest Project, but we cannot deploy without working tests. It looks like applying fixtures in tests is not working.

@wpolicarpo
Copy link
Member

@thomasfedb

Exactly, Rails 5.2.

@juice

Could you tell us what is not working for you? Can you leave a comment in #662 and maybe I can help you?

@tommyalvarez
Copy link

@wpolicarpo what's the status on this? Do you know by chance an approximate day of release for 5.2 ?

@tommyalvarez
Copy link

@wpolicarpo understood. Using the master branch will work with 5.2 with no issues for the time being ? I have a production app, but it's not that serious, it's only for querying info in the background...

@metaskills
Copy link
Contributor

Just a reminder that pushing code to the master branch of this repo means it should have a high standard of QA. For example a checklist of things would be a) a public pull request, even if short lived b) tests passing.

@wpolicarpo
Copy link
Member

@tommyalvarez

I have a reasonably big application running master branch and didn't have any issues so far.

@metaskills

Thanks for that. I will try to fix master tests so we can release at least an alpha version in the next days.

@jayjlawrence
Copy link

@thomasfedb We're 3 patr(e)ons already! Far from the $3k target though :( If anyone else loves this gem and wants to join us: https://www.patreon.com/metaskills/overview :)

I checked the link and now there's only two. Is the target $3k per month? I find the page a bit thin on details where these. funds are going, the purpose (not 5.1 as it says under the goals heading). And then a brief post every week or two will give greater confidence that this is actually active and real.

None the less I have signed up and represent 50% of the funding to Patreon at this time. With this new found great power I'd like to discuss new priorities around that JDBC bit ... 😏

@tommyalvarez
Copy link

tommyalvarez commented Dec 22, 2018

@wpolicarpo i found a bug i think with 5.2. Even after specifying in an initializer:

ActiveRecord::ConnectionAdapters::SQLServerAdapter.lowercase_schema_reflection = true
When doing a join between two tables like Foo.joins(:bar), it appends an order by to the query but without lower casing the attributes. so an invalid tiny_tds exception is thrown saying column attribute_not_lowercased does not exist...

Edit_1:
After some research i found that the problem is in combination with the gem composite_primary_keys, where this method is defined:

def primary_Key_From_Table t
        return unless t

        column_name = @connection.schema_cache.primary_keys(t.name) ||
          @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
        return nil if column_name.blank?

        # CPK
        # column_name ? t[column_name] : nil
        case column_name
        when Array
          column_name.map do |name|
            t[name.downcase]
          end
        else
          [t[column_name.downcase]]
        end
      end

I had to manually add those downcase and monkey patch it. However i don't know if this belongs in this thread or as an issue in the other gem library. What do you think?

@wpolicarpo
Copy link
Member

@tommyalvarez since ActiveRecord doesn't support composite PKs by default, I don't think we should treat this here. It's more likely that you have to check with that gem to see what they can do in this case.

@metaskills
Copy link
Contributor

I don't think we should treat this here. It's more likely that you have to check with that gem to see what they can do in this case.

Agreed. I've always taken that perspective. Easier for them to support patches on each adapter as part of their extension gem.

@DrCool2
Copy link

DrCool2 commented Jan 9, 2019

Thanks for the work on this project.

Looking forward to using Rails 5.2 and SQLServer. Status Update?

@DrCool2
Copy link

DrCool2 commented Jan 16, 2019

Status Update?

@jasonperrone
Copy link

jasonperrone commented Jan 16, 2019

DrCool2, if it helps, the master branch works with 5.2, so if you define the Gemfile like this, you'll be ok:
gem 'activerecord-sqlserver-adapter', git: 'https://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git', branch: 'master'

@wpolicarpo
Copy link
Member

@metaskills I have fixed all issues for 5.2 changes and all tests are passing again. Do you think we can release something soon?

@thomasfedb
Copy link

@jbwl can you open an issue with an example so I can attempt a reproduction?

@juice
Copy link

juice commented Jan 25, 2019

@wpolicarpo I tried the newest code from master.

We have this option set in our adapter model
ActiveRecord::ConnectionAdapters::SQLServerAdapter.use_output_inserted = false

We see this when we start our rails test:

   (0.1ms)  BEGIN
  Fixture Delete (1.6ms)  DELETE FROM [StoragePolicy]; SELECT @@ROWCOUNT AS AffectedRows
  SQL (0.6ms)  SET IDENTITY_INSERT [StoragePolicy] ON
  Fixture Insert (1.6ms)  INSERT INTO [StoragePolicy] ([sp_ID], [sp_sl_ID], [sp_c_ID], [sp_Name], [sp_Description], [sp_CopyToArchive], [sp_CopyToArchiveAfterDays], [sp_RemoveFromWorkspace], [sp_RemoveFromWorkspaceAfterDays], [sp_ShortName], [sp_IsExplicitContentPolicy]) VALUES (1, 1, 1, N'Test', N'Test Test Test', 1, 20, 1, 20, N'test', 0)
  SQL (0.5ms)  SET IDENTITY_INSERT [StoragePolicy] OFF


TypeError: can't quote ActiveRecord::ConnectionAdapters::SQLServer::Type::Data

ActiveRecord::StatementInvalid:         ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near '`'.: INSERT INTO `StoragePolicy` (`sp_ID`, `sp_sl_ID`, `sp_c_ID`, `sp_Name`, `sp_Description`, `sp_CopyToArchive`, `sp_CopyToArchiveAfterDays`, `sp_RemoveFromWorkspace`, `sp_RemoveFromWorkspaceAfterDays`, `sp_ShortName`, `sp_IsExplicitContentPolicy`) VALUES (1, 1, 1, 'Test', 'Test Test Test', TRUE, 20, TRUE, 20, 'test', FALSE), (2, 1, 1, 'Test', 'Test Test Test', TRUE, 20, TRUE, 20, 'test', FALSE)


SQL (0.6ms)  BEGIN TRANSACTION
  Fixtures Load (1.0ms)  DELETE FROM [StoragePolicy]
  Fixtures Load (1.3ms)  INSERT INTO `StoragePolicy` (`sp_ID`, `sp_sl_ID`, `sp_c_ID`, `sp_Name`, `sp_Description`, `sp_CopyToArchive`, `sp_CopyToArchiveAfterDays`, `sp_RemoveFromWorkspace`, `sp_RemoveFromWorkspaceAfterDays`, `sp_ShortName`, `sp_IsExplicitContentPolicy`) VALUES (1, 1, 1, 'Test', 'Test Test Test', TRUE, 20, TRUE, 20, 'test', FALSE), (2, 1, 1, 'Test', 'Test Test Test', TRUE, 20, TRUE, 20, 'test', FALSE)
  SQL (0.7ms)  IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION
   (3.2ms)  SELECT s.name, o.name
FROM sys.foreign_keys i
INNER JOIN sys.objects o ON i.parent_object_id = o.OBJECT_ID
INNER JOIN sys.schemas s ON o.schema_id = s.schema_id

@wpolicarpo
Copy link
Member

@juice can you open an issue describing the columns types of StoragePolicy with a reproducible script or error backtrace at least?

@juice
Copy link

juice commented Jan 28, 2019

@wpolicarpo I created a rails project with one table and one field.

https://github.com/juice/mssql-test

execute: rails test

I hope you can help use with this one.

@thomasfedb
Copy link

Hey @wpolicarpo, would be keen to know where things are up to. Can you update us?

@wpolicarpo
Copy link
Member

@thomasfedb I am waiting for @metaskills to release a new version. For now, people can point their projects to master and give feedback. There isn't much I can do.

@opensas
Copy link

opensas commented Feb 12, 2019

Gee I hope you can get thru it pretty soon, I've just realized that latest version of redmine is waiting for rails 5.2 support too...

Redmine 4.0 does not support SQL Server as of December 2018 because a dependent library activerecord-sqlserver-adapter does not support Rails 5.2 yet.

see: http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Supported-database-back-ends

@metaskills
Copy link
Contributor

@wpolicarpo Added you to ruby gems as a gem owner to help.

@wpolicarpo
Copy link
Member

Thanks, @metaskills!

I have released 5.2.0.rc1 and will wait a few days to release the final 5.2.0. Worth mentioning that I've been using code in master for a few weeks without any issues.

For those waiting for the final 5.2.0 version, please install 5.2.0.rc1 and let us know about any issues you find.

@wpolicarpo wpolicarpo self-assigned this Feb 12, 2019
@gr8bit
Copy link

gr8bit commented Feb 12, 2019

I upgraded from 5.1.6 to master an hour ago, will update to 5.2.0.rc1 right now :) Thank you!

@net1957
Copy link

net1957 commented Mar 3, 2019

updated from rails 5.1.6 to rails 5.2.2 and activerecord-sqlserver-adapter 5.2.0.rc1 without issue.
I'm on w10 for test and DB is ms*sql 2014
ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]

Thanks!

@wpolicarpo
Copy link
Member

Final 5.2.0 was released.

@dwood-somniainc
Copy link

dwood-somniainc commented Oct 23, 2019

The gem no longer works for ruby on rails 6.0. I get

ruby version 2.6.3

"Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
 activerecord-sqlserver-adapter was resolved to 5.2.0, which depends on activerecord (~> 5.2.0)

@gr8bit
Copy link

gr8bit commented Oct 23, 2019

@dwood-somniainc it hasn't been tested with 6.0 yet and is always pinned to a major Rails version. Just like this issue was opened, we need a Rails 6.0 issue and somebody to issue some tests on it nudge, nudge ;)

Edit: there is #683 - please refer to that issue

@soosann
Copy link

soosann commented Mar 13, 2020

While installing apartment ...this error occurs
The adapter sqlserver_adapter is not yet supported (RuntimeError)......
...is it not still supported??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests