[openstack-dev] [neutron][alembic] Upgrade of db with alembic migration script
Sławek Kapłoński
slawek at kaplonski.pl
Mon Jul 4 20:54:52 UTC 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160704/13773bd2/attachment.pgp>
More information about the OpenStack-dev
mailing list