How can I setup a legacy database?


#1

Hi all

I have an application I am trying to develop that requires communicating with two databases, an internal database for application specific configuration (postgres) and a legacy database (mysql).

When I created my new application I initially specified --database=postgres.
So I have two questions?

(a) How would can I initialize a new adaptor (Cannot instantiate adapter of Lotus::Model::Adapters::SqlAdapter – mysql)?
(b) How would I go about defining both these adaptors in lib/my_application.rb?(what I currently have)

 adapter type: :sql, uri: ENV['TEST_ANALYTICS_DATABASE_URL']
 adapter type: :sql, uri: ENV['LEGACY_GENIE_URL']

Thanks
Dane


#2

Hi Dane

Lotus is now officially support 1 adapter per application (for its repository). If you want two adapters in same app, you have to look into how lotus/model is configured and code it up yourself.

For the issue with Cannot instantiate adapter forLotus::Model::Adapters::SqlAdapter - mysql, firstly please ensure you installmysqlgem. Please be noted that it is recommended that you are usingmysql2gem instead ofmysqlgem. If you opt formysql2gem, please make sure your URL unix usemysql2://insteadmysql://` protocol.

Hope this help


#3

Thank you that was just what I needed :wink: