igorkasyanchuk / sql_view

Rails SQL Views made easy ;)
https://www.railsjazz.com/
51 stars 2 forks source link

Additional Database adapter support #1

Open tarellel opened 2 years ago

tarellel commented 2 years ago

I really like the idea of this project. But something to consider is it is built to be Postgres specific.

You'd easily be able to able to support other database adapters by moving all the RAW SQL statements to an adapters specific folder /lib/sql_view/adapters

So you could have postgres.rb, mysql.rb, sqlserver.rb, oracle.rb, sqlite3.rb

There may be a better method, but you can easily pull an applications primary database adapter with: ActiveRecord::Base.configurations[Rails.env.to_sym][:adapter]

That why you'd have a direct reference on which database adapter you'd need to pull in for the application.

igorkasyanchuk commented 2 years ago

Hi @tarellel yeap :) I know how to check the current adapter and etc

I just don't have other DB's and I think the regular view will work in most DB's. As for others, I'm ready to see a PR from you or other contributors. Just too busy with other upcoming gems.