Today, we are excited to share the 2.19.0
stable release 🎉
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements & new features
Prisma Migrate is now ready for General Availability 🚀
We are excited to announce that Prisma Migrate enters General Availability. You can learn more about the launch in the announcement article.
There are no major changes to how Prisma Migrate works except that the --preview-feature
flag is being removed:
Before v2.19.0
npx prisma migrate <COMMAND> --preview-feature
# for example:
npx prisma migrate dev --preview-feature
Now
npx prisma migrate <COMMAND>
# for example:
npx prisma migrate dev
Besides making Prisma Migrate ready for production in this release, it comes with a number of smaller fixes and improvements:
- After
migrate dev
,migrate reset
anddb push
, generation is always triggered to avoid issues where the Prisma Client API is outdated due to changes in relation names which have an impact on the database schema (GitHub issue) - Improve UX when
migrate dev
produces warnings (GitHub issue) - Better error when adding a new required field and the default value is Prisma-level, e.g.
uuid()
- Small improvement where Prisma Migrate failed to create the database on DigitalOcean
- Bugfix: Fix a bug when there are foreign keys referencing missing tables that resulted in a crash
- Bugfix: Improvement when changing a field from type String to Enum (MySQL, PostgreSQL)
- Bugfix: Improvement when migrating enums and a default enum value is defined (PostgreSQL)
📚 Documentation:
Order by aggregates of relations in Prisma Client queries (Preview)
This release makes it possible to order by the aggregates (e.g. count) of relations in your Prisma Client queries. Here's is an example that orders a list of users by the number of the posts they created:
const orderedUsers = await prisma.user.findMany({
orderBy: {
posts: {
count: 'asc'
}
}
})
This feature is released in Preview which means you have to explicitly enable it via the orderByRelation
feature flag in your Prisma schema:
generator client {
provider = "prisma-client-js"
previewFeatures = ["orderByRelation"]
}
Don't forget to run npx prisma generate
after you've added the feature flag to your Prisma schema so that the Prisma Client API gets updated accordingly.
Prisma Client Go now returns results from the Transaction
API
Previously in the Go Client, you could write data within a transaction, but you couldn't get the results back from the transaction. Now you can! Learn more in the documentation.
Fixes and improvements
Prisma Client
- Order by relation aggregate (like count)
- when quering, passing string to DateTime field results runtime error
- Log streaming interface for n-api
- Add TypeScript version check
- Do not know how to serialize a BigInt in executeRaw
- TypeError when using
npx prisma generate
with custom engine binaries - MICROSOFT SQL CONNECTOR - CONNECTION LIMIT
- Default
pool_timeout
value hides connect timeouts
Prisma Migrate
- Error: [introspection-engine/connectors/sql-introspection-connector/src/misc_helpers.rs:417:72] called
Option::unwrap()
on aNone
value - Environment is “non-interactive” when using
prisma migrate dev
- Unclear error message when using prisma-level default functions (cuid, uuid) as default for non-nullable fields
- Change enum values when there is a default enum value fails migration
- Error: Error in migration engine. Reason: [libs/sql-schema-describer/src/walkers.rs:329:18] foreign key references unknown table: "Game"
- Prisma
migrate dev
prompts for migration name when running after --create-only - Error: Error in migration engine. Reason: [migration-engine/connectors/sql-migration-connector/src/sql_renderer/sqlite_renderer.rs:229:45] not implemented: text
- Unformatted error message from
introspect
when env var contains wrong connection string protocol - SQL Server: recursive error message "Error querying the database"
- Prisma migrate - always reporting Data loss / migration file changed even with simple field addition
- Detect usage of supported types in Unsupported("..")
- Feedback on migrate command names
- Migration fails creating new database on Managed DO Postgres
- "Database error: Error querying the database: db error: ERROR: type "citext" does not exist" but citext extension enabled
- ME crash: foreign key references unknown table
- Migrate does not recognize changes made to a field of type String to ENUM
- Postgres Introspection occasionally removes "Unique" Constraint
- Docs: Migrate advisory locking mechanism
- Write test repro for "We assume an internally valid datamodel before mutating." from example schema
- Can't convert
String
field toEnum
in a migration - Postgres - Review CLI help outputs / flags
- Error: Error in migration engine. Reason: [libs\datamodel\core\src\transform\attributes\unique_and_index.rs:149:46] called
Result::unwrap()
on anErr
value: TypeMismatchError { expected_type: "constant literal", received_type: "string", raw: "tenantId", span: Span { start: 6221, end: 6231 } } - error report id: 13104
- Ensure we run generate after
db push
andmigrate dev
even if the changes result in no database schema changes - Improve readability of data loss warnings when running
migrate dev
Language tools (e.g. VS Code)
Prisma Studio
Credits
Huge thanks to @endor, @iBluemind, @meeq for their help in this release! ✨
💼 Learn about Enterprise use cases of Prisma on March 25th
We hope you join us for the upcoming Prisma Enterprise Event on Thursday, March 25th which is centered around the following topics:
- Learn how top companies are addressing the challenges of data at scale
- Discover how companies use Prisma to make their developers more productive
- Get a better understanding of the future of data in the enterprise
📺 Join us for another "What's new in Prisma" livestream
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" livestream.
The stream takes place on Youtube on Thursday, March 18 at 5pm Berlin | 8am San Francisco.