The ORM takes care of index/FK DDL execution when running schema updates. Indexes and FKs are part of the mappings
Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 15 February 2014 23:44, Nima Sadjadi <[email protected]> wrote: > > I did use: orm:schema-tool:update --dump-sql > to update the database and I got messages that foreign and indices are set > and fixed. then I generated entities with > orm:convert-mapping --from-database php /src > and I expected in new entities there would be some info about foreign and > indices that later these entities can be used to install a database when > installing the script but there is no such infos, so when creating the > database based on entities, how the foreign/indices will be set in new > database? > > > > On Sat, Feb 15, 2014 at 6:01 AM, Marco Pivetta <[email protected]> wrote: > >> Yes, the schema can come from the entities directly (that's actually how >> you are supposed to use doctrine 2 ORM). >> You can just create a small "install" script that generates the database >> through the schema tool. >> >> Marco Pivetta >> >> http://twitter.com/Ocramius >> >> http://ocramius.github.com/ >> >> >> On 15 February 2014 03:00, Nima Sadjadi <[email protected]> wrote: >> >>> First i was worry to set foreign key and indexes correctly but now i >>> see this update tool does the job! :) so when mappings is finished i run >>> update tool to set foreign/indices in database then re-generate entities >>> (because the array things to define which fields as indices will be >>> outdated in entities (i am using php metadrive). Then move my mappings to >>> the new entities. Now when my end-user will create database by entities, >>> they have an updated database from start. Does it make sense? Or i am wrong? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "doctrine-user" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/doctrine-user. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "doctrine-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/doctrine-user. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
