News:

Wondering if this will always be free?  See why free is better.

Main Menu

Field 'id_reporter' doesn't have a default value

Started by Ramón Cutanda, March 21, 2019, 05:51:06 PM

Previous topic - Next topic

albertlast

What is the primary key at the moment in this table?

Quote from: Sir Osis of Liver on March 28, 2019, 06:05:18 PM
Well, apparently it worked for OP.  Will it break something else?
in the worst case the table got no pk atm,
than no index stuff is working(mysql use pk index as primary index for his other indexes) and since it got no pk,
any pk related call goes wild,
so yes it's hurt.

albertlast

in the setup file of 2.0 you find this column:

CREATE TABLE {$db_prefix}log_reported (
  id_report mediumint(8) unsigned NOT NULL auto_increment,
  id_msg int(10) unsigned NOT NULL default '0',
  id_topic mediumint(8) unsigned NOT NULL default '0',
  id_board smallint(5) unsigned NOT NULL default '0',
  id_member mediumint(8) unsigned NOT NULL default '0',
  membername varchar(255) NOT NULL default '',
  subject varchar(255) NOT NULL default '',
  body text NOT NULL,
  time_started int(10) NOT NULL default '0',
  time_updated int(10) NOT NULL default '0',
  num_reports mediumint(6) NOT NULL default '0',
  closed tinyint(3) NOT NULL default '0',
  ignore_all tinyint(3) NOT NULL default '0',
  PRIMARY KEY (id_report),
  KEY id_member (id_member),
  KEY id_topic (id_topic),
  KEY closed (closed),
  KEY time_started (time_started),
  KEY id_msg (id_msg)
) ENGINE=MyISAM;


2.1 is similiar:

CREATE TABLE {$db_prefix}log_reported (
id_report MEDIUMINT UNSIGNED AUTO_INCREMENT,
id_msg INT(10) UNSIGNED NOT NULL DEFAULT '0',
id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0',
id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
membername VARCHAR(255) NOT NULL DEFAULT '',
subject VARCHAR(255) NOT NULL DEFAULT '',
body MEDIUMTEXT NOT NULL,
time_started INT(10) NOT NULL DEFAULT '0',
time_updated INT(10) NOT NULL DEFAULT '0',
num_reports MEDIUMINT NOT NULL DEFAULT '0',
closed TINYINT NOT NULL DEFAULT '0',
ignore_all TINYINT NOT NULL DEFAULT '0',
PRIMARY KEY (id_report),
INDEX idx_id_member (id_member),
INDEX idx_id_topic (id_topic),
INDEX idx_closed (closed),
INDEX idx_time_started (time_started),
INDEX idx_id_msg (id_msg)
) ENGINE={$engine};

Sir Osis of Liver

Maybe I'm missing something, but original post displays error for id_reporter.  There is no id_reporter field in _log_reported, or in the code you posted.

Quote from: videoed on March 21, 2019, 05:51:06 PM
I have recently upgraded from 2.0.15 to 2.1 RC1. The report funcion doesn't work. I get this error:
Field 'id_reporter' doesn't have a default value
File: /var/www/vhosts/videoedicion.org/httpdocs/foro/Sources/ReportToMod.php
Line: 303

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shawnb61

Yes, I'd been thinking this column was added by a mod all this time.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

albertlast

okay... than you can proceed with the default solution...

Arantor

Here was me thinking you'd checked the schema and it should be PK/AI :P (I don't remember enough of the schema any more, I have my own that's quite a bit different)

shawnb61

videoed -

It may help if you post the db structure for the table in question.  You can either export it from phpmyadmin or take a screenshot.

Thx,

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Ramón Cutanda

First of all, I really want to thank all the people involved in this thread. I REALLY APPRECIATE your dedication. It has been my fault all the time. I am really sorry. This is what finally made me realise what has been going on all of this time:

Quote from: Sir Osis of Liver on March 28, 2019, 06:35:24 PMMaybe I'm missing something, but original post displays error for id_reporter.  There is no id_reporter field in _log_reported, or in the code you posted.

1. Before I moved to 2.1 RC1 I was using the mod you will find attached.

2. That mod added the "id_reporter" field described in this error.

3. That mod no longer works on SMF 2.1 RC1 and, when uninstalling, it DOES NOT REMOVE the added "id_reporter" field that triggers the error that initiated this thread.

When I recreated the table using the template from the original installer I solved the problem. But I have been facing several problems with my most needed mods after upgrading to SMF 2.1 RC1, so I have been installing/uninstalling mods frequently and in different order just to check if I could make them work. At some point, I must have tried to reinstall the "report mod" again, recreating the problem.
I am sorry for not having made that association any sooner and causing all this trouble. I really appreciate your interest in this matter.

All the best,

Kindred

yes, traditionally, mods do not remove created tables or columns on uninstall -- unless the author has properly built the mod to give you the option (which most mod authors do not do) -- and even then, it does so only if you specifically tell it to do so.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: