On Jan 22, 2014, at 11:05 AM, Michael Bayer <[email protected]> wrote:

> 
> On Jan 22, 2014, at 6:55 AM, [email protected] wrote:
> 
>> Thanks for the help, I need a bit more
>> 
>> I gave my ForeignKey a name, so far so good. 
>> (I'm using MySQL btw)
>> 
>> I cant seem to find how to delete that name/column or object
>> 
>> In my Model:
>> organ_id = Column('organ_id',Integer, ForeignKey('organs.id', 
>> name='fk_yeshivot_organ_id'))
>> 
>> "fk_yeshivot_organ_id" is the name of my ForeignKey object,
>> 
>> 
>> I tryed, but this doesn't work:
>> 
>> def downgrade(migrate_engine):
>>     metadata.bind = migrate_engine
>>     yeshivotTable = Table('yeshivot', metadata, autoload=True)
>>     yeshivotTable.c.fk_yeshivot_organ_id.drop()
>> 
>> I get AttribureError, beacuse yeshivotTable.c doesn't have 
>> fk_yeshivot_organ_id, so where shoud it be, and how to drop it?
> 
> 
> that would be op.drop_constraint(“fk_yeshivot_organ_id”, “yeshivot”, 
> type_=“foreign
> key”)
> 
> 
> http://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.drop_constraint

oh, you’re on Migrate.   Sorry, I haven’t used migrate in many years I assumed 
this was alembic.


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to