question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MySQL `time` type not working

See original GitHub issue

SQL

CREATE TABLE `User` (
	id integer PRIMARY KEY,
	time time,
);

Prisma Schema

model User {
  id        Int       @id
  time      DateTime?
}

Code

const date = new Date('2015-01-01T00:00:00Z')

const data: UserCreateInput = {
	id: 1,
	date: date,
	datetime: date,
	time: date,
	timestamp: date,
}

await client.user.create({
	data,
})

reproduction available at https://github.com/prisma/datetime-experiments

ConnectorError(ConnectorError { user_facing_error: None, kind: ConversionError(Custom { kind: InvalidData, error: "DateTime value not stored as datetime, int or text" }

   0: backtrace::backtrace::trace
   1: backtrace::capture::Backtrace::new_unresolved
   2: failure::backtrace::internal::InternalBacktrace::new
   3: <failure::backtrace::Backtrace as core::default::Default>::default
   4: sql_query_connector::row::row_value_to_prisma_value
   5: <quaint::connector::result_set::result_row::ResultRow as sql_query_connector::row::ToSqlRow>::to_sql_row
   6: <std::future::GenFuture<T> as core::future::future::Future>::poll
   7: <std::future::GenFuture<T> as core::future::future::Future>::poll
   8: std::future::poll_with_tls_context
   9: <std::future::GenFuture<T> as core::future::future::Future>::poll
  10: <std::future::GenFuture<T> as core::future::future::Future>::poll
  11: <std::future::GenFuture<T> as core::future::future::Future>::poll
  12: <std::future::GenFuture<T> as core::future::future::Future>::poll
  13: <std::future::GenFuture<T> as core::future::future::Future>::poll
  14: <std::future::GenFuture<T> as core::future::future::Future>::poll
  15: <std::future::GenFuture<T> as core::future::future::Future>::poll
  16: <std::future::GenFuture<T> as core::future::future::Future>::poll
  17: std::future::poll_with_tls_context
  18: <std::future::GenFuture<T> as core::future::future::Future>::poll
  19: <std::future::GenFuture<T> as core::future::future::Future>::poll
  20: std::panicking::try::do_call
  21: __rust_maybe_catch_panic
  22: <std::future::GenFuture<T> as core::future::future::Future>::poll
  23: tokio::task::core::Core<T>::poll
  24: std::panicking::try::do_call
  25: __rust_maybe_catch_panic
  26: tokio::task::harness::Harness<T,S>::poll
  27: tokio::runtime::thread_pool::worker::GenerationGuard::run_task
  28: tokio::runtime::thread_pool::worker::GenerationGuard::run
  29: std::thread::local::LocalKey<T>::with
  30: tokio::runtime::thread_pool::worker::Worker::run
  31: tokio::task::core::Core<T>::poll
  32: std::panicking::try::do_call
  33: __rust_maybe_catch_panic
  34: tokio::task::harness::Harness<T,S>::poll
  35: tokio::runtime::context::enter
  36: std::sys_common::backtrace::__rust_begin_short_backtrace
  37: std::panicking::try::do_call
  38: __rust_maybe_catch_panic
  39: core::ops::function::FnOnce::call_once{{vtable.shim}}
  40: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
  41: std::sys::unix::thread::Thread::new::thread_start
  42: _pthread_start
) })

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
ghyath5commented, Mar 24, 2021

Well, I will

1reaction
tomhoulecommented, Mar 24, 2021

Hmm this is a different bug then, we should look into it. Can you open an issue? 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

MySQL 8.0 Reference Manual :: 11.2 Date and Time Data Types
MySQL permits you to store dates where the day or month and day are zero in a DATE or DATETIME column. This is...
Read more >
Time data type not working when creating a table
I'm trying to create a table and one of the columns is of the data type time. But whenever I run it to...
Read more >
Mastering MySQL TIME Data Type
This tutorial helps you master MySQL TIME data type quickly and introduces some useful temporal functions to manipulate MySQL TIME values.
Read more >
MySQL data types | Introduction | Prisma's Data Guide
An introduction to MySQL data types. CONTENT. Introduction; Numbers and numeric values; String types; Booleans; Dates and time; Timestamps and datetime; Other ...
Read more >
MySQL Date Data Type - GeeksforGeeks
The DATE type is used for values with a date part but no time part. ... Last_name VARCHAR (100) NOT NULL, Date_Of_Birth DATE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found