Uploaded image for project: 'IGB'
  1. IGB
  2. IGBF-2843

Error while deleting the IGB-apps from appstore from the admin panel

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
    • Story Points:
      2
    • Sprint:
      Spring 3 2021 Apr 19 - Apr 30, Spring 4 2021 May 3 - May 14

      Description

      Appstore breaks when we are deleting the apps which are present in the Appstore 1.0 database. IGB apps added using Appstore 2.0 is working fine and we can successfully delete the apps.

        Attachments

          Activity

          Hide
          chirag24 Chirag Chandrahas Shetty added a comment -

          The error might be due to curated categories model that was added to the App-Store 2.0.

          Show
          chirag24 Chirag Chandrahas Shetty added a comment - The error might be due to curated categories model that was added to the App-Store 2.0.
          Hide
          chirag24 Chirag Chandrahas Shetty added a comment -

          Please view the following video to learn more about Django Model:
          https://www.youtube.com/watch?v=2KqhBkMv7aM

          Show
          chirag24 Chirag Chandrahas Shetty added a comment - Please view the following video to learn more about Django Model: https://www.youtube.com/watch?v=2KqhBkMv7aM
          Hide
          chirag24 Chirag Chandrahas Shetty added a comment -

          The error is caused as we need to delete all the references to the app related entries in all the table. The CuratedCategoriesMapping uses app's primary key as the foreign key to form the relation between app model and curated categories mapping model. Therefore when deleting entries from app we have to also delete the references from CuratedCategoriesMapping.

          Show
          chirag24 Chirag Chandrahas Shetty added a comment - The error is caused as we need to delete all the references to the app related entries in all the table. The CuratedCategoriesMapping uses app's primary key as the foreign key to form the relation between app model and curated categories mapping model. Therefore when deleting entries from app we have to also delete the references from CuratedCategoriesMapping.
          Hide
          chirag24 Chirag Chandrahas Shetty added a comment -

          There are seven possible actions to take when such event referenced object is deleted:

          CASCADE: When the referenced object is deleted, also delete the objects that have references to it (when you remove a blog post for instance, you might want to delete comments as well). SQL equivalent: CASCADE.
          PROTECT: Forbid the deletion of the referenced object. To delete it you will have to delete all objects that reference it manually. SQL equivalent: RESTRICT.
          RESTRICT: (introduced in Django 3.1) Similar behavior as PROTECT that matches SQL's RESTRICT more accurately. (See django documentation example)
          SET_NULL: Set the reference to NULL (requires the field to be nullable). For instance, when you delete a User, you might want to keep the comments he posted on blog posts, but say it was posted by an anonymous (or deleted) user. SQL equivalent: SET NULL.
          SET_DEFAULT: Set the default value. SQL equivalent: SET DEFAULT.
          SET(...): Set a given value. This one is not part of the SQL standard and is entirely handled by Django.
          DO_NOTHING: Probably a very bad idea since this would create integrity issues in your database (referencing an object that actually doesn't exist). SQL equivalent: NO ACTION. (2)

          reference: https://stackoverflow.com/questions/38388423/what-does-on-delete-do-on-django-models

          Show
          chirag24 Chirag Chandrahas Shetty added a comment - There are seven possible actions to take when such event referenced object is deleted: CASCADE: When the referenced object is deleted, also delete the objects that have references to it (when you remove a blog post for instance, you might want to delete comments as well). SQL equivalent: CASCADE. PROTECT: Forbid the deletion of the referenced object. To delete it you will have to delete all objects that reference it manually. SQL equivalent: RESTRICT. RESTRICT: (introduced in Django 3.1) Similar behavior as PROTECT that matches SQL's RESTRICT more accurately. (See django documentation example) SET_NULL: Set the reference to NULL (requires the field to be nullable). For instance, when you delete a User, you might want to keep the comments he posted on blog posts, but say it was posted by an anonymous (or deleted) user. SQL equivalent: SET NULL. SET_DEFAULT: Set the default value. SQL equivalent: SET DEFAULT. SET(...): Set a given value. This one is not part of the SQL standard and is entirely handled by Django. DO_NOTHING: Probably a very bad idea since this would create integrity issues in your database (referencing an object that actually doesn't exist). SQL equivalent: NO ACTION. (2) reference: https://stackoverflow.com/questions/38388423/what-does-on-delete-do-on-django-models
          Show
          chirag24 Chirag Chandrahas Shetty added a comment - PR: https://bitbucket.org/lorainelab/appstore/pull-requests/281
          Hide
          aloraine Ann Loraine added a comment -

          Merged and deployed to devappstore3 and devappstore5 for testing.

          Show
          aloraine Ann Loraine added a comment - Merged and deployed to devappstore3 and devappstore5 for testing.
          Hide
          omarne Omkar Marne added a comment - - edited

          Tested on devapptore5

          • Testing app installed successfully.
          • Search functionality is working fine.
          • Delete functionality is working fine.
          • Showing and asking the latest version while deletion.
          • App type is working fine.

          Chirag Chandrahas Shetty You're good to submit the pull request.

          Show
          omarne Omkar Marne added a comment - - edited Tested on devapptore5 Testing app installed successfully. Search functionality is working fine. Delete functionality is working fine. Showing and asking the latest version while deletion. App type is working fine. Chirag Chandrahas Shetty You're good to submit the pull request.
          Hide
          chirag24 Chirag Chandrahas Shetty added a comment - - edited

          Hi Omkar Marne,

          The code is all ready merged. You can close the ticket.

          Show
          chirag24 Chirag Chandrahas Shetty added a comment - - edited Hi Omkar Marne , The code is all ready merged. You can close the ticket.
          Hide
          omarne Omkar Marne added a comment -

          Ok Thanks. Closing the ticket.

          Show
          omarne Omkar Marne added a comment - Ok Thanks. Closing the ticket.

            People

            • Assignee:
              chirag24 Chirag Chandrahas Shetty
              Reporter:
              chirag24 Chirag Chandrahas Shetty
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: