[DC-655] When Export from Models to database is made some constraints may not be created Created: 29/Apr/10 Updated: 11/Jun/10 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Import/Export |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Oleg Stepura | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
FreeBSD 6.1, Apache 2.2.4, PHP 5.3.2, MySQL 5.0.41 |
||
| Description |
|
When exporting my schema from yaml I noticed that some CONSTRAINT are not created, but all the models are. After analyzing the code I found that an issue is not related to YAML but is related to Doctrine_Table::getExportableFormat(). I have models creation option to create it in PEAR-like style. So, when you have a schema like this: ---------------- Partner_Channel: Partner_Channel_Code: it generates sql like this: ---------------- But should also generate: ---------------- But if I just change the schema with this changes (notice the Channel changed to Shannel): ---------------- Partner_Shannel_Code: Everything is created. ---------------- So as I figured out is that when creating the tables alphabetic order has an influence on creating the CONSTRAINT for that Model in sql. I suppose line 715 of the Doctrine/Table.php near $key = $this->_checkForeignKeyExists(...) is operating, but I am not sure (when inserting into DB some tables are not created yet?). Do not know how to markup here, it's my first issue in Jira, please press "edit" to see the yaml code formatted |
| Comments |
| Comment by Oleg Stepura [ 29/Apr/10 ] |
|
Also what I noticed today is that this YAML schema: Partner_Channel: Does not add comment to the MySQL table when trying to do this through the cli build-all-load command. Neither the generated Model nor the exported sql chema have this option ('comment'). maybe this should be a different bug report... |
| Comment by Guilliam X [ 11/Jun/10 ] |
|
For your missing table comment, try nesting "comment" into "options", like this: YAML Partner_Channel:
tableName: partner_channel
options:
comment: List of channels.
— Now for the missing constraints issue, I confirm! See #DC-502 |
| Comment by Oleg Stepura [ 11/Jun/10 ] |
|
Hi! As for the comments - your decision seems like a workaround. Is it so or is it the way it should work? Do you know how this kind of stuff will work in 2.0 version? |