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

2016-07-05 Thread slawek

Hello,

Thx a lot for help. I will check this review and  You comments.

Best regards / Pozdrawiam
Sławek Kapłoński
sla...@kaplonski.pl

W dniu 05.07.2016 09:23, Anna Kamyshnikova napisał(a):


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  
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
sla...@kaplonski.pl

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: 
openstack-dev-requ...@lists.openstack.org?subject:unsubscribe

http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


--

Regards,
Ann Kamyshnikova
Mirantis, Inc

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: 
openstack-dev-requ...@lists.openstack.org?subject:unsubscribe

http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


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

2016-07-05 Thread Anna Kamyshnikova
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 
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
> sla...@kaplonski.pl
>
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>


-- 
Regards,
Ann Kamyshnikova
Mirantis, Inc
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


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

2016-07-04 Thread Sławek Kapłoński
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
sla...@kaplonski.pl



signature.asc
Description: Digital signature
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev