[GitHub] incubator-trafficcontrol issue #768: Tenant parent - on delete cascade

2017-08-03 Thread nir-sopher
Github user nir-sopher commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/768
  
Thanks for the feedback
Opening: https://github.com/apache/incubator-trafficcontrol/pull/771


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #768: Tenant parent - on delete cascade

2017-08-02 Thread dewrich
Github user dewrich commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/768
  
@nir-sopher I think your first option `1. Write a custom "delete all 
tenants" function, to be used in tear-down.
The function will delete the tenants in the correct order.` is best.  
Cascading Deletes is a scary function, especially when it takes a lot of work 
to setup the data.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #768: Tenant parent - on delete cascade

2017-08-01 Thread nir-sopher
Github user nir-sopher commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/768
  
Thanks for the feedback!
I was struggling myself what is the correct solution (and therefore the wip)

I started dealing with this issue as I noticed that when my UT crashes,
prove can no longer be run until I "reset" the DB.
The reason for that was that my UT added a child tenant to the defaults set
of tenants, and crashed, leaving this tenant defined. When tear-down was
called, the "delete table" for the "Tenant" table failed, trying to delete
the parent tenant before the child.

There are 2 ways I can see to fix this issue.
1. Write a custom "delete all tenants" function, to be used in tear-down.
The function will delete the tenants in the correct order.
2. Use "ON DELETE CASCADE" - which seems to be common the common practice
in traffic-ops DB.

Is there another way to cascade delete the entire table for the sole
usecase of tear-down?

On Aug 1, 2017 8:02 PM, "Matt Mills"  wrote:

> In that case, why would this be an ON DELETE CASCADE, rather than an ON
> DELETE RESTRICT?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> 
,
> or mute the thread
> 

> .
>



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #768: Tenant parent - on delete cascade

2017-08-01 Thread MattMills
Github user MattMills commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/768
  
In that case, why would this be an ON DELETE CASCADE, rather than an ON 
DELETE RESTRICT? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #768: Tenant parent - on delete cascade

2017-08-01 Thread nir-sopher
Github user nir-sopher commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/768
  
The change is in the db definition

On Aug 1, 2017 7:42 PM, "Nir Sopher"  wrote:

> Indeed. The api and the new portal does not allow tenant deletion if child
> exists.
> The legacy UI does not deal with tenacy at all.
>
> On Aug 1, 2017 7:34 PM, "Matt Mills"  wrote:
>
>> IMO the UI should just throw an error when you try to delete a tenant
>> that has children, rather than delete the children.
>>
>> —
>> You are receiving this because you authored the thread.
>> Reply to this email directly, view it on GitHub
>> 
,
>> or mute the thread
>> 

>> .
>>
>



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #768: Tenant parent - on delete cascade

2017-08-01 Thread nir-sopher
Github user nir-sopher commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/768
  
Indeed. The api and the new portal does not allow tenant deletion if child
exists.
The legacy UI does not deal with tenacy at all.

On Aug 1, 2017 7:34 PM, "Matt Mills"  wrote:

> IMO the UI should just throw an error when you try to delete a tenant that
> has children, rather than delete the children.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> 
,
> or mute the thread
> 

> .
>



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---