Page MenuHomePhabricator

SecurePoll: Field 'el_owner' doesn't have a default value
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

What is the problem?

I cannot create a remote election on beta votewiki.

Trying to create an election "for" another wiki on beta votewiki, returns error:

[YFi6vKwQBHcAADrlYnEAAAAT] /wiki/Special:SecurePoll/create Wikimedia\Rdbms\DBQueryError: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 1364: Field 'el_owner' doesn't have a default value (172.16.3.206:3306)
Function: MediaWiki\Extensions\SecurePoll\Pages\CreatePage::processInput
Query: REPLACE INTO `securepoll_elections` (el_entity,el_title,el_ballot,el_tally,el_primary_lang,el_start_date,el_end_date,el_auth_type) VALUES (8,'Foobar Election 789','approval','plurality','en','20210323000000','20210324000000','local')

Backtrace:

from /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(1719)
#0 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(1703): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(1678): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(1244): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-master/includes/libs/rdbms/database/DatabaseMysqlBase.php(1367): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(3272): Wikimedia\Rdbms\DatabaseMysqlBase->doReplace(string, array, array, string)
#5 /srv/mediawiki/php-master/extensions/SecurePoll/includes/Pages/CreatePage.php(790): Wikimedia\Rdbms\Database->replace(string, array, array, string)
#6 /srv/mediawiki/php-master/includes/htmlform/HTMLForm.php(714): MediaWiki\Extensions\SecurePoll\Pages\CreatePage->processInput(array, OOUIHTMLForm)
#7 /srv/mediawiki/php-master/includes/htmlform/HTMLForm.php(604): HTMLForm->trySubmit()
#8 /srv/mediawiki/php-master/extensions/SecurePoll/includes/Pages/CreatePage.php(503): HTMLForm->tryAuthorizedSubmit()
#9 /srv/mediawiki/php-master/extensions/SecurePoll/includes/SpecialSecurePoll.php(70): MediaWiki\Extensions\SecurePoll\Pages\CreatePage->execute(array)
#10 /srv/mediawiki/php-master/includes/specialpage/SpecialPage.php(646): MediaWiki\Extensions\SecurePoll\SpecialSecurePoll->execute(string)
#11 /srv/mediawiki/php-master/includes/specialpage/SpecialPageFactory.php(1381): SpecialPage->run(string)
#12 /srv/mediawiki/php-master/includes/MediaWiki.php(309): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#13 /srv/mediawiki/php-master/includes/MediaWiki.php(925): MediaWiki->performRequest()
#14 /srv/mediawiki/php-master/includes/MediaWiki.php(547): MediaWiki->main()
#15 /srv/mediawiki/php-master/index.php(53): MediaWiki->run()
#16 /srv/mediawiki/php-master/index.php(46): wfIndexMain()
#17 /srv/mediawiki/w/index.php(3): require(string)
#18 {main}
Steps to reproduce problem
  1. Go to https://vote.wikimedia.beta.wmflabs.org/wiki/Special:SecurePoll/create
  2. In the "for wiki" dropdown, select "All wikis" (or any other wiki other than "this wiki")
  3. Fill in the rest of the form and submit
Environment

Wiki(s): https://vote.wikimedia.beta.wmflabs.org SecurePoll 2.0.0 (3242ab5) 07:37, 22 March 2021.

Event Timeline

N.B. This was working on beta version SecurePoll 2.0.0 (c7297c8) 07:32, 19 February 2021.

It was also reported that creating remote elections was working on 4th March (T276076#6884007), which is the date of the last change we made to the Create page. However, that might not have been on beta.

Change 675824 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):
[mediawiki/extensions/SecurePoll@master] SecurePoll: Field 'el_owner' doesn't have a default value

https://gerrit.wikimedia.org/r/675824

@dom_walden I tested for regressions but my local setup doesn't throw this error (it inserts a default value).

I'm a little confused by the absence of logic to ensure that the el_owner field has a valid local user ID, but that was an existing issue.

Change 675824 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] SecurePoll: Field 'el_owner' doesn't have a default value

https://gerrit.wikimedia.org/r/675824

I can now create remote elections on beta.

Test environment: https://vote.wikimedia.beta.wmflabs.org SecurePoll 2.0.0 (69d5f55) 06:38, 1 April 2021.