-
Notifications
You must be signed in to change notification settings - Fork 103
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
Output information on PRIMARY KEY and UNIQUE constraints #81
base: master
Are you sure you want to change the base?
Conversation
f79f289
to
05ecdcc
Compare
Would it be better to change the name of "verbose" parameter into something more descriptive for example "extendedTableMeta" ? |
Looks like the RuleProvider error is being fixed by #82 |
I updated the flag to be |
The tests/examples/README still need to be updated, I'll try to do that this week. |
6e4ea8e
to
7562e0a
Compare
Good work ! |
I tested adding the original SQL type to the output ( The reason I didn't include it in this PR is that some types (at least in Postgres) are mapped internally to something else. For example, a column with a I don't know if that's a big problem though. Maybe we should add it with those internal Postgres types now and then try fix the library to use more "specific" types later? |
IIRC, for most of the types, udt name is pretty clear. Anyway, I think it's better for this PR to focus on constraints only. |
Seems reasonable. |
a642842
to
cf513f8
Compare
cf513f8
to
29db057
Compare
All tests are passing 😃 |
Is this totally dead? I was really hoping schemats supported exporting unique/pk constraints to aid in type safe upserts! |
Both of the original maintainers @crispmark and I left sweetiq and to the best of my knowledge there's no one maintaining this project at the moment. |
@DiskImage Last time I ran it, this PR was working fine. It's not in master but if you really want this you can clone the branch and use it. I can help you if you have any issues with it. I'm working on a new project using http://www.pg-structure.com/ to do the same thing here. The difference to schemats is that pg-structure creates a data structure to introspect the database, so you can use it to create all kinds of outputs, whereas schemats is "hardcoded" to output TypeScript interfaces. |
This PR implements part of #77. It modifies schemats so it outputs interfaces like this:
It also adds the
--verbose
flag to control the output. When verbose mode is on, the meta-interfaces are simply renamed:If it's off, the meta-interfaces are simplified using the helper types in #77 (comment):
One thing to note is that the non-formatted output includes some trailing commas. I couldn't test the formatted output because I was getting the following error from 'typescript-formatter: