django-add-default-value icon indicating copy to clipboard operation
django-add-default-value copied to clipboard

how can I set default current timestmp in mySQL

Open SuphattraT opened this issue 2 years ago • 0 comments

Dear Sir,

How can I set default current timestmp in mySQL? I want to have current timestamp in that field when the record is modilfied

I used below code but got error as below AddDefaultValue( model_name='my_model', name='my_column', value='NOW' ),

File "C:\Python310\lib\site-packages\MySQLdb\connections.py", line 254, in query _mysql.connection.query(self, query) django.db.utils.OperationalError: (1067, "Invalid default value for 'my_column'")

Regards, Oil

SuphattraT avatar Feb 26 '23 07:02 SuphattraT