Manually added tables, sql help please

Zenphoto refused to install the basic tables to the database so I went through setup.php to find the mysql queries and added them manually. At the bottom of zp_images however was the code

$db_schema[] = "ALTER TABLE $tbl_images ".
"ADD CONSTRAINT $cst_images FOREIGN KEY (`albumid`) REFERENCES $tbl_albums (`id`) ON DELETE CASCADE ON UPDATE CASCADE;";

What is the sql query I convert this to assuming its needed?

Thank you

Comments

  • That is the sql you need to execute.

    But you might want to figure out why setup was not able to do the job as whatever it is may cause other problems within zenphjoto.
  • Chief Member
    The setup.php file had all the boxes ticked, the database was set up with sufficent priviliges but when it came to pressing go it wouldnt write the tables. I asked on the forum and the answer I got was it should have worked, it all seems to be working fine at the moment and I dont have any idea what could have been wrong as it should have worked from the beginning.
  • Chief Member
    Can you also help convert that statement into a sql query I can add to it. I get a syntax error which I assume is coming from the mix of php in there as well. Thank you
  • Chief Member
    ALTER TABLE 'mark_zenphoto'.'zp_images'
    ADD CONSTRAINT $cst_images FOREIGN KEY (albumid) REFERENCES 'mark_zenphoto'.'zp_albums' (id) ON DELETE CASCADE ON UPDATE CASCADE)

    This is as far as I've got but I know the syntax must be wrong. Also I dont understand what I would translate $cst_images to. Would it be 'mark_zenphoto'.'zp_images_ibjfk1'?

    // Prefix the constraint names:
    $cst_images = prefix('images_ibfk1');
  • if you run setup.php?debug it will create a setup_log.txt file that has all the SQL plus what result it got back if there was a failure. This would be interesting to see.
Sign In or Register to comment.