When running the view following error is reported and the view is not displayed;
(using 6x-2X-dev of events module.

user warning: Unknown column 'event.unix_event_start' in 'field list' query: SELECT node.nid AS nid, node.title AS node_title, event.unix_event_start AS event_unix_event_start, DATE_FORMAT((FROM_UNIXTIME(event.unix_event_start) + INTERVAL 3600 SECOND), '%Y%m%d') AS event_unix_event_start_day FROM node node INNER JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN event event ON node.nid = event.nid WHERE (term_node.tid = 11) AND (event.unix_event_start >= 1269511732+3600) ORDER BY event_unix_event_start_day ASC LIMIT 0, 1 in /var/www/vhosts/oxaco-tennis.be/httpdocs/sites/all/modules/views/includes/view.inc on line 765.

sql code:

SELECT node.nid AS nid,
node.title AS node_title,
event.unix_event_start AS event_unix_event_start,
DATE_FORMAT((FROM_UNIXTIME(event.unix_event_start) + INTERVAL 3600 SECOND), '%Y%m%d') AS event_unix_event_start_day
FROM node node
INNER JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN event event ON node.nid = event.nid
WHERE (term_node.tid = 11) AND (event.unix_event_start >= ***CURRENT_TIME***+3600)
ORDER BY event_unix_event_start_day ASC

Comments

md2’s picture

Yea getting the same problem here. Using event_start or event_end breaks the view.

wintervanilla’s picture

Sure does! I had a custom fix for the event-views module running before this update, but now I'm having a hard time going back to that. I would definately appreciate a speedy fix on this one!!

Thanks,
Andrew

wintervanilla’s picture

UPDATE -- I was able to get this working by completely uninstalling the event_views module and then reinstalling it. For some reason (maybe a missing update script?), the columns "unix_event_start" and "unix_event_end" were not being created in the database.

Cheers,
Andrew

crystaldawn’s picture

Assigned: mark.luyten » crystaldawn

Hmmz good point. The old event_views must not have a schema and maybe that makes the new one think those fields exist. I am not that great with the new schema API and all of it's crazyness. It would be so much simpler if people would just make mysql the standard db ;) But I understand that more than 1 DB type is support so I'll just have to stumble around the api and figure out how to fix it using that. Not sure if update script would fix it or not since its not really an update to an existing schema since there was never one to begin with in the original version of this module. I'll have to look into that.

So for now the quick fix to get the new version of this module going is to simply disable the module, then once it's disabled, click the "uninstall" tab and "uninstall" it. Then simply re-enable the module and it will be ok. (It will complain that it cant find some fields, that is normal since they dont actually exist yet). But once you enable the module, it will indeed make the fields and thats all there is to do. You can then modify your views the way you need.

It should also be noted that this problem will ONLY exist if you were running the old D6 version of this module which didnt work at all with Views 2 unless u modified it. If you are running from a clean install that has never had the event_views module before, you should never run into this problem.

mark.luyten’s picture

Yes, uninstall solves the problem. But now the timezone problem pops-up. I'll open a new bug-report for that case.

crystaldawn’s picture

I've fixed up this problem. You can DL the new version or just plop this in the module and it'll fix it all up. I'm not sure how to utilize the drupal schema functions to see if fields actually exist or not, but this seems to take care of adding data to the fields and what not. If someone has better ideas on how to go about this, then I'd be interested in hearing it. I'm not sure how to use update files with drupal yet.

function event_views_init()
{
   //Quick hack to fix old installs.  This will eventually be taken out.
   if (!event_views_check_schema())
   {
      drupal_set_message("Note:  Event Views detected that you were very likely running the old version of event_views and has updated your DB tables with new fields required to use the new event_views module.");
   }
}

//This checks to see if fields we need actually exist.  If they dont, then re-run the install script.
function event_views_check_schema()
{
   if (db_column_exists('event', 'unix_event_start') && db_column_exists('event', 'unix_event_end'))
   {
      return TRUE;
   }

   require_once(drupal_get_path('module', 'event_views').'/event_views.install');
   event_views_install();
   return FALSE;
}
crystaldawn’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.