Comments (3)
I think we do not enable cascade deletes as form of precaution, but I get that this is inconvenient to delete all comments from end user app to delete post
Anyone can alter cascade rules on FK but that is like a lot of work if you have large db and on the other hand I do not want to have issue ala graphback deleted half of my database
because we setup default cascades.
We need new annotations/ability probably so this is feature request IMHO
from graphback.
Actually I cannot replicate this. I see we do not put any so constraints by default. More info needed
from graphback.
Actually I cannot replicate this. I see we do not put any so constraints by default. More info needed
Flow to reproduce this issue
- create a note record
Query:
mutation {
createNote(input: { title: "the gql 2 !" }) {
id
title
}
}
Output:
{
"data": {
"createNote": {
"id": "2",
"title": "the gql 2 !"
}
}
}
2.create a comment with noteId
query:
mutation {
createComment(input: { noteId: 2, text: "wow " }) {
id
text
note {
id
title
}
}
}
output:
{
"data": {
"createComment": {
"id": "2",
"text": "wow",
"note": {
"id": "2",
"title": "the gql 2 !"
}
}
}
}
3.Now delete the note record
query:
mutation {
deleteNote(input: { id: 2 }) {
id
title
}
}
output:
{
"errors": [
{
"message": "delete from \"note\" where \"id\" = $1 returning * - update or delete on table \"note\" violates foreign key constraint \"comment_noteid_foreign\" on table \"comment\"",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"deleteNote"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"length": 274,
"name": "error",
"severity": "ERROR",
"code": "23503",
"detail": "Key (id)=(2) is still referenced from table \"comment\".",
"schema": "public",
"table": "comment",
"constraint": "comment_noteid_foreign",
"file": "ri_triggers.c",
"line": "2797",
"routine": "ri_ReportViolation",
"stacktrace": [
"error: delete from \"note\" where \"id\" = $1 returning * - update or delete on table \"note\" violates foreign key constraint \"comment_noteid_foreign\" on table \"comment\"",
" at Parser.parseErrorMessage (/home/guhan/code/gql-postgress/web3/node_modules/pg-protocol/src/parser.ts:357:11)",
" at Parser.handlePacket (/home/guhan/code/gql-postgress/web3/node_modules/pg-protocol/src/parser.ts:186:21)",
" at Parser.parse (/home/guhan/code/gql-postgress/web3/node_modules/pg-protocol/src/parser.ts:101:30)",
" at Socket.stream.on (/home/guhan/code/gql-postgress/web3/node_modules/pg-protocol/src/index.ts:7:48)",
" at Socket.emit (events.js:198:13)",
" at Socket.EventEmitter.emit (domain.js:448:20)",
" at addChunk (_stream_readable.js:288:12)",
" at readableAddChunk (_stream_readable.js:269:11)",
" at Socket.Readable.push (_stream_readable.js:224:10)",
" at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)"
]
}
}
}
],
"data": {
"deleteNote": null
}
}
I am using postgres - 11.10 , node - v10.19.0 and created graphql project using "npm init graphback" command.
from graphback.
Related Issues (20)
- Headstart HOT 3
- Create Nest.js template HOT 22
- Project created by template contain invalid types - apollo-fullstack-react-mongo-ts HOT 4
- 'apollo-fullstack-react-mongo-ts' template breaks when a Comment is created HOT 3
- apollo-fullstack-react-postgres-ts template project error HOT 12
- Wrapping Resolver w/ Graphback? HOT 9
- Subscriptions not working in kafka template HOT 1
- When creating a new project with the command create-graphback it errors out HOT 2
- Preventing Leaking Through-Table Implementations
- Orderby Multiple Fields
- Codegen - TypeError: loader.loaderId is not a function HOT 3
- What does the release process look like? HOT 5
- Custom resolver "create" method types HOT 3
- buildGraphbackAPI errors with custom directives HOT 1
- Dependency Dashboard
- Schema generation error managing object's arrays. HOT 1
- Fragment generation produces invalid output on fields with parameters
- Current state of the project + compatibility with Vulcan
- Error when generating graphql files
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 graphback.