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

Fixed error when was used the enum type in postgres #361

Closed
wants to merge 1 commit into from
Closed

Fixed error when was used the enum type in postgres #361

wants to merge 1 commit into from

Conversation

Marlysson
Copy link
Contributor

@Marlysson Marlysson commented Feb 3, 2021

Closes #359
@josephmancuso It's done and I had to change somethings.

  1. Removed the CHECK from mapped types because when the process of "columnize" start, then it was placed in length position ( acting as length of column ) for some way, making it impossible change it ( I think that was a bug ).
  2. Added values in Constraint model to represent the values that the column will compare against.
  3. Created constraint get_[constraint]_string in platform.

No break change with this changes.

column, "enum", length=255, nullable=nullable
)

self.table.add_constraint(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only issue with this PR is adding a dedicated constraint type here. Won't things like sqlite, mssql and mysql need to specially handle this? What happens when those databases don't have check constraints?

It's past midnight right now but I'm actually confused on why some of those tests didn't fail lol ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were just going to add a dedicated column constraint. I did something like this in #363 to compare these 2 approaches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josephmancuso by that I saw, all databases ( that we support ) had the check constraint handled equally. This change define in table level and don't column level.

But I can change to what you do in SQLite.

@josephmancuso
Copy link
Member

Great try at this but will fix in #363

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.

Enum in migration not working (Postgres)
2 participants