Giter Site home page Giter Site logo

Comments (8)

doctrinebot avatar doctrinebot commented on August 16, 2024

Comment created by @beberlei:

which database version do yo uuse? can you paste an example schema?

from dbal.

doctrinebot avatar doctrinebot commented on August 16, 2024

Comment created by obrys:

This is example script with 2 testing entities.

from dbal.

doctrinebot avatar doctrinebot commented on August 16, 2024

Comment created by obrys:

I have attached script with two entities.

I have this database version:
$ mysql --version
mysql Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (i486) using readline 6.1

Check line 44. There is CASCADE.
Updating schema by: $ doctrine orm:schema-tool:update

Change CASCADE to NO ACTION
$ doctrine orm:schema-tool:update --dump-sql
ALTER TABLE ArticleItem DROP FOREIGN KEY ArticleItem_ibfk_1;
ALTER TABLE ArticleItem ADD FOREIGN KEY (articleGroupId) REFERENCES ArticleGroup(id) ON DELETE NO ACTION

everything ok, so: $ doctrine orm:schema-tool:update

Change NO ACTION to RESTRICT
$ doctrine orm:schema-tool:update --dump-sql
// no output!!

Change RESTRICT to CASCADE
$ doctrine orm:schema-tool:update --dump-sql
ALTER TABLE ArticleItem DROP FOREIGN KEY ArticleItem_ibfk_1;
ALTER TABLE ArticleItem ADD FOREIGN KEY (articleGroupId) REFERENCES ArticleGroup(id) ON DELETE CASCADE

everything ok, so: $ doctrine orm:schema-tool:update

Change CASCADE to RESTRICT
$ doctrine orm:schema-tool:update --dump-sql
ALTER TABLE ArticleItem DROP FOREIGN KEY ArticleItem_ibfk_1;
ALTER TABLE ArticleItem ADD FOREIGN KEY (articleGroupId) REFERENCES ArticleGroup(id) ON DELETE RESTRICT

everything ok, do: $ doctrine orm:schema-tool:update

Change RESTRICT to NO ACTION
$ doctrine orm:schema-tool:update --dump-sql
// no output!!

So there is no way to update database schema from RESTRICT to NO ACTION and reverse!

from dbal.

doctrinebot avatar doctrinebot commented on August 16, 2024

Comment created by @beberlei:

Hm you are right, however for MySQL NO ACTION is the same as RESTRICT as stated by http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html

from dbal.

doctrinebot avatar doctrinebot commented on August 16, 2024

Comment created by @deeky666:

[~obrys] As there internally is no difference between NO ACTION AND RESTRICT in MySQL I am closing this now. Doctrine generates the correct statements here when necessary.

from dbal.

doctrinebot avatar doctrinebot commented on August 16, 2024

Issue was closed with resolution "Invalid"

from dbal.

doctrinebot avatar doctrinebot commented on August 16, 2024

Imported 1 attachments from Jira into https://gist.github.com/479549bb5a53125657cc

from dbal.

github-actions avatar github-actions commented on August 16, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from dbal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.