If you want to do some cross database joins or includes across postgresql databases regardless of local or remote databases you can use Postgres FDW. Its an awesome tool for the job when you want to avoid data replication.
Base Postgresql FDW Model:
# lib/tasks/enhancements.rb
Rake::Task["db:migrate"].enhance do
### (ENHANCEMENTS RUN AFTER TASK COMPLETED)
if !!ENV["SKIP_UPDATE_POSTGRES_FDW_TABLES_AFTER_MIGRATE"]
# Do nothing, skip
else
### SETUP/RESET ALL FDW TABLE DEFINITIONS HERE
MySecondDatabaseBaseRecord.sync_all_fdw_tables!
end
end
Related External Links: