So I've got my server running on local machine. Everything is working there and I just wanted to extend the possibility of the server by adding an Agency model. Then I put all of the files to the dev server, to make it available online - and when I try to go to "agencies" (domain.com/agencies/) - Missing Database Table Error shows up.
Everything works fine on my computer. I've checked 5 times if all of the names in the database are correct. I've checked the database.cfg in the cakephp but it must be good - everything else is working there.
Please help!
Update
Clearing models cache didn't help
Here is the code of the model:
<?php
class Agency extends AppModel{
var $name = 'Agency';
var $validate = array(
'id' => array(
'blank' => array(
'rule' => array('blank'),
//'message' => 'Your custom message here',
//'allowEmpty' => true,
//'required' => true,
//'last' => false, // Stop validation after this rule
'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'company' => array(
'notempty' => array(
'rule' => array('notempty'),
//'message' => 'Your custom message here',
'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'website_url' => array(
'url' => array(
'rule' => array('url'),
//'message' => 'Your custom message here',
'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'status' => array(
'notempty' => array(
'rule' => array('notempty'),
//'message' => 'Your custom message here',
'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'profession_id' => array(
'multiple' => array(
'rule' => array('multiple', array('min' => 1)),
'message' => 'Please select at least 1 profession',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'seniority_id' => array(
'multiple' => array(
'rule' => array('multiple', array('min' => 1)),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'industry_id' => array(
'multiple' => array(
'rule' => array('multiple', array('min' => 1)),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'sector_id' => array(
'multiple' => array(
'rule' => array('multiple', array('min' => 1)),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'zone_id' => array(
'multiple' => array(
'rule' => array('multiple', array('min' => 1)),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'size' => array(
'notempty' => array(
'rule' => array('notempty'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
)
);
var $hasAndBelongsToMany = array(
'Profession' => array(
'className' => 'Profession',
'joinTable' => 'agencies_professions',
'foreignKey' => 'agency_id',
'associationForeignKey' => 'profession_id',
'unique' => true,
//'conditions' => '',
//'fields' => '',
//'order' => ''
),
'Seniority' => array(
'className' => 'Seniority',
'joinTable' => 'agencies_seniorities',
'foreignKey' => 'agency_id',
'associationForeignKey' => 'seniority_id',
'unique' => true,
//'conditions' => '',
//'fields' => '',
//'order' => ''
),
'Industry' => array(
'className' => 'Industry',
'joinTable' => 'agencies_industries',
'foreignKey' => 'agency_id',
'associationForeignKey' => 'industry_id',
'unique' => true,
//'conditions' => '',
//'fields' => '',
//'order' => ''
),
'Sector' => array(
'className' => 'Sector',
'joinTable' => 'agencies_sectors',
'foreignKey' => 'agency_id',
'associationForeignKey' => 'sector_id',
'unique' => true,
//'conditions' => '',
//'fields' => '',
//'order' => ''
),
'Zone' => array(
'className' => 'Zone',
'joinTable' => 'agencies_zones',
'foreignKey' => 'agency_id',
'associationForeignKey' => 'zone_id',
'unique' => true,
//'conditions' => '',
//'fields' => '',
//'order' => ''
)
);
var $hasMany= array(
'Office' => array(
'className' => 'Office',
'foreignKey' => 'office_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => ''开发者_开发百科,
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
}
Update
The debug was set to 2 from the very beginning because it is a dev server.
Update
It is not a matter of lower/upper case names.
Whenever you make any changes to your database, please make sure that your app/config/core.php file debug value is 2. Configure::write('debug', 2);
If it is 0 database changes will not be detected.
This is because in production Cake caches the database structure so that it doesn't have to query the db again at every page load. This is rarely a problem because you should develop with debug level set to 2 anyway.
So whenever you change your database just make it 2 once.
Problem solved. The database I was adding new tables was not the one connected to the dev server, but to the main site.
精彩评论