使用提示命令,我已经使用逆向工程生成了一个含有doctine的数据库。它的工作完美:error1833:无法更改列号
php app/console doctrine:mapping:convert yml ./src/Gir/DatabaseBundle/Resources/config/doctrine/metadata/orm --from-database --force
后,我创建了实体:
php app/console doctrine:mapping:import GirDatabaseBundle annotation
而且注释:
php app/console doctrine:generate:entities GirDatabaseBundle
然后,我安装Symfony的新更新composer.phar
。
然后,FOSUserBundle为了管理我的项目中的用户。
我不得不更新我用这个提示命令,以生成表用户及实体等主义与数据库:
php app/console doctrine:schema:update --force
当我做这个命令,学说就给我错误在Windows提示命令:
**[Doctrine\DBAL\DBALException]**
An exception occured while executing 'ALTER TABLE agence CHANGE id id INT NOT NULL':
SQLSTATE[HY000]: General error: 1833 Cannot change colum 'id': used in a foreign key constraint 'fk_employe_agence1' of table 'gir.employe'
**[PDOException]**
SQLSTATE[HY000]: General error: 1833 Cannot change colum 'id': used in a foreign key constraint 'fk_employe_agence1' of table 'gir.employe'
这年龄的SQL NCE表:
--
-- Base de données : `gir`
--
-- --------------------------------------------------------
--
-- Structure de la table `agence`
--
CREATE TABLE IF NOT EXISTS `agence` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(150) NOT NULL,
`nomVoie` varchar(150) NOT NULL,
`numVoie` int(5) DEFAULT NULL,
`codePostal` int(5) NOT NULL,
`comune` varchar(150) NOT NULL,
`telephone` varchar(150) NOT NULL,
`fax` varchar(150) NOT NULL,
`email` varchar(150) NOT NULL,
`entreprises_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`entreprises_id`),
KEY `fk_agence_entreprises1_idx` (`entreprises_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
这是雇工表的SQL:
--
-- Base de données : `enexgir`
--
-- --------------------------------------------------------
--
-- Structure de la table `employe`
--
CREATE TABLE IF NOT EXISTS `employe` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(45) NOT NULL,
`prenom` varchar(45) NOT NULL,
`poste` varchar(45) NOT NULL,
`portable` varchar(45) NOT NULL,
`ligneDirecte` varchar(45) NOT NULL,
`faxDirect` varchar(45) NOT NULL,
`email` varchar(150) NOT NULL,
`etat` tinyint(1) NOT NULL,
`agence_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`agence_id`),
KEY `fk_employe_agence1_idx` (`agence_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `employe`
--
ALTER TABLE `employe`
ADD CONSTRAINT `fk_employe_agence1` FOREIGN KEY (`agence_id`) REFERENCES `agence` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
应该有人为什么和如何教义解决这一问题?
转储到MySql的导入不起作用,我有这个'错误:操作符'<“保留供以后使用' – 2014-10-29 13:58:58
呃,是否有可能在Windows系统上试用这个?如果是这样,你使用正斜杠是否正确? (我真的不知道,我认为反斜杠是Windows系统上的目录分隔符。) – lxg 2014-10-29 17:37:35
无论如何,请尝试以下方法将转储传递给MySQL:http://stackoverflow.com/a/2148816/3908235 ('Get-Content ...')。 – lxg 2014-10-29 17:45:01