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

[WIP] Feature/infer enums #994

Closed
wants to merge 5 commits into from

Conversation

weiznich
Copy link
Member

@weiznich weiznich commented Jul 5, 2017

follow up for #940

  • This will only work with postgres in the current version

This is a first draft version to get some feedback on this.
Things to fix before merging:

  • Formating
  • Documentation
  • Tests
  • Fix compiling other backends

Using an implementation similar to the shown, will restrict the produced binary to exactly the same database that was used to compile the code because the type oid's of the enums are hardcoded in HasSqlType::metadata. As far as I understand those oid's could/will change if you run your migrations on a other database instance, so the provided mapping will be invalid.

As far as I see there are two possible solutions:

  • Document and accept the behavior
  • Add some way to query the database on startup/connect for the actual oid's and store them in some kind of static map. Then use this map to generate the metadata

Fixes #343

weiznich added 5 commits June 7, 2017 23:42
* This extends the enum support indroduced in the last commit, to
support enums across different database instances (It does not depend on
the oid now)
Wrap the actuall connection into an new type to not expose it to ToSql
@sgrif
Copy link
Member

sgrif commented Jul 5, 2017

Can you remove all the enum stuff from this PR? I'd like to focus only on the runtime lookup of OIDs for now

@weiznich weiznich closed this Jul 5, 2017
@weiznich
Copy link
Member Author

weiznich commented Jul 5, 2017

Opened #995 for the runtime lookup part.

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.

Support enumerated types
2 participants