anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
231 stars 73 forks source link

ERROR 1067 (42000) at line 73: Invalid default value for 'datetime' #110

Open jhempy opened 5 years ago

jhempy commented 5 years ago

I receive this error when trying to import the scalar_store.sql file:

"ERROR 1067 (42000) at line 73: Invalid default value for 'datetime'"

Line 73 creates the scalar_db_rel_replied table:

"CREATE TABLE IF NOT EXISTS scalar_db_rel_replied ( parent_version_id int(10) unsigned NOT NULL DEFAULT '0', child_version_id int(10) unsigned NOT NULL DEFAULT '0', paragraph_num int(5) unsigned NOT NULL DEFAULT '0', datetime timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, KEY parent_child (parent_version_id,child_version_id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"

This is a new install on my Mac laptop. My PHP version is 7.1.23 and my MySQL version is 14.14.

I was able to complete the import by adding this line to the top of scalar_store.sql:

SET sql_mode = 'STRICT_TRANS_TABLES';

per instructions found here:

https://stackoverflow.com/questions/25349126/how-can-i-set-the-default-value-of-a-field-as-0000-00-00-000000

I'm not sure if that's a durable, practical, or correct fix, though. I'm just testing the install to see if this is a product I can install for my users.

loleary-uic commented 5 years ago

I am getting the same error using php 5.4 and mysql 5.7

craigdietrich commented 5 years ago

Hi @loleary-uic

Yeah, it seems "0000-00-00 00:00:00" is no longer a valid default value, or at least, for some versions or setups of MySQL it isn't.

Has the SET sql_mode = 'STRICT_TRANS_TABLES'; workaround, mentioned above, worked for you?

I haven't had a chance to look at this ticket any further. There's probably a simple solution (changing the default value to NULL, for example),

loleary-uic commented 5 years ago

What is the highest version of mysql that is supported by the latest release? What are you testing it on?

Thank you, Lisa

From: Craig Dietrich [mailto:notifications@github.com] Sent: Monday, September 23, 2019 3:49 PM To: anvc/scalar scalar@noreply.github.com Cc: Elliott Blake, Lisa Marie loleary@uic.edu; Mention mention@noreply.github.com Subject: Re: [anvc/scalar] ERROR 1067 (42000) at line 73: Invalid default value for 'datetime' (#110)

Hi @loleary-uichttps://github.com/loleary-uic

Yeah, it seems "0000-00-00 00:00:00" is no longer a valid default value, or at least, for some versions or setups of MySQL it isn't.

Has the SET sql_mode = 'STRICT_TRANS_TABLES'; workaround, mentioned above, worked for you?

I haven't had a chance to look at this ticket any further. There's probably a simple solution (changing the default value to NULL, for example),

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/anvc/scalar/issues/110?email_source=notifications&email_token=ANJCU562DWTHEPEMGBO4GKDQLETVJA5CNFSM4HRJV6WKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7MHC5Y#issuecomment-534278519, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANJCU53AZ6Y2TTETP4SDQ4LQLETVJANCNFSM4HRJV6WA.

craigdietrich commented 5 years ago

@loleary-uic Other than this (what I consider to be minor) issue, we haven't had any reports of any problems with old or new versions of MySQL / MariaDB. Meaning, I think it's fine up to and including the most recent versions of MySQL / MariaDB.

I'm running MariaDB 10.4.6 on my test environment.

loleary-uic commented 5 years ago

What about php?


From: Craig Dietrich notifications@github.com Sent: Monday, September 23, 2019 4:08 PM To: anvc/scalar scalar@noreply.github.com Cc: Elliott Blake, Lisa Marie loleary@uic.edu; Mention mention@noreply.github.com Subject: Re: [anvc/scalar] ERROR 1067 (42000) at line 73: Invalid default value for 'datetime' (#110)

@loleary-uichttps://github.com/loleary-uic Other than this (what I consider to be minor) issue, we haven't had any reports of any problems with old or new versions of MySQL / MariaDB. Meaning, I think it's fine up to and including the most recent versions of MySQL / MariaDB.

I'm running MariaDB 10.4.6 on my test environment.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/anvc/scalar/issues/110?email_source=notifications&email_token=ANJCU567AOAXH7FHEAE6JQDQLEV5TA5CNFSM4HRJV6WKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7MIYTY#issuecomment-534285391, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANJCU52LZAP5WWJHNTKTE6DQLEV5TANCNFSM4HRJV6WA.

craigdietrich commented 5 years ago

@loleary-uic No PHP restrictions as of Scalar v2.5.5