fix migration on mysql

only postgres can use the conditions, and mysql complains about us removing
the index supporting the FK, so only do it for postgres

Change-Id: I0700887169ef4e1efe54cf7bb70529fdb7c571ab
Reviewed-on: https://gerrit.instructure.com/24386
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix pinned discussion sorting

the backbone update broke pinned discussion sorting (probably because the reset event was removed). CollectionView doesn't
insert the item views in the same order as the sorted collection
because backbone doesn't trigger the add events in sorted order.

fixes CNVS-8161

test plan:
- reorder some pinned discussions and verify sort order sticks
  after refreshing the page. try several different orderings.

Change-Id: If68e0abb16206e786953648949aec5b24774eb2b
Reviewed-on: https://gerrit.instructure.com/24417
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
clean up old bad data before adding an FK

Change-Id: I9cce44b7bd9072da2b7329ae87034a86318d8bb1
Reviewed-on: https://gerrit.instructure.com/24507
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
treesame commit of origin/stable/2013-09-14

Treesame-Commit-Id: eddf43eac5c4533a9167140a88a46a6b08f235fd
Merge remote-tracking branch 'instructure/stable' into upgrade