Comments (5)
Note that a fix for this will also create a proper fix fix for the issue in #24180.
from prisma.
If an
Unsupported()
column isGENERATED ALWAYS
(PostgreSQL)
That is generally not the intended use case for Unsupported()
, it was originally meant to only contain the name of the unsupported column to be created. That it allows spaces, and hence can be abused to create SQL that is after the column name is an 🥁🥁🥁 unsupported use case.
That being said, that Prisma reacts with removing a DEFAULT
on the next migration because there is no @default
on the field is weird. Your guess sounds reasonable:
My guess is that the data Prisma is getting from the shadow database indicates that the
textSearch
column has a default value (it'sGENERATED
, after all!), which Prisma interprets to mean that it has aDEFAULT
clause.
Probably our Introspection does not differentiate for columns that have an explicit DEFAULT
which could be dropped, vs. an implicit because of GENERATED ALWAYS AS
.
The direct fix for this problem would be to correctly differentiate here and not generate a migration that tries to drop the DEFAULT
that does not even exist.
from prisma.
And...it seems that Prisma refuses to add create
and createMany
to models with Unsupported()
columns--at least if the column doesn't have an @default
. If we were to add an @default
, though, it would be a problem.
So that's another related bug of Unsupported()
. No idea why Prisma wouldn't allow that column to be created using a string or a literal of some kind.
from prisma.
So that's another related bug of Unsupported(). No idea why Prisma wouldn't allow that column to be created using a string or a literal of some kind.
This is not a bug, this is how Unsupported
works. Prisma's Query Engine can not read or write and represent data of some types, so does not allow you to use the types - and Unsupported()
at least makes it possible to migrate those columns and use the models for some things.
from prisma.
Well, it kills this as a workaround for me. What I need is a "Custom()
" type or similar that acts like I'm using Unsupported()
but that allows me to create a column with a custom SQL string, and that just leaves it alone. Trust the developer to know how to use the type, and even to flag to Prisma that the type has an implicit default so that it won't demand that we provide that parameter to .create*
calls.
Or alternately, for me, real support for full text search on PostgreSQL. Failing that, I can't use Prisma.
At this point I'm investigating Prisma alternatives. I don't really have a choice.
from prisma.
Related Issues (20)
- Prisma generate option --allow-no-models doesn't work. HOT 1
- Truncate all tables and reset IDs HOT 1
- cannot create databases migrations on Windows HOT 2
- Create a DATABASE Import Export Option in Prisma Studio
- called `Option::unwrap()` on a `None` value HOT 4
- please make generate cli for multischema 제발
- createManyAndReturn include do not work with relations defined on other table HOT 1
- [SQLite] Bug in `prismaSchemaFolder`: Incorrect Database File Generation and Missing Table Error
- Selection with `_count: undefined` not working properly HOT 3
- No more enums generated HOT 1
- Create only is applying the migration
- Generic Types for Abstraction HOT 1
- Multi scheme for multi tenant architecture HOT 2
- API Key validations started failing over the last 24h HOT 1
- One model to multiple database schemas for multi-tenancy HOT 1
- @prisma/client is not in the npm registry, or you have no permission to fetch it.
- ConnectorError: 42P05 occurs frequently HOT 9
- Prisma relation query and connect behave strangely with composite relations
- prisma difficulty with accelerate HOT 1
- findMany returns integer instead of floats HOT 2
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 prisma.