Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7626093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:16:44+00:00 2026-05-31T05:16:44+00:00

Is it possible to append two databases in rails application? For example, SQLite database

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:16:45+00:00Added an answer on May 31, 2026 at 5:16 am

    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

    development:
      adapter: mysql2
      encoding: utf8
      reconnect: false
      database: project_dev
      pool: 5
      username: project
      password:
    
    test:
      adapter: mysql2
      encoding: utf8
      reconnect: false
      database: project_test
      pool: 5
      username: project
      password: 
    
    sqlite:
      development:
        adapter: sqlite3
        database: db/development.project.db
        pool: 5
        timeout: 5000
    
      test:
        adapter: sqlite3
        database: db/test.project.db
        pool: 5
        timeout: 5000
    

    Models:

    Abstract model for all sqlite models;
    uses connection ninja gem

    class SqliteModel < ActiveRecord::Base
      self.abstract_class = true
      use_connection_ninja(:sqlite)
    end
    

    Sqlite model

    class Book < SqliteModel
      set_table_name  :Books
      set_primary_key :BookID
    
      belongs_to  :volume,  :foreign_key => :VolumeID
      has_many :chapters,   :foreign_key => :BookID
    end
    

    Mysql model

    class Highlight < ActiveRecord::Base
      # ...
    end
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to append two NSMUtableArray's can any one suggest me how it possible?
Possible Duplicate: How to append data to a file? Quick question here, how can
Possible Duplicate: How do I concatenate two arrays in C#? How do I append
Having two lists, I want to get all the possible couples. (a couple can
Possible Duplicate: Is it possible to append to innerHTML without destroying descendants' onclick functions?
Is it possible to append a parameter to a PHP Header Location? I'm having
Possible Duplicate: Python list append behavior Why does this code: x = [[]]*3 x[0].append('a')
Possible Duplicate: “Least Astonishment” in Python: The Mutable Default Argument def f(a, L=[]): L.append(a)
Is it possible to make one big array from a query like: select array_append(ARRAY[0],
Is it possible to reverse a list in Prolog with only two arguments? Such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.