Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6195055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:24:05+00:00 2026-05-24T03:24:05+00:00

Here is a situation i could not resolve by myself. I have an existing

  • 0

Here is a situation i could not resolve by myself.

I have an existing symfony 1.4 project with database, model and etc. I want to make a migration so I’ve done:

./symfony cc
./symfony doctrine:generate-migrations-db
./symfony doctrine:generate-migrations-model

All classes for the migration were created, so I’ve tried to apply the migration by:

./symfony doctrine:drop-db
./symfony doctrine:build-db
./symfony doctrine migrate

And the migration proccess crashes. It thros an error:

- SQLSTATE[1005]: General error: 1005 Can't create table 'database.#sql-6df_301' (errno: 150). Failing Query: "ALTER TABLE product ADD CONSTRAINT "product_product_group_id_product_group_id FOREIGN KEY (product_group_id) REFERENCES product_group(id) ON DELETE CASCADE

This is strange. I have more tables with relations and they are created, but that one fails. I’ve check everything i can think of. The indexes types, the table types, the phase of the moon – everything seems to be OK. I’ve try to SET FOREIGN_KEY_CHEKS=0 to chase some ghosts, but NADA!

The error still occures.

Does anybody knows what is happening or a kind of solution?

Any suggestion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:24:07+00:00Added an answer on May 24, 2026 at 3:24 am

    I’ve cracked it up.

    In a some hilarious reason the auto-generated migration classes are named like this:

    1311678541_add<table-name>.php
    1311678542_add<table-name>.php
    1311678543_add<table-name>.php
    ...
    13116785578_addfks.php
    ...
    1311678579_add<table-name>.php
    1311678580_add<table-name>.php
    1311678582_addproductgroup.php
    

    The 13116785578_addfks.php file appears before 1311678582_addproductgroup.php.

    The file 13116785578_addfks.php containing a class which creates all relations (foreign keys and constraints), but it tries to add constraint on a non existing table (in my case product_group, which will be created last). So, the SQL error means YOU ARE TRYING TO CREATE A RELATION WITH UNEXISTING TABLE, YOU MORON! 🙂

    My soltion is to rename the 13116785578_addfks.php to 13116785590_addfks.php as it forces the doctrine merge machine to execute it as a last step. When executed all tables are already made and MySQL server is happy!

    So, what about the reason for this miss-ordering?

    Probably it caused by mixi’n up the to tasks doctrine:generate-migrations-db and doctrine:generate-migrations-models,
    but the Symfony’s Migration tutorial isn’t very clear with this.

    Why I use them both?

    When I done ./symfony doctrine:generate-migration-db only the half of classes for the migration was created. It is strange – there are only general tables and no related ones! So I called doctrine:generate-migrations-models.

    Conclusion

    Another question raises: Why doctrine:generate-migrations-db does not generate migration classes for related tables of the model?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So here is the situation. I have a database on a remote server that
This is a pretty odd situation I have here. I have used a piece
Here's the situation - I have a vb.net exe compiled for X86 machines using
I have a situation which I can resolve by adding a column which would
Here is my situation: I have a solution with three projects: 1) Silverlight App,
Today I came across one situation, here it is. I have a db object
Greetings, I could not provide all the details in the question, so here are
so, here is the situation here. I have 2 asp.net websites + some winform
here is the situation: I want to call a method from a C++ module,
I have an awkward situation in which I have a 32-bit lib that must

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.