Page MenuHomePhabricator

Challenge extension is using zero date in own schema and failing in strict mode
Closed, ResolvedPublic

Description

Since the CI is running mysql in strict mode (T119371) the tests for this extension fails with:
Error: 1067 Invalid default value for 'challenge_accept_date'

The problem is '0000-00-00 00:00:00' as default value on a datetime type.
mediawiki/core is using varchars for timestamps (as done on challenge_event_date)

CREATE TABLE /*_*/challenge (
  challenge_id int(11) NOT NULL PRIMARY KEY auto_increment,
  -- Challenger
  challenge_user_id_1 int(11) NOT NULL default 0,
  challenge_username1 varchar(255) NOT NULL default '',
  -- Challenged
  challenge_user_id_2 int(11) NOT NULL default 0,
  challenge_username2 varchar(255) NOT NULL default '',
  challenge_info varchar(200) NOT NULL default '',
  challenge_event_date varchar(15) NOT NULL default '0000-00-00',
  challenge_description text,
  challenge_win_terms varchar(200) NOT NULL default '',
  challenge_lose_terms varchar(200) NOT NULL default '',
  challenge_winner_user_id int(11) NOT NULL default 0,
  challenge_winner_username varchar(255) NOT NULL default '',
  challenge_status int(11) NOT NULL default 0,
  -- The following two fields appear to be currently unused but were used in
  -- the past by Special:ChallengeAction...the question is: should we drop these
  -- or bring them back?
  challenge_accept_date datetime NOT NULL default '0000-00-00 00:00:00',
  challenge_complete_date datetime NOT NULL default '0000-00-00 00:00:00',
  challenge_date varbinary(14) NOT NULL default ''
)/*$wgDBTableOptions*/;