prisma-test-utils
prisma-test-utils copied to clipboard
PANIC: invalid or out-of-range date for type timestamp
According to the MySQL docs: The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
test-utils
however is not aware of this limitation as this information is lost in the Prisma schema (timestamp
is mapped to Prisma type DateTime
).
A potential solution in test-utils
can be to cap all date time types to the smaller date time range of all the underlying types (in my understanding that is indeed timestamp)
Internal notes:
Test utils database(s) affected:
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_frontaccounting_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_matomo_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_movielens_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_openclassifieds_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_phplist_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_thinkadmin_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_vanilla_stderr.log
- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_worldservantsdoetinchem_stderr.log
Related issue: https://github.com/prisma/prisma-test-utils/issues/20
I don't know how Jan was able to make Sakila run, in my automated tests, it fails on the generate step. The underlying field there is timestamp
but the error is slightly different. Maybe it morphed.
A potential solution in
test-utils
can be to cap all date time types to the smaller date time range of all the underlying types
That sounds like the right thing to do here. Creating timestamps in that date range should be simple enough.
A potential solution in test-utils can be to cap all date time types to the smaller date time range of all the underlying types
Added this in a test-utils branch. Update (will move this content to its respective place/issue tomorrow!):
-
SUCCESS
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_movielens_stderr.log
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_thinkadmin_stderr.log
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_openclassifieds_stderr.log
-
Invalid response data: the query result was required, but an empty Object((Weak)) was returned instead.
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_frontaccounting_stderr.log
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_phplist_stderr.log
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_vanilla_stderr.log
-
ConversionError(Custom { kind: InvalidData, error: "DateTime value not stored as datetime, int or text"
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_matomo_stderr.log
-
ForeignKeyConstraintViolation { constraint: Fields(["page_id"]) } })
-
-- https://github.com/prisma/introspection-engine-output/blob/test_utils/test-utils/results/mysql_public_test_utils_worldservantsdoetinchem_stderr.log
Looks like this issue is effectively resolved.