# TODO: deferrable, initially, etc.
return "%(prefix)sForeignKeyConstraint([%(cols)s], [%(refcols)s], %(args)s)" % {
"prefix":_sqlalchemy_autogenerate_prefix(),
- "cols":", ".join(f.parent.key for f in constraint.elements),
+ "cols":", ".join("'%s'" % f.parent.key for f in constraint.elements),
"refcols":", ".join(repr(f._get_colspec()) for f in constraint.elements),
"args":", ".join(
["%s=%s" % (kwname, val) for kwname, val in opts]
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=100), nullable=True),
sa.Column('order_id', sa.Integer(), nullable=True),
- sa.ForeignKeyConstraint([order_id], ['order.order_id'], ),
+ sa.ForeignKeyConstraint(['order_id'], ['order.order_id'], ),
sa.PrimaryKeyConstraint('id')
)
op.drop_table('extra')
op.create_table('extra',
sa.Column('x', sa.CHAR(), nullable=True),
sa.Column('uid', sa.INTEGER(), nullable=True),
- sa.ForeignKeyConstraint([uid], ['user.id'], ),
+ sa.ForeignKeyConstraint(['uid'], ['user.id'], ),
sa.PrimaryKeyConstraint()
)
op.drop_column('address', 'street')
"server_default='NOW()', "
"nullable=True),"
"sa.Column('amount', sa.Numeric(precision=5, scale=2), nullable=True),"
- "sa.ForeignKeyConstraint([address_id], ['address.id'], ),"
+ "sa.ForeignKeyConstraint(['address_id'], ['address.id'], ),"
"sa.PrimaryKeyConstraint('id')"
")"
)