I tried to install this module in Drupal 7 but it failed and showed me this message:

"DatabaseSchemaObjectExistsException: Table contemplate_files already exists. in DatabaseSchema->createTable() (line 621 of C:\wamp\www\drupal\includes\database\schema.inc)."

Comments

thekevinday’s picture

I have this problem as well.

It turns out the installation works.

The problem is that the installer now seems to install the schema by default and this should not be manually done anymore.

So what needs to be changed is:

<?php
function contemplate_install() {
  drupal_install_schema('contemplate');
  db_query("UPDATE {system} SET weight = 10 WHERE name = 'contemplate'");
  drupal_set_message(st('Database tables for ConTemplate module have been installed.'));
}
?>

should changed to:

<?php
function contemplate_install() {
  db_query("UPDATE {system} SET weight = 10 WHERE name = 'contemplate'");
  drupal_set_message(st('Database tables for ConTemplate module have been installed.'));
}
?>

and the same goes for the uninstallation part:

<?php
function contemplate_uninstall() {
  drupal_uninstall_schema('contemplate');
  drupal_set_message(t('The ConTemplate tables have been removed from the database'));
}
?>

to

<?php
function contemplate_uninstall() {
  drupal_set_message(t('The ConTemplate tables have been removed from the database'));
}
?>
R2-D8’s picture

Doesn't work for me either

UPDATE:
After I had deleted the contemplate tables and patched contemplate.install as posted above it seems to be working now.

molave’s picture

Thanks R2-D8! Your solution worked like a charm.

Being a noob, though, and overly cautious, I didn't really delete the tables but only renamed them. Here's exactly what I did for future non-techies like me:

  1. After the error, visit the Modules page and disable Contemplate. The checkbox is within the CCK group and is called 'Content Templates'
  2. Using phpmyAdmin or whatever, rename the tables contemplate and contemplate_files to something like xx_contemplate etc... or what the heck, just nuke 'em if ya like.
  3. Edit the file sites/all/modules/contemplate/contemplate.install as detailed above, then re-upload
  4. Return to the Modules page and re-enable Contemplate.

That did it for me.

UPDATE:

Uh-oh, I think I celebrated too early. The above steps installed Contemplate, alright. But after creating my first pane, I did a test view and got the following error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'myuser_drupalsite.contemplate' doesn't exist: SELECT * FROM {contemplate} WHERE type = :type; Array ( [:type] => person ) in contemplate_get_template() (line 460 of /home/.../sites/all/modules/contemplate/contemplate.module).

So I guess it's back to the drawing board until I figure this out.

Thanks.

Alex8452’s picture

This works for me. I mean thekevinday's solution.

rosko’s picture

This took me a few turns. After the initial attempt didn't work I had to delete the contemplate tables and also remove it's entry from the system table. Then I followed the changes from thekevinday on the 2010-Sep-15 dev version. (I don't think it worked when I did his changes on the the alpha 1 2010-Jun-13 version). The module didn't present itself at the top level of Structure, but I did find its UI at http://site.com/#overlay=%3Fq%3Dadmin%252Fstructure%252Ftypes%252Ftemplates

dgtlmoon’s picture

Status: Active » Closed (duplicate)