[jira] Created: (OFBIZ-1313) Remove some Visit-related foreign keys

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
Remove some Visit-related foreign keys
--------------------------------------

                 Key: OFBIZ-1313
                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
             Project: OFBiz
          Issue Type: Improvement
            Reporter: Si Chen
            Priority: Minor


I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.

If no one has any objections I'll take care of this.


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Si Chen reassigned OFBIZ-1313:
------------------------------

    Assignee: Si Chen

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532530 ]

David E. Jones commented on OFBIZ-1313:
---------------------------------------

Yeah, I kind of object to this... think it's a bad idea. Still, not a bad enough idea that I'd say a hard no. Foreign keys are always nice to keep data clean, and avoid things like somehow incorrect visitIds in the tracking code table. Not that it's likely, but the whole point is to avoid problems or catch them early.

Please hold off for a few days at least to allow others to comment...

This might actually have been better to start as a mailing list thread, but I'm guessing you weren't expecting real objections.

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532533 ]

Si Chen commented on OFBIZ-1313:
--------------------------------

Do you think there will be a way to remove old Visits and keep the TrackingCodeVisit tables.  Should we just temporarily drop the constraint and readding it later with a SQL script?

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532561 ]

Jonathon Wong commented on OFBIZ-1313:
--------------------------------------

The way I usually do it is to:

1. Null the field pointing to the record I am about the delete.

2. Delete the record.

Isn't there a "cascade set null on delete" in the Entity Engine (and for all RDBMSes)? If not, I'd recommend just doing the above manual steps.

It's not good to keep a non-null field pointing to a non-existent record. Very misleading.

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533415 ]

Si Chen commented on OFBIZ-1313:
--------------------------------

That's a good idea but you can't null TrackingCodeVisit.visitId because it's part of the primary key and a not null field.

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533574 ]

Jonathon Wong commented on OFBIZ-1313:
--------------------------------------

Oh, I see. I didn't realize a primary key field cannot be null. Anyway, nulling visitId could create duplicate keys.

Perhaps dump affected TrackingCodeVisit records to an entity like ArchivedTrackingCodeVisit that doesn't have visitId tied to a foreign key constraint?

Or, how about changing the primary key of TrackingCodeVisit such that some date field is used in place of visitId?

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reassigned OFBIZ-1313:
--------------------------------------

    Assignee: Jacques Le Roux  (was: Si Chen)

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Jacques Le Roux
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reassigned OFBIZ-1313:
--------------------------------------

    Assignee: Si Chen  (was: Jacques Le Roux)

Oops, sorry Si : wrong issue

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marco Risaliti updated OFBIZ-1313:
----------------------------------

          Component/s: marketing
        Fix Version/s: SVN trunk
    Affects Version/s: SVN trunk

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: marketing
>    Affects Versions: SVN trunk
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>             Fix For: SVN trunk
>
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756136#action_12756136 ]

Adam Heath commented on OFBIZ-1313:
-----------------------------------

Instead of nulling the visitId field, set it to _NA_; there is already a pattern for this in other places.

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: marketing
>    Affects Versions: SVN trunk
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>             Fix For: SVN trunk
>
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756758#action_12756758 ]

Jacques Le Roux commented on OFBIZ-1313:
----------------------------------------

Hi Adam,

I looked for this pattern but did not find it. All I see is related to initialisation. Where did you find it? My aim is to close this issue with a valid argument.

Thanks

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: marketing
>    Affects Versions: SVN trunk
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>             Fix For: SVN trunk
>
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756762#action_12756762 ]

Adam Heath commented on OFBIZ-1313:
-----------------------------------

PartyRelationship sometimes sets the roleTypeId to _NA_.

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: marketing
>    Affects Versions: SVN trunk
>            Reporter: Si Chen
>            Assignee: Si Chen
>            Priority: Minor
>             Fix For: SVN trunk
>
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-1313) Remove some Visit-related foreign keys

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-1313.
----------------------------------

    Resolution: Won't Fix
      Assignee: Jacques Le Roux  (was: Si Chen)

I can't find that related to a change posted in the DB. Anyway I close, this issue will not open anywhere anyway

> Remove some Visit-related foreign keys
> --------------------------------------
>
>                 Key: OFBIZ-1313
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1313
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: marketing
>    Affects Versions: SVN trunk
>            Reporter: Si Chen
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: SVN trunk
>
>
> I would recommend that we remove the foreign keys to the Visit entity, so old Visit records can be safely deleted without affecting data in TrackingCodeVisit, which might be useful for statistical and reporting purposes.  It should not affect the core entities.  The visits would only no longer be available after some time has passed.
> If no one has any objections I'll take care of this.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.