#1364 new
Kevin Watt

dm-timestamps creates invalid created_at if it starts as 0000-00-00 in an existing row

Reported by Kevin Watt | July 15th, 2010 @ 06:44 PM

class My
include DataMapper::Resource table_name 'udatas' property :id, Serial property :state, String property :created_at, DateTime end

add a row to the table with id=3 and created_at = 0000-00-00 (via terminal or by disabling dm-timestamps to add it?)

m=My.get(3) m.state='Washington' # to force something to be 'dirty' so an update happens m.save

results in:
~ Incorrect datetime value: '-0001-12-02 00:00:00' for column 'created_at' at row 1 (code: 1292, sql state: 22007, query: UPDATE udatas SET state = 'Washington', created_at = '-0001-12-02 00:00:00' WHERE id = 3, uri: mysql://localhost/ap)

Comments and changes to this ticket

  • Kevin Watt

    Kevin Watt July 15th, 2010 @ 06:47 PM

    allowing nulls and setting the row values to null instead is a workaround. I don't know, maybe this isn't important, perhaps 0000-00-00 should be considered an invalid date, and null required anyways.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages