Reputation: 41
Using ruby 2.5, rails 4.2.11,
I'm setting up a dev environment for a ruby project that used to just send straight to production.
HotWire contains application specific data while QualityDC contains much of the relational information shared by the other applications. How would I set it up so I can add a QualityDC_Dev instance to be used by the development.rb environment?
In the database.yml file (that references odbc.ini in my /etc folder, I have the following:
development:
adapter: sqlserver
mode: odbc
dsn: HotWire_Dev
username: webserver
password: password
pool: 5
timeout: 5000
qualitydc:
adapter: sqlserver
mode: odbc
dsn: qualitydc
username: webserver
password: wordpass
pool: 5
timeout: 5000
production:
adapter: sqlserver
mode: odbc
dsn: HotWire
username: webserver
password: password
pool: 5
timeout: 5000
odbc.ini entries:
[BrazeWire]
Driver = /usr/lib64/libtdsodbc.so.0
Server = server.domain.com
Database = HotWire
tds_version = 8.0
Port = 1433
[BrazeWire_Test]
Driver = /usr/lib64/libtdsodbc.so.0
Server = server.domain.com
Database = HotWire_Dev
tds_version = 8.0
Port = 1433'
[QUALITYDC]
Driver = FreeTDS
Server = server.domain.com
Database = QualityDC
tds_version = 8.0
Port = 1433
Upvotes: 2
Views: 134
Reputation: 41
Found another thread that referenced it, since 4.2 doesn't support grouping, had to make a janky workaround:
Using ruby 2.5, rails 4.2.11,
I'm setting up a dev environment for a ruby project that used to just send straight to production.
HotWire contains application specific data while QualityDC contains much of the relational information shared by the other applications. How would I set it up so I can add a QualityDC_Dev instance to be used by the development.rb environment?
In the database.yml file (that references odbc.ini in my /etc folder, I have the following:
development:
adapter: sqlserver
mode: odbc
dsn: HotWire_Dev
username: webserver
password: password
pool: 5
timeout: 5000
development_qualitydc:
adapter: sqlserver
mode: odbc
dsn: qualitydc_Dev
username: webserver
password: wordpass
pool: 5
timeout: 5000
production:
adapter: sqlserver
mode: odbc
dsn: HotWire
username: webserver
password: password
pool: 5
timeout: 5000
production_qualitydc:
adapter: sqlserver
mode: odbc
dsn: qualitydc
username: webserver
password: wordpass
pool: 5
timeout: 5000
And in the models:
class HotWire< ActiveRecord::Base
establish_connection "#{Rails.env}_qualitydc"
self.table_name = 'QualityDC.dbmaster.HotWire'
#set_primary_key :id_number
end
Upvotes: 1