doctrine:build-schema ignoring table columns

試著忘記壹切 提交于 2019-12-11 05:46:14

问题


I have a table called heading whose SHOW CREATE TABLE looks like this:

CREATE TABLE `heading` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `referenced_table_name` varchar(255) NOT NULL,
  `column_name` varchar(255) NOT NULL,
  `label` varchar(255) NOT NULL,
  `position` int(10) unsigned NOT NULL,
  `import_profile_id` bigint(20) NOT NULL,
  `note` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `referenced_table_name` (`referenced_table_name`,`column_name`,`position`,`import_profile_id`),
  KEY `import_profile_id` (`import_profile_id`),
  CONSTRAINT `heading_ibfk_1` FOREIGN KEY (`import_profile_id`) REFERENCES `import_profile` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=847 DEFAULT CHARSET=latin1

As you can see, it has some columns. Here's what doctrine:build-schema is all the sudden transforming this table into (it worked fine in the past):

Heading:
  connection: doctrine
  tableName: heading
  columns: {  }
  relations:
    ImportProfile:
      local: import_profile_id
      foreign: id
      type: one
    TotalFromFile:
      local: id
      foreign: heading_id
      type: many

No columns. WTF? For some reason, ONLY this table does this and it's only happening now. This is an old table! Any ideas?

I'm using MySQL on LAMP with symfony 1.4 and Doctrine 1.2.


回答1:


Turns out the problem was that I had defined HeadingTable::getTables() and HeadingTable::getColumns(). Doctrine didn't like that.




回答2:


Jason, I think your problem may be related to the schema getting generated from a truncated temp file. See the question and my answer here:

Symfony doctrine:build-model errors



来源:https://stackoverflow.com/questions/4218085/doctrinebuild-schema-ignoring-table-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!