Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support whitespaces in definitions #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zverok
Copy link

@zverok zverok commented Dec 14, 2024

Trying to support Rails 6.1 which now has t.check_constraint "some long statement", but I am too unfamiliar with the development environment to include Rails-version specific code; so for now, I just deduced (and tested on a local project) that solving #16 will help.

The fix is to use more robust regexp for column name detection in Rails-generated statements.

The PR seems to work, both practically (when included locally in Rails 6.1+ project with constraints in DB), and in tests that are related to my changes.

I am not sure why SQLite tests fail on CI, but I am almost sure that it is unrelated:

can't activate sqlite3 (~> 1.4), already activated sqlite3-2.0.4. Make sure all dependencies are added to Gemfile.

Please advise how to proceed with this PR.

@zverok zverok marked this pull request as ready for review December 15, 2024 07:15
@urkle
Copy link
Member

urkle commented Jan 13, 2025

@zverok the reasion CI is failing is due to the gemfiles in the gemfiles folder. The gem 'sqlite3' needs a version constraint to pull in the same series that AR is expecting. So, just update those and that'll solve that issue.

As far as how the change is done for compatibility.

  • I am perfectly fine with dropping AR < 6 and bumping a new schema+ core so long as we make sure it all works in 6+. Which anyways the tests you added should help ensure it all works anyways. (if it HAS to be done)
  • To restrict a test to a specific version of rails you use the rails: tag on the context/spec. (e.g. rails: '< 7.0'). This is used in several different schema+ gems. ( https://github.com/search?q=org%3ASchemaPlus+rails%3A&type=code )
    • All of that shared spec logic is located in schema_dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants