Author Topic: Missing Database Table Error  (Read 938 times)

0 Members and 1 Guest are viewing this topic.

Offline cluelessnoobTopic starter

  • Irregular
  • Posts: 15
    • View Profile
Missing Database Table Error
« on: August 17, 2009, 08:51:04 PM »
I get this error when I try to load the scaffold view.
I have tables called artists and comics in the comic database and models
call artist.php and comic.php. i have no idea what I'm doing wrong.

Missing Database Table

Error: Database table artists_comics for model ArtistsComic was not found.

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,256
    • View Profile
Re: Missing Database Table Error
« Reply #1 on: August 17, 2009, 08:52:18 PM »
Going to need allot more information than that I'm afraid. You might at least tell us what framework your talking about.

Offline cluelessnoobTopic starter

  • Irregular
  • Posts: 15
    • View Profile
Re: Missing Database Table Error
« Reply #2 on: August 17, 2009, 09:14:12 PM »
Sorry I've been at this for too long. I'm using Cakephp. I have a database called comicdb and a tables called comics and artist. I have a model and controller for called comic and comics_controller respectively. As well as similarly named models and controllers for my six tables. the comics table has a foreign key for each table here is the code for the model:
Code: [Select]
<?
 class Comic extends AppModel {
 var $name = 'Comic';
 var $belongsTo = array('User');
var $hasOne = array(
        'Artist',
        'Author',
        'Rating',
        'Publisher'
);
 }
 ?>

and the controller:
Code: [Select]
<?
 class ComicsController extends AppController {
 var $name = 'Comics';
 var $scaffold;
 }
?>

I'm not sure what other information might be necessary.
« Last Edit: August 17, 2009, 09:14:59 PM by cluelessnoob »

Offline jcombs_31

  • Guru
  • Addict
  • *
  • Posts: 2,426
    • View Profile
    • My Blog
Re: Missing Database Table Error
« Reply #3 on: August 18, 2009, 07:36:12 AM »
artists_comics would be a join table for... you guessed it, artists and comics.  The join table would be for a hasAndBelongsToMany relationship, which is a many to many relationship. 

Without more information about your database and model creations it is hard to see where you went wrong.  What does your artist model look like?

Do you have a join table?  Is it a many to many relationship?