[openstack-dev] [neutron][alembic] Upgrade of db with alembic migration script

Anna Kamyshnikova akamyshnikova at mirantis.com
Tue Jul 5 07:23:18 UTC 2016


Hi!

I've posted comment on your change. please check this out. I think I've
seen the similar issue on https://review.openstack.org/#/c/283802.

On Mon, Jul 4, 2016 at 11:54 PM, Sławek Kapłoński <slawek at kaplonski.pl>
wrote:

> Hello,
>
> I'm working on patch to add QoS ingress bandwidth limit to Neutron
> currently: https://review.openstack.org/303626 and I have small problem
> with db upgrade with alembic.
> Problem description:
> In qos_bandwidth_limit_rules table now there is foreign key
> "qos_policy_id" with unique constraint.
> I need to add new column called "direction" to this table and then remove
> unique constraint for qos_policy_id. At the end I need to add new unique
> constraint to pair (direction, qos_policy_id).
> To do that I need to:
> 1. remove qos_policy_id foreign key
> 2. remove unique constraint for qos_policy_id (because it is not removed
> automatically)
> 3. add new column
> 4. add new unique constraint
>
> Points 3 and 4 are easy and there is no problem with it.
>
> Problem is with point 2 (remove unique constraint)
> To remove qos_policy_id fk I used function:
> neutron.db.migration.migration.remove_fks_from_table() and it is working
> fine but it's not removing unique constraint.
> I made some modification to this function:
> https://review.openstack.org/#/c/303626/21/neutron/db/migration/__init__.py
> and this modifications works fine for mysql but in pgsql this unique
> constraint is not removed so after all there is two constraints in table
> and this is wrong.
>
> I'm not expert in pgsql and alembic. Maybe someone with bigger
> experience can look on it and help me how to do such migration script?
>
> Thx in advance for any help.
>
> --
> Best regards / Pozdrawiam
> Sławek Kapłoński
> slawek at kaplonski.pl
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>


-- 
Regards,
Ann Kamyshnikova
Mirantis, Inc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160705/f2b4ddf3/attachment.html>


More information about the OpenStack-dev mailing list