Comments (13)
@benjie I understand that the opt-in comments won't change, it would need a different plugin for that. (I'll try to write one as a replacement for many-to-many).
Still, @omit
doesn't work properly on the constraints here, and I don't want to omit (automatically or not) whole tables.
from pg-many-to-many.
@include
gets implemented.
from pg-many-to-many.
@omit manyToMany
is supported in v1.0.0-beta.9.
from pg-many-to-many.
Thank you, it works great!
from pg-many-to-many.
Are you sure @omit
isn't working?
With this schema..
create table p.foo (
id serial primary key,
name text not null
);
create table p.bar (
id serial primary key,
name text not null
);
create table p.baz (
foo_id int constraint baz_foo_id_fkey references p.foo (id),
bar_id int constraint baz_bar_id_fkey references p.bar (id),
primary key (foo_id, bar_id)
);
comment on constraint baz_bar_id_fkey on p.baz is E'@omit';
...the Foo
type has a barsByBazFooIdAndBarId
field, but the Bar
type does not have a a foosBy...
field.
I do agree that support for @deprecated
should be added.
from pg-many-to-many.
Quick side note.. PostGraphile currently only respects the @deprecated
smart comment on table columns, not constraints. @benjie, in theory, should @deprecated
on constraints be supported in PostGraphile core?
from pg-many-to-many.
Yes. Probably this plugin should be updated to support it:
It turns out that we don't actually pass through the relevant constraint on scope, so that would need adding first:
from pg-many-to-many.
@mattbretl @omit
is not working for me, neither on the column nor on the constraint. The expected result would be
Foo
having abazsByFooId
field (1:N)Foo
not having abarsByBazFooIdAndBarId
field (N:N)Bar
having abazsByBarId
field (1:N)Bar
not having afoosByBazBarIdAndFooId
field (N:N)Baz
having afoo
field (N:1)Baz
having abar
field (N:1)
I'd rather see an opt-in smart comment on the junction table than some opt-out smart comment on individual foreign key constraints, as my schema has much more "accidental" many-to-many relations than it has intentional ones.
from pg-many-to-many.
Smart comment omits should still be opt-in currently; but you can write a plugin to automatically tag join tables as omitted. You can base it on this plugin:
https://www.graphile.org/postgraphile/plugin-gallery/#Customisation__OmitMutationsByDefaultPlugin
But maybe change it to omit tables that have a composite primary key?
from pg-many-to-many.
Foo
not having abarsByBazFooIdAndBarId
field (N:N)
I agree, it's omitting one direction but not the other. That needs to be fixed.
Bar
having abazsByBarId
field (1:N)
Baz
having abar
field (N:1)
I disagree with these two. If you've explicitly put an @omit
comment the constraint between bar
and baz
, neither of those fields should be present. It's worth considering a way to allow that specific outcome, perhaps @omit manyToMany
?
from pg-many-to-many.
I fixed the @omit
issue which was causing barsByBazFooIdAndBarId
to appear in the schema via #24. v1.0.0-beta.8 includes the fix.
I'll tackle @omit manyToMany
next.
from pg-many-to-many.
Feedback welcome on #25.
@benjie, any reason to avoid extending @omit
like this? The simple collections feature uses @simpleCollections omit
, so I could see this being implemented as @manyToMany omit
. I don't have a strong feeling either way.
from pg-many-to-many.
There's two main issues; first is that it prevents the use of aliases:
I don't think that's a big deal though.
Second is that if we add an @include
smart comment later which inverts @omit
then we won't know about these custom omit tags. We can probably solve this by adding an API to add these custom omit tags into the known list, so just be aware that this is something you should remind me about if I ever implement @include
. I'm not likely to do that in the next 6 months.
from pg-many-to-many.
Related Issues (20)
- Comment on foreign key constraint ignored for simple collections HOT 3
- Support @simpleCollections smart comments on the foreign key HOT 1
- Support for many to many relationships of the same type? HOT 2
- many-to-many and pg-simplify-inflector HOT 3
- Unexpected conflict error message HOT 2
- error generating relationship between tables HOT 4
- Naming conflict when replacing default relations HOT 3
- Common problems on install? HOT 2
- @omit read on tables HOT 3
- Multi column keys.
- Exposing Edge properties in "Simple Collections" HOT 2
- Smart comments on views HOT 1
- typescript error HOT 3
- Plugin is undefined on initialization HOT 4
- Enable for only linker tables
- Does pg-many-to-many require 4.1.0, or 4.1.0 or later? HOT 1
- TypeScript type declares a default export, but library doesn't set `modules.export.default` HOT 1
- @omit JoinTable
- Error: Cannot find module 'debug' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pg-many-to-many.