You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/07/16 19:53:50 UTC

[GitHub] [incubator-superset] graceguo-supercat opened a new pull request #7880: [migration] add unique constraint on dashboard_slices table

graceguo-supercat opened a new pull request #7880: [migration] add unique constraint on dashboard_slices table
URL: https://github.com/apache/incubator-superset/pull/7880
 
 
   ### CATEGORY
   
   Choose one
   
   - [x] Bug Fix
   - [x] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   
   Superset didn't have unique constraint on dashboard_sliced table. In dashboard front-end code and when saving dashboard data to db, we added logic to prevent same slice id added into dashboard, but still have found some duplicated entries in the dashboard_slices table. 
   
   When user tried to remove the duplicated slice_id from dashboard, they will see following error, and they cannot remove that duplicated slice:
   ![Screen Shot 2018-11-20 at 1 19 54 PM (5)](https://user-images.githubusercontent.com/27990562/61324852-3837f580-a7c8-11e9-8c8b-2ee4b388a91f.png)
   
   
   **Solution:**
   1. remove duplicated entries in many-to-many relation tbl dashboard_slices
   2. add unique constraint
   
   
   ### TEST PLAN
   run following query from sql lab, should get 0 row:
   > SELECT dashboard_id, slice_id, count(*)
   > from dashboard_slices
   > group by dashboard_id, slice_id
   > having count(*) > 1
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [x] Requires DB Migration.
   - [x] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ### REVIEWERS
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org