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 9186801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:37:10+00:00 2026-06-17T19:37:10+00:00

The situation I have is that we have multiple schemas on SQL Server that

  • 0

The situation I have is that we have multiple schemas on SQL Server that we need to be able to do schema:dump and migrations against. One schema is for our new Rails application, the other schema is for a legacy system that we have dependencies on.

When running rake db:schema:dump our new schema tables are correctly created in the schema.rb file. The legacy schema tables do not end up in schema.rb. I’m wondering how others are dealing with this issue.

Another consideration I have given to this is since our legacy schema tables are fairly static would be to add these to a separate file once and then create a before hook for rake db:schema:load that would run that file prior to the schema.rb. Is there a before hook for rake db:schema:load; if so what is that?

  • 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-06-17T19:37:12+00:00Added an answer on June 17, 2026 at 7:37 pm

    Here is how I ended up solving this issue.

    I added a before hooks into schema load and schema dump within hooks.rake as described below.

    namespace :project do
      namespace :db do
        task :before_schema_load => :environment do
          add_tables
        end
    
        task :before_schema_dump => :environment do
          add_ignored_tables
        end
      end
    end
    
    Rake::Task['db:schema:dump'].enhance(['project:db:before_schema_dump'])
    Rake::Task['db:schema:load'].enhance(['project:db:before_schema_load'])
    

    Within the add_tables functionality I’ve manually created what is essentially a static schema.rb equivalent for my legacy tables since these will change infrequently (possibly never).

    Within the add_ignored_tables I’ve added tables to the ActiveRecord::SchemaDumper.ignore_tables array to indicate tables that are outside of my schema that I don’t want dumped to schema.rb. In my case this is everything that isn’t under my current app’s schema. In my situation everything that I want outside of my app’s schema is specified within the add_tables so those tables as well should not end up in the schema.rb.

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

Sidebar

Related Questions

Here's the situation: I have a web-based ticket application, multiple users. One problem that
The situation: I have multiple classes that should each hold a variable with a
Here is my situation: I have one table that contains a list of drugs
I have a situation with my MVC2 app where I have multiple pages that
Consider the following situation: I have an object foo that is used by multiple
So here the situation. I have multiple strings that begin and end with a
I have a content type that references multiple nodes, and I need a way
Here's the situation: I have a custom TextBox control that contains multiple other TextBox
The Situation I need to support generating XML documents based on schemas that vary
Here is the situation, i have a website that can be accessed from multiple

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.