Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default value for entities.last_action (Trac #1562) #1562

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 13 comments

Comments

@elgg-gitbot
Copy link

commented Feb 16, 2013

Original ticket http://trac.elgg.org/ticket/1562 on 40162925-04-12 by trac user kkawahara, assigned to unknown.

Elgg version: 1.7

trying to setup a new 1.7RC1 installation. After filling out system settings and clicking next, the following error appears:

Field 'last_action' doesn't have a default value

QUERY: INSERT into elgg_entities
(type, subtype, owner_guid, site_guid, container_guid, access_id, time_created, time_updated) values
('site',0, 0, 0, 0, 2, 1267356443, 1267356443)

Checking the SQL create script (mysql.sql) shows this table with an additional column (last_action) and it does not have a default value assigned.

The update SQL in the entity class does not include this column:
(from entities.sql)
return insert_data("insert into {$CONFIG->dbprefix}entity_subtypes (type, subtype, class) values ('$type','$subtype','$class')");

Upgrading from a 1.6.1 installation seems to work fine.

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

cash wrote on 40163072-01-23

This brings up a point that I've been meaning to ask about: why was last_action added to the entities table? It doesn't seem to belong there and isn't used by anything.

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

davetosh wrote on 40163151-08-31

cash this is something we plan on using in the near future so seeing as v1.7 is all about core changes, we decided to put it in there now. At the moment, you can access objects by time_updated but it will also be handy to pull out objects ordered by the last action to be carried out on them such as comments, ratings etc.

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

trac user kkawahara wrote on 40165499-02-06

upgrade from 1.6 actually doesn't work - first time you try and do anything, the error shows up again (Field 'last_action' doesn't have a default value).

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

brettp wrote on 40166241-06-11

I see the potential problem but it's not causing an error for me. Can anyone else confirm this error?

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

trac user costelloc wrote on 40166390-05-07

I think kkawahara probably has the sql mode set to traditional. You can probably reproduce by issuing this command: set sql_mode = 'traditional' and then creating an entity.

http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

trac user kkawahara wrote on 40166652-02-28

mode is set to strict (STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION)

is there any documentation that describes the proper mode to be in?

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

brettp wrote on 40166716-12-18

This can be configured either per-instance or server-wide. To configure this at a per-instance level for Elgg, put this in engine/lib/database.php around line 62 (in 1.7), after the UTF8 call:

// Set DB for UTF8
mysql_query("SET NAMES utf8");
mysql_query("SET sql_mode = ''");

To configure for server wide, view Cash's link above.

I'm hesitant to add another SQL query to the init functions in Elgg Core, so this should be corrected on the server side. I will update the documentation for the installation requirements, though.

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

brettp wrote on 40166740-07-16

(In [svn:3981]) Refs #1562: Updated requirements for Elgg.

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

cash wrote on 40166761-09-16

If he is getting errors, I believe that means a warning is being thrown on every entity creation. Wouldn't a better fix be to set the default value or specify a value for the column in the create entity query?

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

brettp wrote on 40166786-07-09

Since column is completely unused in core, I'm fine putting a default value on it. I'd rather not touch all the update/create queries this late in 1.7's development.

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

Title changed from clean install of 1.7RC1 had incompatible table script/update syntax in class to Add default value for entities.last_action by brettp on 40166786-07-09

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

Milestone changed to Elgg 1.7 by cash on 40166868-05-03

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

brettp wrote on 40169162-10-29

(In [svn:3984]) Fixes #1562: Added a default value for entities.last_action in the schema and as an upgraded. Bumped version number to 1.7 final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.