qizhiyi / sqlalchemy-migrate

Automatically exported from code.google.com/p/sqlalchemy-migrate
MIT License
0 stars 0 forks source link

Foreign Key constraint producing NoReferencedColumnError #110

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Create user_category table in first change set
2.Run manage.py test and manage.py upgrade
3.Create user table with foreign key constraint to user_category.id column
4.Run manage.py test

What is the expected output? What do you see instead?
Expected:
    Upgrading... done
    Downgrading... done
    Success

Actual:
Error with full stack trace, ending with the error message:
sqlalchemy.exc.NoReferencedColumnError: Could not create ForeignKey 
'user_category.id' on table 'user': table 'user_category' has no column named 
'id'

What version of the product are you using? On what operating system?
Using SQLAlchemy-Migrate 0.6.1 with SQLAlchemy 0.6.6. Database is MySQL, which 
is on a remote machine. I'm getting this error when trying to run the script on 
WinXP SP3 and also Ubuntu 10.04 Server

Please provide any additional information below.
I've attached my changesets and the stack trace, minus any db specific info 
such as connection details

Original issue reported on code.google.com by 2fluidbr...@googlemail.com on 12 Feb 2011 at 10:58

Attachments:

GoogleCodeExporter commented 8 years ago
False Alarm.  Managed to get it working by adding the user_category definition 
to the 2nd change script (002_Add_user_table.py).  However, this could probably 
be better documented.

Original comment by 2fluidbr...@googlemail.com on 14 Feb 2011 at 10:07

GoogleCodeExporter commented 8 years ago

Original comment by jan.ditt...@gmail.com on 14 Feb 2011 at 7:59

GoogleCodeExporter commented 8 years ago
documentation update planned for next release

Original comment by jan.ditt...@gmail.com on 15 Feb 2011 at 10:57