DoctrineHelper::updateSchema does not use the default values #524

Closed
phaidon opened this Issue Oct 10, 2012 · 19 comments

5 participants

@phaidon

If you add new columns to a database table by updateSchema the already existing values dont get the default values in the new columns.

DoctrineHelper::updateSchema($this->entityManager, array('Module_Entity_Entity'));

@phaidon

Especially in the case of doctrine arrays this is a problem. It breaks the module.

@ghost

This is a vendor issue and should be reported with the vendor. It might already be fixed upstream in a different version. We should probably upgrade Doctrine to the latest (bug fix version of the version we are using).

@ghost

Looks like we could update to 2.2, and maybe 2.3. It would be better if we did any major upgrade in 1.4. It's about time we bumped the major version.

@phaidon

The problem is that this bug makes the upgrade of modules impossible. So I think for the upgrade path it would be to fix it in 1.3.x.

@phaidon

@Guite @drak This is an very important issue. It makes the usage of DoctrineHelper::updateSchema impossible. I really would like to see it in 1.3.5!

@Guite
Zikula Project member

I've added a PR to upgrade Doctrine 2 to 2.3.0 and Doctrine Extensions in the 1.4 branch. I would not recommend adding this to 1.3.x because there are several incompatible changes, especially regarding Doctrine Extensions. Maybe someone could test the updateSchema() method with the 1.4 branch - just to see first if the upgrade would solve this problem or not. Maybe we can backport the corresponding piece of code.

@phaidon

there are several incompatible changes, especially regarding Doctrine Extensions

Is that somewhere documented?

@ghost

@Guite can you also update the VENDORS and CHANGELOG for 1.4 please?

@phaidon

The problem is still there with doctrine 2.3. This a big issue!

@espaan

This might also be why some modules have a hard time upgrading correctlly ?

@ghost

It simply means that if you are renaming a column, or changing a column type, you may have to use a migration strategy (create a temporary table, copy the data, then perform the table change and then migrate back your data). This is not something we can deal with in the Core.

@craigh
Zikula Project member

FTR, Doctrine does not recommend the use of updateSchema() in a production environment. Zikula should maybe consider constructing a module upgrade strategy that uses SQL or something to avoid the use of updateSchema() altogether.

@ghost
@craigh
Zikula Project member

SchemaTool can do harm to your database. It will drop or alter tables, indexes, sequences and such. Please use this tool with caution in development and not on a production server. It is meant for helping you develop your Database Schema, but NOT with migrating schema from A to B in production. A safe approach would be generating the SQL on development server and saving it into SQL Migration files that are executed manually on the production server.

SchemaTool assumes your Doctrine Project uses the given database on its own. Update and Drop commands will mess with other tables if they are not related to the current project that is using Doctrine. Please be careful!

(https://doctrine-orm.readthedocs.org/en/latest/reference/tools.html?highlight=updateschema#database-schema-generation)

@ghost
@phaidon

I changed the state from Bug to Note. It is not a Zikula bug, but it should stay in our memory.

@ghost ghost closed this Sep 8, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment