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

  • Home
  • SEARCH
  • 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 8369505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:39:44+00:00 2026-06-09T13:39:44+00:00

I had a situation today where I wanted to add a partial postgres index

  • 0

I had a situation today where I wanted to add a partial postgres index to a table in a migration. Naturally this kind of stuff is not possible yet in rails using add_index (it is coming some time)

So, I am forced to use execute statements in my migration.

Now, schema.rb has this comment at the top:

# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#

Unfortunately this execute statement is not tracked in schema.rb the effect of this is making schema.rb pretty much useless if I have any custom DML.

Is there any way I can force an execute statement containing DML to find itself into schema.rb ?

  • 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-09T13:39:46+00:00Added an answer on June 9, 2026 at 1:39 pm

    There’s no way to achieve what you want with schema.rb, what you want to do is switch to using the database’s native schema dumping / retrieval code.

    config.active_record.schema_format = :sql
    

    Now instead of a schema.rb file, you’ll get a structure.sql file. This should transparently work with all rails’ built in tasks and as it’s using the native dumper format, it’ll support whatever crazy stuff you want it to.

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

Sidebar

Related Questions

Okay, so I had a situation where I needed to add some cloned DOM
OK. This is a bit of a vanity app, but I had a situation
here's my situation: I had a big text file that I wanted to pull
I've had this situation occur a number of times in the library I'm writing,
The situation is that I have a table that models an entity. This entity
I had a situation on a dev server where all the ASP.Net applications we
I’m using Coldfusion MX 8. I recently had a situation where variables seem to
I ran into a situation where two machines both had microsoft.teamfoundation.testmanagement.client.dll in the GAC
I recently came across a situation where I had to use XPath as part
i am facing a new situation. I know someone definitely had faced these type

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.