Git Product home page Git Product logo

prisma-string-datetime's Introduction

prisma-string-datetime

This is a minimal reproduction for inserting an array containing a mixture of regular strings and ISO 8601 formatted strings into a field of type String[].

As of Prisma Client v3.0.2, executing such a query throws a type validation error.

Running the reproduction

  1. Starting the database with docker-compose up.
  2. Apply the schema with npx prisma migrate dev
  3. Seed the database with npx prisma db seed.
  4. An error should be thrown.

The seed data

The file prisma/seed.ts contains 4 posts:

[
  {
    id: 1,
    words: ["hello", "world"],
  },
  {
    id: 2,
    words: ["2021-09-14T00:00:00.000Z"],
  },
  {
    id: 3,
    words: ["2021-09-14T00:00:00.000Z", "2021-09-20T12:00:00.000Z"],
  },
  {
    id: 4,
    words: ["hello", "2021-09-14T00:00:00.000Z"],
  },
];

Each post contains a different mixture of regular strings and ISO 8601 formatted strings.

  • Post 1 only has regular strings, this is of type List<String>
  • Post 2 contains a single datetime string, this is of type List<DateTime>
  • Post 3 contains multiple datetime strings, this is also of type List<DateTime>
  • Post 4 contains one of each, this is of type List<String | DateTime>

The first 3 posts are inserted successfully, and only post 4 fails.

prisma-string-datetime's People

Contributors

zhyuhan avatar

Watchers

 avatar

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.