Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 - doctrine:create in Production

When using the command:

$ php app/console doctrine:schema:create

We get this message

ATTENTION: This operation should not be executed in a production environment.

Why shouldn't we use it in production ?
How should we do the first deployment ?

like image 763
Pierre de LESPINAY Avatar asked Aug 14 '12 09:08

Pierre de LESPINAY


People also ask

What is doctrine repository?

A repository in a term used by many ORMs (Object Relational Mappers), doctrine is just one of these. It means the place where our data can be accessed from, a repository of data. This is to distinguish it from a database as a repository does not care how its data is stored.

What are doctrine proxies?

A Doctrine proxy is just a wrapper that extends an entity class to provide Lazy Loading for it. By default, when you ask the Entity Manager for an entity that is associated with another entity, the associated entity won't be loaded from the database, but wrapped into a proxy object.

What is doctrine library?

Please note. The ADF Doctrine Library is the single repository of doctrinal knowledge within Defence. Under CDF's direction doctrine has been unified under one hierarchy and in one repository; One Defence, One Doctrine.

What is Doctrine query?

Doctrine Query Language (DQL) is an Object Query Language created for helping users in complex object retrieval. You should always consider using DQL (or raw SQL) when retrieving relational data efficiently (eg. when fetching users and their phonenumbers).


1 Answers

Ahaha there are different schools for that.

  • Startup way: doctrine:schema:create first time in production, doctrine:schema:update --force every updates

  • Cautious way: dump sql first time, sql scripts then for updates

  • Expert way: http://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html

Personally I use the first method, which works just fine. You could always do a --dump-sql to see what's going on before updating using --force

like image 183
guillaumepotier Avatar answered Oct 24 '22 19:10

guillaumepotier