Skip to content

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