alembic icon indicating copy to clipboard operation
alembic copied to clipboard

Postgresql autogenterate: allow for index operators (such as inet_ops)

Open garyvdm opened this issue 2 years ago • 2 comments

This change is so that a Postgresql index operators (such as inet_ops) gets autogenterated. It does so by broadening the types of index expression allowed from Column -> ColumnClause.

Fixes: #1098

Checklist

This pull request is:

  • [ ] A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • [x] A short code fix
    • please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted.
    • Please include: Fixes: #1098 in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • [ ] A new feature implementation
    • please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

garyvdm avatar Oct 12 '22 11:10 garyvdm

Hi,

Thanks for starting the implementation on this. I'm not sure if it's this easy the resolution, since in any case sqlalchemy 1.4 will not reflect these indexes, so the current logic would need to continue to stay in place.

The autogenerate compare would also probably need to take these into account

CaselIT avatar Oct 12 '22 12:10 CaselIT

Ok, I'm going try improve the change to address your comment.

garyvdm avatar Oct 12 '22 12:10 garyvdm

So I have done a lot of reading code, and more experimentation.

I'm not sure if it's this easy the resolution, since in any case sqlalchemy 1.4 will not reflect these indexes, so the current logic would need to continue to stay in place.

Ok, I finally understand what you mean here. 2.0.0b2 also doesn't reflect all information needed. I'm going to log a bug for that, and try see if I can fix that.

In the mean time, I'm going to close this PR.

garyvdm avatar Oct 18 '22 10:10 garyvdm

Oh understood what you mean by index with operations. I though you meant an index with expressions like lower(col), upper(other_col). Sorry.

Yes, I'm not sure if this information is reflected at the moment, but I don't think so

CaselIT avatar Oct 18 '22 11:10 CaselIT