Is it possible to append two databases in rails application? For example, SQLite database is portable. I can download SQLite database from another server. When rails application starts, it mount the database. Can i append all the data from another database to existing database? May be SQLite provide a way for merging databases?
Is it possible to append two databases in rails application? For example, SQLite database
Share
I’m not sure sure what did you mean saying “append databases in application”. But you can use 2 different (with different schemes) databases in your application. For example:
config/database.yml
Models:
Abstract model for all sqlite models;
uses connection ninja gem
Sqlite model
Mysql model
You can even use associations between tables in different databases.
But if you was asking about using 2 databases with the same scheme(i.e. just different data), then my answer is no, it’s not possible(I can be wrong though). I think that is a question about replication, synchronization, backups or something similar – DB layer, not application.
Of course you can have 2 same tables in both databases, 2 models – one per database, and then just copy records from one to another. But Rails won’t do it automatically.