Apache CakePHP-缺少数据库表

Apache CakePHP-缺少数据库表,apache,cakephp,Apache,Cakephp,所以我的服务器在本地机器上运行。这里一切正常,我只是想通过添加代理模型来扩展服务器的可能性。 然后我把所有的文件放到dev服务器上,使其在线可用——当我尝试转到“agencies”(domain.com/agents/)时,就会出现缺少数据库表的错误 我的电脑一切正常。 我已经检查了5次数据库中的所有名称是否正确。 我已经检查了cakephp中的database.cfg,但它一定很好——其他一切都在那里工作 请帮忙 更新 清除模型缓存没有帮助 以下是模型的代码: 无论何时对数据库进行任何更改,请

所以我的服务器在本地机器上运行。这里一切正常,我只是想通过添加代理模型来扩展服务器的可能性。 然后我把所有的文件放到dev服务器上,使其在线可用——当我尝试转到“agencies”(domain.com/agents/)时,就会出现缺少数据库表的错误

我的电脑一切正常。 我已经检查了5次数据库中的所有名称是否正确。 我已经检查了cakephp中的database.cfg,但它一定很好——其他一切都在那里工作

请帮忙

更新 清除模型缓存没有帮助

以下是模型的代码:
无论何时对数据库进行任何更改,请确保app/config/core.php文件调试值为2<代码>配置::写入('debug',2)

如果为0,则不会检测到数据库更改

这是因为在生产中,Cake缓存数据库结构,这样它就不必在每次页面加载时再次查询数据库。这很少是一个问题,因为您无论如何都应该在调试级别设置为2的情况下进行开发


所以,无论何时更改数据库,只要将其设置为2就行了。

问题解决了。我添加新表的数据库不是连接到dev服务器的数据库,而是连接到主站点的数据库。

数据库中是否有“agencies”表?如果agencies表确实存在;尝试清除位于
APP/tmp/cache/models
的模型缓存-这通常会清除奇怪的行为是的,我的数据库中确实有此表。我也清除了模型缓存:)什么也解决不了问题;我(猜测)您已经创建了
agenciesconnector
Agency
模型和适当的视图?当然我创建了-下面是消息:缺少数据库表错误:找不到模型代理的数据库表代理。在app/config/core.php文件中,它已经设置为Configure::write('debug',2);
<?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' => ''
    )
 );
}