zoukankan      html  css  js  c++  java
  • Prisma 2 is Coming Soon

    转自:https://www.prisma.io/blog/prisma-2-is-coming-soon-mwwfhevie993

    Prisma 2 will introduce many fundamental improvements. Making the Prisma server optional, an improved datamodel, better migrations, and a more powerful client API are only some of the upcoming features.

    TLDR

    Prisma 2 will introduce fundamental improvements:

    • Enabling usage of Prisma as a library without the need for the Prisma server.
    • Making Prisma workflows (accessmigratemanage) available as standalone tools.
    • Providing a stable foundation for fewer breaking changes and more flexibility.

    It will be released in early preview by Prisma Day, you can learn more about the release and upgrade process at the end of this article. Please join our RFC process and let us know what you think of our plans for Prisma 2.


    Goals of Prisma 2: Stability, observability & flexibility

    Since we released Prisma, we learned a lot about the use cases and preferences of our users. We also realized that (while we aim to move quickly) it was necessary to review and redesign Prisma's architectural core to account for our users' needs.

    We very much appreciate the feedback of our community members. Thank you so much for helping us to continuously enhance the Prisma experience!

    The next major release of Prisma will take into account all of our learnings. The main goals of the redesign were:

    • Removing limitations of Prisma 1 (e.g. making the Prisma server optional & more flexible data modelling, e.g. to define indexes or use custom database types).
    • Increasing visibility into how Prisma interacts with your database ("less magic").
    • Building a stable core to minimize breaking changes in the future.

    Making Prisma significantly easier to use

    We have worked hard to rethink how the Prisma experience can be simplified. The result was an entire rewrite of the Prisma core in Rust, bringing massive improvements to the way Prisma works.

    Using Prisma "as a library" by making the Prisma server optional

    With Prisma 2, you can use the Prisma client as a "simple library" (i.e. just a Node moduleor Go package) without the need of running a database proxy server via Docker.

    The Prisma server is a powerful tool for enterprise-grade use cases. However, the operational overhead it imposes can feel overwhelming, especially for newcomers that are just getting started with Prisma.

    We strongly believe that removing the need for the Prisma server will make it a lot easier for newcomers to get started with Prisma while simplifying the lives of existing users by removing a lot of operational burden.

    Rewriting Prisma in Rust

    Prisma 1 is implemented in Scala which means it needs to run in the JVM. To reduce the overhead of running Prisma, we decided to rewrite it in Rust.

    Benefits of Rust include a significantly lower memory footprint, better performance and no more need to deploy, monitor and maintain an extra server to run Prisma 2.

    Rust has shown to be the perfect language for Prisma, allowing us to write safe and extremely performant code.

    If you're interested, you can check out the alpha branch of our main prisma repo to explore the Rust rewrite.

    Easier incremental adoption via standalone tools

    Another common point of feedback is the difficulty of adopting Prisma incrementally in an existing project. While this is already possible with Prisma 1, so far Prisma used to be optimized for usage in greenfield projects.

    To make it easier to use Prisma in an existing project, we're making the main Prisma workflows, accessingmigrating and managing your data, available as standalone tools.

    This means you'll be able to adopt your favorite part of Prisma without changing your entire stack at once. For example, you can start using the Prisma client to simplify data access in your application but keep using your existing migration system.

    You can then gradually expand your usage of Prisma tools as you see fit and benefit of the seamless integrations.

    Prisma client: Type-safe relations & field selection

    The Prisma client features a powerful API which enables developers to access their database in a flexible and type-safe way.

    To improve the current API, we've added the possibility to retrieve scalar fields and (nested) relations in a type-safe way via select and include arguments. Here is a sneak peek of what the API for field selection and fetching relations looks like:

    // Explicitly select some fields (exclusive)
    const genres = await prisma.genres.findMany({
      first: 10,
      select: { id: true, name: true }
    })
    
    // Fetch all scalars and include first 10 tracks via relation
    const genresWithTracks = await prisma.genres.findMany({
      first: 10,
      include: {
        tracks: { first: 10 }
      }
    })
    
    COPY

    Other enhancements include support for lazy loading of scalar fields and relations as well as improved fallbacks to raw database queries. With Prisma 2, it will also become easier to get insights into the queries which the Prisma client sends to your database.

    To learn more about the upcoming API improvements, check out the RFCs for the JavaScript/TypeScript and the Go client API.

    More powerful & flexible schema migrations

    While providing a great developer experience, Prisma's current migration system has some limitations in more complex migration scenarios.

    The migration system in Prisma 2 will keep the simplicity and declarative nature while unlocking many migration scenarios that previously imposed a lot of overhead. It also is carefully designed to work in CI/CD environments.

    Prisma's declarative datamodel serves as the single source of truth for your database schema, codifying it in a universal modeling language. When changing your datamodel, Prisma 2 auto-generates migration scripts that you can execute to run a migration.

    Migrations can be extended with before/after hooks and are have a robust execution enginer where any failures will trigger automatic rollbacks.

    Prisma Admin available on Desktop & refined UI

    Prisma Admin has been greatly received by our community as a way to make it easier to view and edit the data in your database. In Prisma 2, Prisma Admin will become available as a desktop application that can connect to any database.

    Prisma 2 also adds some improvements to the user experience of Prisma Admin, for example by introducing:

    • A dedicated UI for filtering (see screenshot above)
    • An environment to run Prisma client code (REPL)
    • Support for embedded types

    An improved modelling syntax for your data

    With Prisma 1, the datamodel is based on GraphQL SDL syntax, a language originally designed to describe GraphQL APIs. While SDL is simple and intuitive, we've found that it's not the best tool for describing database schemas.

    Building upon SDL as a great foundation, we are introducing fundamental improvements to the Prisma datamodel syntax that will unlock your favorite database features in Prisma, for example:

    • Choosing specific column types
    • Defining indexes
    • Using lightweight expressions for default values

    Changes for existing SDL users will be minimal, while advanced use cases are covered by the powerful new features introduced in Prisma 2.

  • 相关阅读:
    Java设计模式之依赖倒置原则
    windows 下安装apache 遇到的问题
    Java序列化相关
    批量插入————优化
    接口相关
    Redis使用及工具类
    面试回顾——kafka
    面试回顾——List<T>排序
    Java面试——线程池
    面试回顾——session相关
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/10975972.html
Copyright © 2011-2022 走看看