-
Notifications
You must be signed in to change notification settings - Fork 386
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
Support for SQL Server on Rails 5.x, 6.0, 6.1, and 7.0 #1007
base: 50-stable
Are you sure you want to change the base?
Conversation
- execute and exec_query seem to work
- but the sql server arel visitor doe not work
- just copied type_to_sql method directly from pre-rails5 mssql adapter
handle migrations that specify a limit on integer columns
- pulled in exec_proc method from pre Rails 5 adapter - patch will now pass test exec_proc_test
- fixes some initial errors when dumping schema
- sqlserver 2000 is not supported anymore
included minimal to get identity_insert test passing. included minimal code from previous MSSQL::Column kept previous MSSQL::Column as old_column.rb
50 stable dev
Not sure we need this test or not.
50 stable dev
@JesseChavez We've forked the activerecord-sqlserver-adapter codebase to create an activerecord-jdbcsqlserver-adapter. Can you take a look at it and see if it would work for your needs? It should make maintenance easier than with this approach and hopefully make it easier to also support 5.1, 5.2 and 6.0. You can see the changes to the forked code here: jruby/activerecord-jdbcsqlserver-adapter@5-0-stable...jruby:5-0-stable-jdbc and running that branch with the branch for my PR in this project currently passes most of the test suite for the sqlserver gem (which is their own tests plus the ActiveRecord tests). My current result is: |
…' as per jdbc specs this avoid issues when rails apps define date formats such as: Date::DATE_FORMATS.merge!(default: '%d/%m/%Y') which changes the default format of 'to_s', this solve issue when saving dates to database, tested in mssql and postgres.
… as per jdbc specs for the postgresql jdbc This avoid issues when rails apps define date formats such as: Date::DATE_FORMATS.merge!(default: '%d/%m/%Y') This issue was suppose to be fixed by the previous commit but the method is overridden.
- supports_ddl_transactions? - supports_index_sort_order? - supports_partial_index? support for index sort order and partial index is partially supported, the adapter is able to create these indexes but it cannot retrieve for the schema, this is limitation of the jdbc driver, for future releases it would be better to get orders and where by using sp_helpindex or raw SQL.
…in configure connection)
just in case
… and 6.0 the error is: ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. arjdbc/jdbc/RubyJdbcConnection.java:1144:in `execute_prepared_query'
Just for reference if there is anyone still interested on an Active Record SQL Server adapter the works with JRuby There is a fork of the https://rubygems.org/gems/activerecord-jdbc-alt-adapter It is strongly advised to read the README file of the forked repository for more information and differences compared to platforms :jruby do
gem 'activerecord-jdbc-alt-adapter', '~> 61.0.0'
gem 'jdbc-mssql', '~> 0.9.0'
end Some of our apps are already running in production and one of them is a huge ancient finance Rails app originally created with Rails 2.0 and JRuby. |
Hi All,
I have done some work to support the SQL Server / Azure SQL, it is mostly based on the sqlserver arel
visitor from the CRuby activerecord-sqlserver-adapter gem.
At the moment passes most of its tests and activerecord tests with few exceptions, the failing test are due
SQL server specific ways to do things such as:
gets ignored by Postgres.
NOTES:
To avoid the locking in read_committed we need to do:
The activerecord tests run against my rails fork which contains specific fixes to run the test such as decimal max precision 38, quoting for SQL Server, etc. Please look at my commit in the rails fork.
https://github.com/JesseChavez/rails/tree/5-0-stable-dev