Giter Club home page Giter Club logo

Comments (6)

majimaccho avatar majimaccho commented on May 28, 2024

For now we can probably solve this issue by catching error below.

Raw query failed. Code: 55000. Message: `db error: ERROR: cannot delete from view

from redwood.

dac09 avatar dac09 commented on May 28, 2024

Thanks @majimaccho for the issue, and ofcourse the analysis behind it - much appreciated!

I would say let's wait to hear back from the Prisma team as views are still a preview feature, before we implement anything.

@cannikin - could I hand this over to you to track?

from redwood.

cannikin avatar cannikin commented on May 28, 2024

Hello! So your only concern at this point is the failing tests? Did you want to try and come up with a PR that addresses it? Until Prisma adds something to getDMMF() you could catch that error here: https://github.com/redwoodjs/redwood/blob/main/packages/testing/config/jest/api/jest.setup.js#L141-L156

You can see that we already expect some errors for foreign key relationships, you could add another catch block for the error you identified above.

from redwood.

majimaccho avatar majimaccho commented on May 28, 2024

@cannikin @dac09 Thank you for your kind and quick feedback.

Yeah, I already checked the jest.config.js and some error codes are catched and pushed to stack.

Of cause I can add something to catch the error.

However, the error code I got was below.

Raw query failed. Code: `55000`. Message: `db error: ERROR: cannot delete from view "pro_answer_all_values_view"
    DETAIL: Views that do not select from a single table or view are not automatically updatable.
    HINT: To enable deleting from the view, provide an INSTEAD OF DELETE trigger or an unconditional ON DELETE DO INSTEAD rule.`

According to PostgreSQL's documentation The error code 55000 is object_not_in_prerequisite_state and not specifically for the error deleting views.

So the easiest way to handle this issue is that I just add scripts to check if the entire error message starts with Raw query failed. Code: 55000. Message: db error: ERROR: cannot delete from view `.

It's just works on PostgreSQL but maybe not on MySQL or others.

from redwood.

cannikin avatar cannikin commented on May 28, 2024

Any solution we come up with will need to work with MySQL and SQLite as well...did you want to try applying your same schema to those two databases as well, running the tests, and adding those errors to the catch?

from redwood.

majimaccho avatar majimaccho commented on May 28, 2024

@cannikin
Yeah, I can take it if you give me some time (like in this year).

But for short term, I escaped from this problem by using INSTEAD OF DELETE trigger.

from redwood.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.