Skip to content

Conversation

joshleblanc
Copy link
Contributor

This PR expands on #854.

In addition to #854, it fixes a problem with rake db:create failing to run, as well as fixes queries on arrays throwing.

As a happy accident, this also fixes #841

@joshleblanc joshleblanc changed the title Rails 6 1 support Rails 6.1 support ++ Mar 22, 2021
@runephilosof-abtion
Copy link
Contributor

Still does not seem to work

This error is from the https://github.com/rails-sqlserver/ss_app, which I upgraded to Rails 6.1 https://github.com/runephilosof/ss_app/tree/rails6.1.

[vagrant@localhost ss_app]$ rails db:create
TinyTds::Error: Incorrect syntax near 'DATABASE'.
Couldn't create 'ss_app_development' database. Please check your configuration.
rails aborted!
ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near 'DATABASE'.
/home/vagrant/ss_app/bin/rails:5:in `<top (required)>'
/home/vagrant/ss_app/bin/spring:10:in `block in <top (required)>'
/home/vagrant/ss_app/bin/spring:7:in `tap'
/home/vagrant/ss_app/bin/spring:7:in `<top (required)>'

Caused by:
TinyTds::Error: Incorrect syntax near 'DATABASE'.
/home/vagrant/ss_app/bin/rails:5:in `<top (required)>'
/home/vagrant/ss_app/bin/spring:10:in `block in <top (required)>'
/home/vagrant/ss_app/bin/spring:7:in `tap'
/home/vagrant/ss_app/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

It also fails when running rails db:drop

[vagrant@localhost ss_app]$ rails db:drop
TinyTds::Error: Incorrect syntax near the keyword 'SET'.
Couldn't drop database 'ss_app_development'
rails aborted!
ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near the keyword 'SET'.
/home/vagrant/ss_app/bin/rails:5:in `<top (required)>'
/home/vagrant/ss_app/bin/spring:10:in `block in <top (required)>'
/home/vagrant/ss_app/bin/spring:7:in `tap'
/home/vagrant/ss_app/bin/spring:7:in `<top (required)>'

Caused by:
TinyTds::Error: Incorrect syntax near the keyword 'SET'.
/home/vagrant/ss_app/bin/rails:5:in `<top (required)>'
/home/vagrant/ss_app/bin/spring:10:in `block in <top (required)>'
/home/vagrant/ss_app/bin/spring:7:in `tap'
/home/vagrant/ss_app/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:drop:_unsafe
(See full trace by running task with --trace)

@joshleblanc
Copy link
Contributor Author

@runephilosof-abtion I believe you need to point your gemfile at the rails-6-1-support branch, it defaults to master.

Try something like gem 'activerecord-sqlserver-adapter', github: "joshleblanc/activerecord-sqlserver-adapter", branch: "rails-6-1-support"

Copy link
Contributor

@runephilosof-abtion runephilosof-abtion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshleblanc You are correct. How embarrassing. It is working perfectly.

@runephilosof-abtion
Copy link
Contributor

@wpolicarpo It would be nice to get this merged.
The tests are failing because of a pull rate limit with docker.com.
Rerun the tests?

Might want to authenticate to docker.com to increase the limit. But it should not delay this important PR.

@vkalach
Copy link

vkalach commented Apr 12, 2021

@wpolicarpo any estimates when it will be merged?

@wpolicarpo
Copy link
Member

@joshleblanc can please you rebase your branch against main?

@joshleblanc joshleblanc force-pushed the rails-6-1-support branch 2 times, most recently from 85951c3 to deccbc8 Compare April 15, 2021 18:42
@joshleblanc
Copy link
Contributor Author

Removed the 2 already-implemented fixes, updated the database tasks to use the configuration hash when required, rather than hash with indifferent access.

@wpolicarpo wpolicarpo changed the title Rails 6.1 support ++ Fix Rails 6.1 database config Apr 16, 2021
@wpolicarpo wpolicarpo merged commit 389af14 into rails-sqlserver:main Apr 16, 2021
lavika pushed a commit to lavika/activerecord-sqlserver-adapter that referenced this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Queries on empty array causes TinyTds to throw
4 participants