Hello,

I am getting the following error when I try to run update.php:

Table 'samsonha_drpl1.imagecache_preset' doesn't exist query: SELECT * FROM imagecache_preset ORDER BY presetname in /home/samsonha/public_html/hairloss_info/sites/all/modules/imagecache/imagecache.module on line 826.

How do I create this table or get imagecache to create it for me. I'm not competent with mysql.

Comments

drewish’s picture

Status: Active » Needs work

was this a clean install or an upgrade?

drewish’s picture

Status: Needs work » Postponed (maintainer needs more info)

wrong status.

Aleet’s picture

Hello, I had a host of other issues with the site in question so I ended up deleting everyting and installed a fresh site from scratch. I have not had the same issue.

drewish’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

cool, well sounds like a fluke

DL Dunning’s picture

I was having a problem getting imagecache to work right. I tried various things, finally I tried to not just uninstall the imagecache and imageapi modules, but also to go into the MySQL db and remove the related tables. My bad, clearly. After reinstalling imagecache and imageapi, I'm getting the same missing table errors that crispy started this thread with. I've cleared all caches, run update.php, and so forth, to no avail. I'm not a programmer by any means, and I can't figure out how the imagecache_preset table gets created. The imagecache.install file seems the most likely source of this, but since I can't find a CREATE TABLE command in there or figure out how it calls the function from somewhere else, I'm stumped. My (uninformed) theory is that the imagecache module creates this table the very first time it's installed and sets a flag somewhere so that it doesn't create the table again on subsequent installs, and if I could just reset that flag it would create the missing table, but I'm quite stumped at this point. I may see quicksketch tonight here in PDX and pester him about this, but... HELP!

Eric Cosky’s picture

The imagecache.install defines a schema and when the module is installed or uninstalled it will pass this schema to functions that do the actual db commands.

function imagecache_schema() {
    $schema['imagecache_preset'] = array(
    'fields' => array(
      'presetid' => array(
        'description' => t('The primary identifier for an imagecache_preset.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),
      'presetname' => array(
        'description' => t('The primary identifier for a node.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE),
    ),
    'primary key' => array('presetid'),
  );

  $schema['imagecache_action'] = array(
    'fields' => array(
      'actionid' => array(
        'description' => t('The primary identifier for an imagecache_action.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),

//etc



/**
 * Implementation of hook_install().
 */
function imagecache_install() {
  drupal_install_schema('imagecache');
}

/**
 * Implementation of hook_uninstall().
 */
function imagecache_uninstall() {
  // Remove any cached images.
  $path = file_directory_path() .'/imagecache/';
  if (is_dir($path)) {
    _imagecache_recursive_delete($path);
  }

  drupal_uninstall_schema('imagecache');
}

I stumbled across this thread while trying to solve a similar problem which turned out to be simple file ownership issue related to having manually copied a /var/lib/mysql/drupaldb directory from a backup and not realizing the mysql user didn't own it. It was failing to install the tables from new modules as a result.

FWIW I recommend diving in and learning about drupal hooks, I felt a lot more comfortable with Drupal once I learned about them.

Cheers,

karlmc15’s picture

-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 09, 2010 at 07:59 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `vnopsec.vn`
--

-- --------------------------------------------------------

--
-- Table structure for table `imagecache_action`
--

CREATE TABLE `imagecache_action` (
`actionid` int(10) unsigned NOT NULL auto_increment,
`presetid` int(10) unsigned NOT NULL default '0',
`weight` int(11) NOT NULL default '0',
`module` varchar(255) NOT NULL,
`action` varchar(255) NOT NULL,
`data` longtext NOT NULL,
PRIMARY KEY (`actionid`),
KEY `presetid` (`presetid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `imagecache_action`
--
-- --------------------------------------------------------

--
-- Table structure for table `imagecache_preset`
--

CREATE TABLE `imagecache_preset` (
`presetid` int(10) unsigned NOT NULL auto_increment,
`presetname` varchar(255) NOT NULL,
PRIMARY KEY (`presetid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `imagecache_preset`
--

-- --------------------------------------------------------

--
-- Table structure for table `teaserthumbnail`
--

CREATE TABLE `teaserthumbnail` (
`nid` int(10) unsigned NOT NULL default '0',
`filepath` varchar(255) NOT NULL default '',
PRIMARY KEY (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `teaserthumbnail`
--

dravidian7’s picture

thanks karlmc15, running that in phpMyAdmin solved the problem.

michielkenis’s picture

Yes, the last solution worked! yiha