Commit Graph

1874 Commits

Author SHA1 Message Date
Alex Slaughter d912e3a13d backfill root_account_id for quiz_submission_events table
flag=none
closes: QUIZ-7765

Test plan:
- Have existing models with null root_account_id for:
  Quizzes::QuizSubmissionEvent
- Run DataFixup::PopulateRootAccountIdOnModels.run
- Verify records have root_account_id

Change-Id: I1ce7fa047c7d70f6a9d75e7d6048b42ad42f8e71
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248919
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2020-10-06 19:03:00 +00:00
Rob Orton 404bb682c1 just send the job even if site_admin doesn't exist
test plan
 - specs should pass

Change-Id: I207aa5f16f481db74a0d3dd6536bbc033a07f538
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249336
Reviewed-by: John Koropchak <jkoropchak@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Rob Orton <rob@instructure.com>
2020-10-06 02:29:58 +00:00
Mysti Lilla 142276c152 Fix job timing on plagiarism resubmit, don't run with migration
refs INTEROP-5767
flag=none

Test plan
- Set up a couple of submissions associated to a plagiarism
  tool
- Set Setting.set('trigger_plagiarism_resubmit', '1,10')
  in the console
- Change the resend_plagiarism_events.rb file and remove
  the "if_production" parts, change to send_later_enqueue_args
  so you can see the jobs try to work
- Run DataFixup::ResendPlagiarismEvents.run and verify
  you get a couple of jobs in the Delayed::Jobs queue that have
  reasonable run_at times.
- Ensure that the live-event sends properly when they fire

Change-Id: I3441ebbdf722961445703ba13f0ce03490a28c7a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248967
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-10-02 18:56:20 +00:00
Kyle Rosenbaum 025556caf3 bump rubocop version to 0.68.0 to support ruby 2.6
this changes upgrades to the earliest version of rubocop
supporting ruby 2.6 while also choosing a version that fixes
a breaking 0.60.0 change to revert psych version change.

namespace changes were made on multiple cops to support
the new rubocop version requirements as well as the change to
move performance cops out of the rubocop gem in to
rubocop-performance.

the Layout/IndentFirstParameter cop is currently broken but a
rubocop version upgrade will fix that. the FreezeConstants cop
also required a fix to handle nil types.

refs DE-289

test plan:
- ensure rubocop runs completely

Change-Id: I0ca68f426e287b5a973b96a4ae0e975f1cbc0240
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248786
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: Ryan Norton <rnorton@instructure.com>
2020-09-29 16:09:54 +00:00
Cody Cutrer 42d6ba4f43 fix typo in migration
Change-Id: I461931817aa2f400569e884b9e3fee7470157a94
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248785
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-09-29 00:59:54 +00:00
Mysti Lilla ca60b98366 Resubmit submissions that should have originality reports
refs INTEROP-5767
flag=none

Test plan
- Specs pass

Change-Id: Ied05b5a09ed0c22b3015605c70b5a7ed87397ce3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247067
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-09-28 22:17:15 +00:00
Mysti Lilla 7f7962e310 Add subscription to all LTI 2 Plagiarism tool installations
fixes INTEROP-6130
flag=plagiarism_tool_subscriptions (removes it)

Test plan
- Have a Lti::ToolProxy for TurnItIn or Urkund
  or some other Plagiarism service that does
  not have an associated subscription
- Run the data fixup.  Verify the tool has
  a working subscription

Change-Id: I21a85321caf1a735e0034661e175da3423548967
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246411
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
2020-09-28 22:16:32 +00:00
Cody Cutrer 4211945c1f use shard settings, not Setting, for common core group id
Change-Id: I3324d727ea16760c4b28a0b8d0d3cbea676948a5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248463
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-09-28 17:22:17 +00:00
Alex Slaughter a1112c340b Add root_account_id for quiz_submission_event
Test plan:
 - Specs Pass

Fixes: QUIZ-7766, QUIZ-7764
flag = none

Change-Id: I57c13defb93e559823a41fd91dbaab1f6f1ca7c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248622
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2020-09-25 20:13:01 +00:00
Ethan Vizitei 68198567df move AUA log compaction state to local table
closes FOO-1003

TEST PLAN:
  1) aua log compaction continues to work
  2) state on plugin setting and in metadata
     table is in sync

Change-Id: Ie161fcb079f80a4072ddd99f3a561c97d33026fd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248501
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-09-25 16:35:01 +00:00
Evan Battaglia c3c184d5bb remove root acct id FK constraint - quiz_questions
There are quiz questions which have a cross-shard quiz_id.

flag=none
refs INTEROP-6194

Test plan:
- before and after running migrations, try to create a QuizQuestion with
  a cross-shard (global) quiz_id.

Change-Id: Ifd600774eb1aeea697e93a206cc4e26d0dd05530
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248376
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-09-25 16:14:49 +00:00
Michael Ziwisky 291a774810 remove uniqueness constraint from UserMergeDataRecords index
fixes FOO-888

Repro (before applying this migration)
 - create a course and publish it
 - create a quiz in the course and publish it
 - create two users, A and B, and enroll both in the course as students
 - have user A start the quiz but don't finish it
 - have user B start and finish the quiz
 - merge user B into user A
 - canvas go BOOM. unique key constraint violation.

After applying this migration, I went through the same repro, verified
that the issue was fixed, and indeed you end up with multiple
UserMergeDataRecords for the same QuizSubmission, but that doesn't seem
to be a problem. You can still do SplitUsers on the resulting user and
UserMergeData without issue.

Change-Id: I6752544cec8ed08e8229334d73efe02af5a31507
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248267
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2020-09-25 15:27:51 +00:00
Cody Cutrer 77ef90663b make role_overrides.context NOT NULL
Change-Id: I95c6d6fe59172a41fe0a90205bf3cd896b4db8f8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248331
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-09-24 00:49:45 +00:00
Cody Cutrer 2255e612eb folders get dummy root_account_id for context user
refs FOO-960

Change-Id: I815dc6f89fd283dcc067899bf97147fa53d3553c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248189
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-09-23 19:16:38 +00:00
Cody Cutrer b2ef0367da stop using deprecated form to reload default shard
Change-Id: I34290b6f0aaaceecc98f11f64a9ef96562e30cc1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248039
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-09-21 19:42:48 +00:00
James Williams 82b72a01f0 clear caches with objects referencing deleted roles
test plan:
* migrations should run

closes #LS-1464

Change-Id: I8da5b9e2347a6e32d42b738d9e38ebb237b1771a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247651
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-09-21 14:51:35 +00:00
Augusto Callejas edfd81521e Add outcome proficiency permissions
closes OUT-3944

flag=none

test plan:
  - confirm that these account permissions are
    enabled for account admins (account roles)
    and disabled but available for teachers and
    designers (course roles)
  - create a custom account role
  - enable the "Learning Outcomes - add / edit / delete"
    permission
  - either run the data fixup code again or perform
    the two steps above before running the migrations
    from this patch set
  - confirm the proficiency permissions are now enabled
    on the custom role (reload Canvas permissions page
    before confirming)

Change-Id: I6fb52c4f9eb0d5146453b55dba1fd14912818b7b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247047
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Jody Sailor
2020-09-15 21:54:11 +00:00
Evan Battaglia 3d46b6d850 backfill root_account_id on Comm.Channels again
* run specs and test

Partially adapted from efe298c1c8
(clearing old User root_account_ids)
See also old CommunicationChannel backfill commit
8502957025

flag=none
closes INTEROP-6091

Test plan (multi-shard canvas):
- have some users and communication channels in different shards, with
  some with cross-shard associations, and some comm channels in a
  different shard as the user.
- run DataFixup::PopulateRootAccountIdOnModels.run on all shards to make
  sure the Users all have root_account_ids.
- make sure you have some communication channels with root account ids
  (this is not what we are testing here, if none are there, just set some)
- run migrations
- make sure the root account ids on the communication channels are
  cleared (if you are running jobs they may start backfills so it's best
  to not be running a jobs container)
- delete all jobs on all shards
  (Shard.with_each_shard{Delayed::Job.delete_all}) to simulate the state
  on production (with users backfill complete and no jobs)
- run DataFixup::PopulateRootAccountIdOnModels.run on all shards
- check that all communication channels have the correct root
  account ids (comm channels should match the users)

Change-Id: I1ae5d4fb50bd5dadd62fe394ec8b4072f03edb3d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247183
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2020-09-14 22:54:37 +00:00
James Williams 1a147b896c remove built-in-role split condition handling
and make role root_account_id not null

the datafix is done so we can remove the code
handling the old built-in roles

test plan:
* specs

closes #LS-1425

Change-Id: Ic8a115b71383c561b55275636bd93c194d752610
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247327
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-09-14 13:11:35 +00:00
Brian Watson b02d569900 Remove Granular Permissions Wiki Pages FF
closes OUT-3890
flag=none

Test-plan:
 - Verify that user interactions behave as expected
   when testing with various different permissions
   turned on/off when using various different user
   roles
 - Granular pages permissions can be found under
   /accounts/self/permissions > Manage Pages

Change-Id: I0718a781991bf66fd90a14489710f0a68a4e4cb9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245714
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Jody Sailor
2020-09-10 04:43:12 +00:00
Cody Cutrer 45a09ef420 optimize ObserverAlert.create_assignment_missing_alerts
also run it less often

the gist is to iterate by users, instead of alerts, so that indexes can be more
effective. also, don't join against the world - select only the columns we actually
need, and carefully form our joins. this way we can also avoid a bunch of queries
post-load as well. it also makes the final query much easier to grok

on a middle sized database, this changes from ~75 queries of ~22s each (with no
improvement with a warm cache) to ~22 queries of ~10s each (down to ~30ms on a
warm cache)

Change-Id: I9f2cbae3aa3fce4d5ff9a1e2fa424ffca11e042f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246829
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-09-09 16:39:11 +00:00
Jeremy Stanley 719037925d drop unused wiki_pages.view_count column
flag = none
closes LS-1436

Change-Id: I4f303f09976bc4be377bc560dcb2c5ce5d9fc7dd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247127
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-09-08 17:52:47 +00:00
Ethan Vizitei 2cf7f03656 cleanup AUA log compaction
and fix bug with zeroing out
wrong iterator

Change-Id: I7e94d3d256c128b690c9b6fb2df038dca449ee3a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247090
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-09-06 13:10:35 +00:00
Ethan Vizitei 08e2238dc6 aua views via log compaction
closes FOO-937

 * 7-tables by day-of-week
 * infer write table from timestamp
 * plugin with default settings values
 * instructions on setting the local shard to use log-&-compact
 * write path switches on setting to log compaction for view bumps
 * compaction job
 * single write per log segment (multpile updates)
 * truncates previous partition
 * periodic job harness with available settings

Change-Id: Idd5cbaf0d83436724c5d72038e0dbc78cdc23619
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247083
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-09-06 03:56:53 +00:00
Evan Battaglia 575c8cdbb0 Have backfill migration run for new tables
refs: INTEROP-6153
flag=none

Test plan
- N/A

Change-Id: I8c773073969975dc0f69725bc9437ba8e01b40d0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246952
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-09-03 22:29:11 +00:00
Charley Kline 4cb9e145ab Migration: remove view_learning_analytics overrides
Refs FOO-905
flag=none

We've removed this permission from Canvas, so let's just also
go remove all role overrides everywhere that reference it.

Test plan:
* If you had any RoleOverride records referencing the
  :view_learning_analytics permission, they should be gone after
  running DataFixup:ClearAnyCanvasInsightsViewRoleOverrides.run

Change-Id: I028eaa929dc4ae1176b683980ad2d3cb07c2dfbf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246805
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-09-03 19:31:38 +00:00
Ethan Vizitei ea14dcca1b optimize most time-consuming production query
Change-Id: Ia0e8eff177df99cd24d55c3e113d84925a081723
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246914
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-09-03 17:42:49 +00:00
James Williams a6e6fd0670 split built-in role rows by root account
test plan:
* a multi-tenant shard should still work
 creating enrollments and account admins before and after
 running postdeploy migrations
* the postdeploy should successfully run a datafixup
 to split up build-in role rows and reassign the role_id on
 other tables (account_notification_roles, account_users,
 enrollments, and role_overrides) accordingly

closes #INTEROP-6045

Change-Id: I8325acb635397ac1b008b9d09788595da597cec7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243906
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
2020-09-01 19:21:27 +00:00
Ethan Vizitei 16abf15de4 yank migrations and table management from canvas ddb
Change-Id: I3d2a60443e9b514f690a236b05dd2f437ad8e3c2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246391
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-08-31 20:26:17 +00:00
Cody Cutrer bedf970aab optimize planner wiki page query
it's far more common for wiki pages to not be linked to wiki pages, so only look up their
assignment visibilities if necessary

Change-Id: Idf3f05e2c5e59a2163bd692497160c2388551be2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-08-31 16:53:05 +00:00
Cody Cutrer 2af7da3928 add index on account_report_rows(created_at)
so that clean up is much faster

Change-Id: I265091dc328a54fb849b3eff39cad685e7889ae1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246525
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-08-31 16:22:55 +00:00
Mysti Lilla 66115e206c Revert "Revert "Create dummy Account 0""
This reverts commit 2548a2bc38.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Icfb9e1a2bcc660b66b8ee740299d390ca844c261
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245091
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-08-28 20:57:49 +00:00
Mysti Lilla 2548a2bc38 Revert "Create dummy Account 0"
This reverts commit 2a7fcdd792.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I0f75b86493f5b24b91cee2b00ec9e0c07d496d49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245090
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-08-28 18:22:13 +00:00
Mysti Lilla 2a7fcdd792 Create dummy Account 0
flag=none
closes INTEROP-6094

Test plan
- Run the database migration
  and ensure Account 0 is created

Change-Id: I9a5e6f8934c76ea97997a41eeecdd7fef7e76e95
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245895
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Michael Guymon <mguymon@instructure.com>
Product-Review: Michael Guymon <mguymon@instructure.com>
2020-08-28 16:17:09 +00:00
Jacob Burroughs ae5ab6bfb6 Bump inst-jobs + switchman-inst-jobs
Change-Id: I69c7a60bf65f1ef8914171413adb91bb2eae95a5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246089
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-08-27 16:25:49 +00:00
Adrian Packel abe50c3b3c Add grading_period_id to Cassandra
flag=none
closes EVAL-1128

Test plan:
- Migrations on Cassandra run successfully
- Grade changes save the grading_period_id of the associated submission
  in both Cassandra and AR

Change-Id: I7ae0ff54093b9bf1eaea43106d4788f22c6c920e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245734
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Jody Sailor
2020-08-26 19:21:32 +00:00
Mysti Lilla 3251306ff0 Delete DeveloperKey shard split artifacts
refs INTEROP-6080
flag=none

Test plan
- Have some developer keys with account ids
  from a different shard
- Run DataFixup::CleanupCrossShardDeveloperKeys.run
  and verify they get deleted

Change-Id: Ib389ef37b33a8a6e73c4926d9db775542dc6629f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245434
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-08-20 20:01:21 +00:00
James Williams 4403eb3c2a fix cross-shard content shares
shares belong to the user's shard, not the content export's

so shares created for a course on a shard
that the user doesn't belong to will break

and shares sent to cross-shard users that create "received"
copies of the original share will also break

also semi-inadvertently fixing share sender info in API
and some problems on the import side when the correct
shard isn't active

test plan:
* cross-shard content shares should work
 (both when sharing content from a course from a shard
 the sending user is not native to, and when sharing content
 to a user on a shard different than the content's course)

closes #LS-1337

Change-Id: Ib91529ffa5de0ee7a6f20f63281d6c5508982063
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245496
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-08-20 17:07:08 +00:00
Cody Cutrer ecd05261cc filter assessor asset by courses too in submissions_needing_peer_review
test plan:
 * specs pass

Change-Id: Ib66137d96d8ae06634f4e305b9354b306a0a2405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245475
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-08-19 16:28:49 +00:00
Cody Cutrer 45aa6d632f tweak indexes for dashboard queries
Change-Id: I8e35155c8e1cff3be11db8c0de9fe9502951c6e1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245106
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-08-14 18:52:04 +00:00
Pat Renner 466271355c soft delete outcome proficiency and proficiency ratings
closes OUT-3841
flag=none

test-plan:
- run migrations
- Ensure you can soft delete outcome proficiencies
(and their associated ratings)
- dc run --rm web script/rails c
> o = OutcomeProficiency.first (alternatively,
copy the factory code from factories/outcome_proficiency_factory
to create one for an account)
- ensure it has a workflow state (should be "active" by default)
- ensure the ratings have an "active" workflow state by default
> o.outcome_proficiency_ratings.map(&:workflow_state)
> o.destroy
- Ensure the outcome proficiency was soft deleted
(it should now have a workflow state of deleted)
- Ensure the ratings were soft deleted
> o.outcome_proficiency_ratings.map(&:workflow_state)
- Ensure calling undestroy restores both the proficiency and the ratings
> o.undestroy
> o.outcome_proficiency_ratings.map(&:workflow_state)
- Calling destroy_permanently! should hard delete
both the proficiency and all associated ratings (examine SQL output)
> o.destroy_permanently!

Change-Id: I6421fdfdd97b991e76fb08b528cddbc668495ac8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244166
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2020-08-13 23:50:03 +00:00
Cody Cutrer 8ce6b71a3a optimize assignments_needing_grading_query
especially for courses with mostly-deleted-assignments

Change-Id: Icbb010dd0406e2206148ce08ee849babf4d7a459
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244991
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2020-08-13 20:34:53 +00:00
Jacob Fugal 2b3886c5f4 extend client_credentials oauth2 grants for CD2
refs SAS-1540

* adds an audience setting to developer keys, so a key can be set to
  target external audiences with its credentials grants
* when a key with an external audience grants credentials, the token is
  signed with an asymmetric key instead of the internal symmetric key
* external audiences can retrieve the corresponding public keys from
  /login/oauth2/jwks
* credentials issued by developer keys with an account id include the
  account's guid in a custom claim

includes a refactor of key storage and rotation in consul, which had
already been done for LTI. but it wasn't really a feature of lti, just
something used by LTI, and we needed the same for key management for
this. moved it to be part of Canvas::Security

Change-Id: Ie5c0fcee6fc21687f31c109389a3bcc1ed349c5d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243606
QA-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2020-08-13 18:52:47 +00:00
Evan Battaglia efe298c1c8 Clear old (always global) user root account ids
Must be merged and deployed with the "Make Users root_account_ids
relative to user shard" (g/244742) commit.
The migration here is named to run before
20200806175207_populate_root_account_id_on_models
kicks off the users backfill.

flag=none
refs INTEROP-6063

Test plan:
- make sure you have some users with root account ids with all global
  ids (ids are still global when on same shard as user)
- run migrations
- make sure those root account ids are cleared (if you are running jobs
  you will also start backfills so you may notice users filling up again
  but they will have local root account IDs for root accounts on the same
  shard as the user)

Change-Id: I047afe45989f2e86ca711e24683beca4557ce1c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244804
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2020-08-12 15:22:31 +00:00
Mysti Lilla 6b10d90197 Populate root account id on roles
fixes INTEROP-5887
flag=none

Test plan
- Ensure you have a role without a root
  account id
- Run DataFixup::PopulateRootAccountIdOnModels.run
- Ensure your roles have their root account ids
  populated

Change-Id: I9fd7fa4ac40b92716b746f0e7424b85212f118ff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244525
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-08-07 21:05:15 +00:00
Pat Renner 5949862ab8 ensure outcome_proficiency.context cannot be null
closes OUT-3805
flag=none

test-plan:
- run migrations
- cannot create an outcome_proficiency with nil context

Change-Id: Ie01742f0df539e7f6b8f31e1fedd80cd31eadfed
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242529
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
2020-08-06 15:11:36 +00:00
Pat Renner 40fa8bd397 ensure calculation_method.root_account cannot be null
closes OUT-3847
flag=none

test-plan:
- Run migrations
- Ensure you cannot create a calculation method without a root account:
> OutcomeCalculationMethod.create! context: Account.find(id),
      calculation_method: :latest, calculation_int: nil
> method = _
- Confirm root account is set on method
- Update root account to be null (calling update_column skips
activerecord callbacks)
> method.update_column(:root_account_id, nil)
- Should trigger NotNullViolation

Change-Id: I1fa31c39f79d969e915872a2b420a6b583564be8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243759
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
2020-08-06 15:11:25 +00:00
Pat Renner e846eaec57 remove account_id from outcome_proficiency model
closes OUT-3760
flag=none

test-plan:
- Run migrations
- Ensure outcome proficiencies cannot be made
without defining context (or context_type/id)
> rating1 = OutcomeProficiencyRating.new(
description: 'best', points: 10, mastery: true, color: '00ff00')
> rating2 = OutcomeProficiencyRating.new(
description: 'worst', points: 0, mastery: false, color: 'ff0000')
> OutcomeProficiency.create!(
outcome_proficiency_ratings: [rating1, rating2])
- Should pass with provided context
(may need to delete current proficiency ratings for Account.first)
> OutcomeProficiency.create!(
outcome_proficiency_ratings: [rating1, rating2], context: Account.first)

Change-Id: I67ea2237641e02e3339dbb7c468f9e91381422b2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242532
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
2020-08-06 15:11:15 +00:00
Evan Battaglia a45b1e1036 Add index to users root_account_ids
Needed for communication_channels backfill (it depends on users being
backfilled to needs the index to efficiently check).

refs INTEROP-6038
flag=none

Test plan:
- run migration up, check index exists on table
- run migration down, check index no longer on table

Change-Id: I27a5001a42bbd52cf630204148cd64900c80a1d5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244273
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
2020-08-05 21:54:18 +00:00
Mysti Lilla 05b02fc11c Have backfill migration run for new tables
refs: INTEROP-5842
flag=none

Test plan
- N/A

Change-Id: If7459b1890c25c00194a429b528a5b1aeeef8eaa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244282
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-08-05 17:28:12 +00:00
Adrian Packel 72620b417b Update grade change tables for override grades
flag=none
closes EVAL-1065

Test plan:
- "up" migration:
  - Ensure migrations run properly
  - After the migration finishes, check that the assignment_id,
    submission_id and submission_version_number columns in the
    auditor_grade_change_records_* tables do *not* have not-null
    constraints
  - Check that the grading_period_id column exists on said tables, along
    with an accompanying foreign key
- "down" migration:
  - Check that the assignment_id, submission_id and
    submission_version_number column once again have a not-null
    constraint
  - Check that the grading_period_id column no longer exists

Change-Id: I82d0325ea88f88138e78901415ed8fbe0d7d2814
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243691
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2020-08-04 14:41:30 +00:00
Evan Battaglia 05e2c90f6b Remove RA id FK constraint on asset_user_accesses
Although we're not sure why, there are lots of asset_user_accesses with
a cross-shard context and thus would have a cross-shard root account ID.

flag=none
closes INTEROP-6042

Test plan:
- run migration and make sure you can set root_account_id to a global ID e.g.
  12340000000000123 on a AssetUserAccess
- set it back to null
- run `rake db:migrate:down VERSION=20200730144201` and make sure that you
  cannot set root_account to a global ID anymove

Change-Id: Idf1db168c52e0d76bdaeed9e02466fe465276e89
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243922
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-08-03 21:19:06 +00:00
wdransfield 1a78816bab Bump date of root_account_id backfill migration
Closes PLAT-6031
flag=none

We have several new root_account_id population
data fixups. This date change will ensure the
new fixups included in the same release are
scheduled to run.

Change-Id: I45490e6a2dacb182de48df54b33ced658aa7e436
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243485
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-07-27 19:30:18 +00:00
Michael Brewer-Davis cd9eb4fab7 add outcome calculation method model
closes OUT-3759
flag=account_level_mastery_scales

Test plan:
- run migrations
- in the canvas ui or rails console, create subaccounts
- in the rails console, add outcome calculation
  methods to the root account and some of the subaccounts:
  > ap Account.all.pluck(:id, :name)
  > OutcomeCalculationMethod.create! context: Account.find(id),
      calculation_method: :latest, calculation_int: nil
- verify that calculation methods are found through
  `account.resolved_outcome_calculation_method`

Change-Id: Iba4b8db2e1c78b7f7c5964eec270ed75c4f94d66
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242745
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2020-07-22 17:53:42 +00:00
Evan Battaglia 005df77737 Remove root_account_id from communication_channels
This was replaced with plural root_account_ids.

Test plan:
- run migrations and check that communication_channels no longer has
  root_account_id column
- `rake db:migrate:down VERSION=20200713124612` and check that
  root_account_id column is there again

Change-Id: I6524ed6230687c8866e714a57c366bc31aa1d5a6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242524
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2020-07-22 15:55:11 +00:00
Pat Renner 49b9636f7f add context_type/id to outcome proficiency
flag=none
refs OUT-3758

DO NOT MERGE (migration freeze)

test-plan:
- ensure you have at least one outcome proficiency
created for an account
- run migrations
- ensure that for your existing outcome proficiencies,
context_type and context_id are set
- create an outcome proficiency (using
outcome_proficiency_factory provides a nice template) and
ensure context_id, context_type is set on save

Change-Id: Iabd21ce00386959f12498f7fa0c1f5bd58d57127
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242140
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2020-07-22 15:09:08 +00:00
Drake Harper 079860ea4d Drop gender and birthdate columns from User
Test Plan:
-specs should pass

flag=none

fixes VICE-591

Change-Id: I20595e1f7aefe8e4c6237db60b3eac9139780fef
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242087
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-07-20 17:49:46 +00:00
Xander Moffatt 24153c85c9 backfill conversations_* tables
* read from `conversations`, which already has root_account_ids
* copy those, which are comma-separated values in a string, to:
  * conversation_messages
  * conversation_participants
  * conversation_message_participants, through conversation_messages

closes INTEROP-5853, INTEROP-5854, INTEROP-5855, INTEROP-5856
flag=none

test plan
* specs
* in the UI, create a conversation chain between two users
* in a rails console, note that the conversation has a root_account_ids field
* note that the Conversation's `conversation_messages`,
`conversation_participants`, and
`conversation_message_participants`
all have those root account ids as well, since there is logic to populate those on save
* for each of those associations, run `association.update_all("root_account_ids=NULL")`
* then run `DataFixup:PopulateRootAccountIdsOnConversationsTables.run`
* note that the root_account_ids fields for all associations
match the field on the conversation

Change-Id: I98ac281291c2105240610b0a0690a544c7d082a7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241978
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2020-07-16 17:24:56 +00:00
Cody Cutrer 74d6822704 disable pg12 COLLATION for the moment
it doesn't work well in a mixed environment

Change-Id: I90b72e7a0fce1a9e4f815cc89f75b9a6b258ddfa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242679
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-07-15 00:19:33 +00:00
Xander Moffatt 81f3dbad4f populate root_account_id on calendar_events
closes INTEROP-5844
flag=none

test plan:
- have existing CalendarEvents without root account id,
  preferably at least one with each context type
  (Course, CourseSection, Group, User w/no effective
  context, User w/effective context, AppointmentGroup)
- run `DataFixup::PopulateRootAccountIdOnCalendarEvents.run`
- verify all events (except User w/o effective context)
  have a root_account_id

Change-Id: I7d3c3c7221c25b3ae2d8c1b8819307cc66be229e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242024
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2020-07-14 19:28:38 +00:00
James Williams d3189e9f01 fix remove_foreign_key with if_exists and column
refs #LS-1201

Change-Id: I4240f4b642b1c99bb6dfe3ce88713b597797bea1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242590
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
2020-07-14 14:56:47 +00:00
Evan Battaglia 0c876829d4 Remove FK constraints for more global RA ids
root_account_id on these tables can be cross-shard, so cannot have an FK
constraint.

flag=none
closes INTEROP-6006

Test plan:
- run migration and make sure you can set root_account_id to a global ID e.g.
  10000000000001 on a AccessToken and RubricAssociation
- run `rake db:migrate:down VERSION=20200713144312` and make sure that you
  cannot set root_account to a global ID anymove

Change-Id: I5ea00506f9eacba4ff0106133bcd0e8dcbaa6dc1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242539
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-07-13 22:13:24 +00:00
Evan Battaglia 386c44e691 Add root_account_ids to communication_channels
communication_channels can have multiple root account IDs
(they can have no pseudonym and instead just belong to a user,
which can have multiple root account IDs).

flag=none
refs INTEROP-6003

Test Plan:
- Verify the new migration can be run up and down.
- Verify the root_account_ids attribute on the CommunicationChannel
  model can be set and saved.

Change-Id: I8009ff62c3560d1de5d761ddf8d8a042b48327ca
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242522
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-07-13 21:06:54 +00:00
Mysti Lilla 597f0a7274 Ensure backfill job runs per shard
fixes INTEROP-5997
flag=none

Test plan
- Specs pass

Change-Id: I857548924a618eeb068e129e16292ced6494abba
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242414
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-07-13 20:15:16 +00:00
Evan Battaglia cc23faaac3 Remove FK constraints for possibly global RA ids
root_account_id on these tables can be cross-shard, so cannot have an FK
constraint.

Test plan:
- run migration and make sure you can set root_account_id to a global ID e.g.
  10000000000001 on an Attachment, AttachmentAssociation, Folder,
  CommunicationChannel (this one you need to use update_all() with SQL
  to avoid validations apparently)
- run `rake db:migrate:down VERSION=20200713114812` and make sure that you
  can not set root_Account to a global ID anymove

Change-Id: Ibcb8b54d1ba3af96bf4fad64a8ea3b7e4a613c2e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242500
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-07-13 20:00:21 +00:00
Clint Furse 54212b43da data fixup for MC LTI tool
closes LS-1182
flag = submission_type_tool_placement

Test Plan:
- spec runs ok

Change-Id: I36eb9050e9dc4114cad87ebf4101413d69d7b93e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242136
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Clint Furse <cfurse@instructure.com>
2020-07-13 16:16:08 +00:00
Gary Mei 42cb2c1529 add root_account_id to grading_period_groups
closes EVAL-702
flag=none

Test Plan
- Run migrations.
- Create a grading period group for an account.
- Verify in a console that the group's root_account_id is set to the
  root account's id.
- In the console, set the root_account_id to nil.
- Edit the grading period group in some way and save it.
- Verify in the console that the root_account_id is set again.

Change-Id: Ic38d227066297d5cc247aab37760f9c6df958d2b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239943
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2020-07-13 15:29:45 +00:00
James Williams d99b163828 remove root account foreign key for favorites
closes #LS-1201

Change-Id: If55f2237528e855e2cb41314a412c0935fc117f4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242375
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
2020-07-10 17:52:47 +00:00
Mysti Lilla 54a51a11f9 Performance improvements for backfill jobs
refs INTEROP-5836
flag=none

Test plan
- Specs pass

Change-Id: I41adaffe60c359537d8baaad4a4d3d60daaa9333
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242322
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-07-10 01:08:43 +00:00
Rob Orton 7b24afd223 cleanup invalid observer_alerts
fixes KNO-498

test plan
 - migrations should run

Change-Id: I727d9178d00bb88d5656def43df3d0417d3eadda
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241840
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
2020-07-09 16:21:38 +00:00
wdransfield 905df065e9 bump root_account_id migration timesamp
Change-Id: Ieddea338feca60316c8253ffc297df47530acdac
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242205
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-07-08 22:32:07 +00:00
Ahmad Amireh cf98f71cd3 send upcoming assignment alert to unaware students
Fills in the stub for actually sending the notification to the selected
students.

Test Plan:
In a Rails console
 - Grab a student who has Due Date notifications set to Immediate (u)
 - Grab an assignment that the student is assigned, but has not
     submitted and is due in the future (a)
 - `s = Submission.find_by(user_id: u.id, assignment_id: a.id)`
 - `n = BroadcastPolicy.notification_finder.by_name('Upcoming Assignment Alert')`
 - `AssignmentUtil.alert_unaware_student(n, assignment: a, submission: s)`
 - Verify that a notification was sent

fixes VICE-445, VICE-446
flag  = smart_alerts

Change-Id: I56032152c8f9a0c4c2387d28420c419f990440d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240397
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
2020-07-07 19:31:53 +00:00
Mysti Lilla 37da106359 Populate root account id on DiscussionTopic
fixes INTEROP-5905
flag=none

Test plan
- Have discussion topics without root
  account ids
- Run Datafixup::PopulateRootAccountIdOnModels.run
- Ensure discussion topics have root
  account ids

Change-Id: I44f071a8984086974b0a8b5b01a78d7f121e051d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241632
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-07-01 20:43:22 +00:00
Ahmad Amireh 17f6cacaff fix collation migrations for PG < 12
the DETERMINISTIC option is introduced only in 12[1][2] but we were
version checking for >= 10, causing the migrations to fail on PG 10

relates to g/241190

[ TEST PLAN ]
  ---------

Verify you can run the migrations using PG 10 or 11.

[1]: https://postgresql.verite.pro/blog/2019/10/14/nondeterministic-collations.html
[2]: https://www.postgresql.org/docs/12/sql-createcollation.html

Change-Id: I049bc49d3598be5709c630980580bc8583dca121
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241438
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-06-30 16:50:22 +00:00
Simon Williams a2c7c54485 fix too long index name
Change-Id: I159965be92113b41f1865700f4fdbb8e5cc246c0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241499
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-30 02:45:34 +00:00
Cody Cutrer ee3456849d use a different temporary index name for collkey migration
since the temp index will still exist if you're running all predeploy migrations,
then all postdeploys

Change-Id: I5a139212f06bc49604e6f9c6f31764c8cc054a62
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241492
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-06-30 01:55:59 +00:00
Cody Cutrer 8936b5803a use PG10's built in collation support
test plan:
 * with PG <10, nothing should change/break (migrations shouldn't even try to run)
 * with pg >=10, run migrations
 * it should create collations, and recreate a couple indexes
 * going to the users page should not be broken
 * specs ensure that the sorting is to our liking

Change-Id: I3eaf42dd2207d733c164c12ef2a43a1c1b417ff2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241190
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-06-26 18:50:05 +00:00
Matthew Lemon acebf1dfb1 create trophy tables
flag=trophy_case

/ ---- ---- \
| Test Plan |
\ ---- ---- /

- N/A

Change-Id: I7fce9298f1c582e7801033d19b05951d86f5b1ca
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240878
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-26 17:34:34 +00:00
Cody Cutrer 735bb2719e tweak scheduled smart alerts table
Change-Id: I226b6adcdc89a4845e4e58d9709f279bef22b954
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240519
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-06-18 00:03:30 +00:00
Michael Brewer-Davis 2c8badd7ed add index to learning_outcomes root_account_ids
refs OUT-3641
flag=none

Change-Id: I6d42dccdd438f4e63cf3ba5f63ad619879ad7ef0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240481
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-06-17 20:05:08 +00:00
Michael Brewer-Davis 2b054eb5d4 add root_account_ids to learning_outcomes
refs OUT-3641
flag=none

Change-Id: If12ee39e323e0f7b36f403595f66af1176de229d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240474
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-17 18:43:50 +00:00
Matthew Lemon 9373400817 add root_account_ids to conversations tables
Conversation, and ConversationParticipant already have the
root_account_ids column so we only need to add it to ConversationMessage
and ConversationMessageParticipant.

fixes VICE-550
flag=none

/ ---- ---- \
| Test Plan |
\ ---- ---- /

- Run the migration
  - bundle exec rake db:migrate:up VERSION=20200616085312
- Verify that the ConversationMessage and ConversationMessageParticipant
  tables have the `root_account_ids` column

Change-Id: I7259e710208378c0ab852b3a2b51cc3a08216160
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240321
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-17 18:30:35 +00:00
Michael Brewer-Davis 247db4d6c2 remove root_account_id from learning_outcomes
refs OUT-3641
flag=none

Change-Id: Id5266509346638ca0100a7f47426c339f984b64a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240473
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-17 18:14:43 +00:00
Ben Nelson 245b5664aa schema change for reminder smart alert
refs VICE-466

Change-Id: I4461ba85aa4dd4c030719dadcbecd014a89ea7e7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240470
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ben Nelson <bnelson@instructure.com>
Product-Review: Ben Nelson <bnelson@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-17 17:48:52 +00:00
Matthew Lemon e85fa83a78 drop root_account_id from conversations tables
This removes the root_account_id from Conversation,
ConversationParticipant, ConversationMessage, and
ConversationMessageParticipant. We are opting to do something similar to
whats already being done in conversation with multiple root account ids
instead.

fixes VICE-549
flag=none

/ ---- ---- \
| Test Plan |
\ ---- ---- /

- Run the migration
  - bundle exec rake db:migrate:up VERSION=20200615170938
- Verify that the Conversation, ConversationParticipant,
  ConversationMessage, and ConversationMessageParticipant tables no
  longer have the `root_account_id` column

Change-Id: I7f736d96556ef86dc033aeb30bb37497809a0a29
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240320
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-06-17 15:33:25 +00:00
Clint Furse ed4127c72e basic launch and response from MasteryConnect
closes LA-728
flag = submission_type_tool_placement

Test Plan:
- find a LTI 1 tool that can be configured to do
  submission_type_selection placements.  The
  tool will also need to be able to send a
  ContentItemResponse back to Canvas.  I used
  a tool called lti_tool_provider_example (github)
  and modified it.  The response should include
  the following data for MasteryConnect:
  "https://canvas.instructure.com/lti/mastery_connect_assessment": {
          "points": 10,
          "objectives": "6.R.P.A.1, 6.R.P.A.2",
          "trackerName": "My Tracker Name",
          "trackerAlignment": "6th grade Math",
          "studentCount": 15
        }
- Install the tool under an account or course
- Create an assignment using the submission type
  that matches the tool (not 'External Tool')
- interact with the tool to send a response item
  back to Canvas
- The new data should be displayed below the button
- Save the assignment and verify that the data is
  persisited to the DB as JSON (content_external_tag.external_data)
- also verify data is still correclty displayed when
  editing an assignment

Change-Id: I5b1457e5dcfb8988ec75fbe3dfa1a3ca88bf0a77
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240130
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Clint Furse <cfurse@instructure.com>
2020-06-17 15:21:23 +00:00
Simon Williams 3a045c6e3b squash old migrations, p34 (through 2016)
Change-Id: I1786323eb8aee2996f2762719dfe7d6204cb92fa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238238
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-17 15:16:34 +00:00
Simon Williams 48b9cd268d squash old migrations, p33 (string limits edition)
Change-Id: I315cad3b16178bbf112c2cfe0127034efc013b4c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238237
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-06-17 14:10:18 +00:00
Simon Williams 354b2fc5c9 squash old migrations, p32
Change-Id: I58a7083f764b03b607ca776a03fa6bb1067eca30
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236784
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-16 18:59:16 +00:00
Cody Cutrer 4f597e78d4 split submissions root_account_id migration into two
Change-Id: I8e0ded3a504a71d2e727f03909c4f378bc673b01
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240245
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-06-16 17:18:37 +00:00
Mysti Lilla bbc73d8fdd Add subscription_id to Lti::ToolProxy
refs PLAT-5765
flag=none

Test plan
- N/A

Change-Id: Ie00a8d0feaa1193ee2a4c46aa5c72c9b781fb45d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240278
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-15 23:09:46 +00:00
Evan Battaglia ae518dc85f Delete assignments when deleting line items in API
1. Adds "coupled" column which is set only when the line item is the
   default line item created when the user creates an external tool
   Assignment in the UI
2. Allows the API to delete all line items it created
3. Allows the API to delete assignments it created via the line items
   API (that is, deletes the associated assignment if a line item is the
   main line item and was created in the UI)

closes PLAT-5772
flag=none

Test plan:
- before checking out this commit:
- install the LTI 1.3 test tool
- create an Assignment in the UI, choosing external tool as the
  submission type and the test tool as the tool
- create an adition external tool Assignment in the UI
- Go to http://web.lti-13-test-tool.docker/ags/new and create a new line
  item with external_tool as the submission type
- Create a new line item with no submission type
- Create a new line item that is attached to one of the manually-created
  assignments. To do this you must give the `assignment.lti_context_id`
  as resource link ID when creating the second line item
- check out the commit and run migrations
- open a rails console and check that the default line item for the
  manually-created assignments have coupled=true. The other three line
  items should have coupled=false
- create all the line items created above again. Again, only the
  manually-created ones should have coupled=true.
- delete the last line item created (the extra one attached to the
  manually-created assignment) with the test tool. the line item should
  be deleted but the assignment/resource link/first line item should not
  be.
- try deleting (with the test tool) the rest (four) of the last batch
  line items. The ones with coupled=true should get a 401 response.
  The other two should be deleted and their assignments and resource
  links should be deleted.

Change-Id: I992c10f0c36aa5ed84f0e58e1e6c549b14a9d0ee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238693
Product-Review: Karl Lloyd <karl@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2020-06-11 19:23:23 +00:00
Cody Cutrer e760c87d7e switch some migrations to add FK with the column to avoid locking
Change-Id: Icea0c41f49642f9da2c22a6df80066e69e80b125
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239703
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-09 21:54:47 +00:00
Cody Cutrer ec32fbefe1 add if_exists option to remove_index
and apply to recent non-transactional migrations

Change-Id: I3ef72208f4c39906905229eb3188eaf4df89c68a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239699
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-09 21:54:40 +00:00
Cody Cutrer d2a8477627 make several recent non-transactional migrations idempotent
Change-Id: I1f311ec2f4569a7d264b141e7a734e8588652741
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239695
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-09 21:54:33 +00:00
Cody Cutrer fd03b83f1f add if_exists option remove_foreign_key
also fix foreign_key_for to prefer the obvious FK

Change-Id: I494c4a73aa136bc4a6735231c0957a9f062bdb11
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239688
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-09 21:54:19 +00:00
Cody Cutrer 4d1ac60e03 add if_not_exists to add_foreign_key
also fix delay_validation with rails 5.2, and constraints can be re-validated
without dropping them

Change-Id: Iab4d2dc374c7b4707d67323d05e8e8e8ff203e47
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239656
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-09 21:53:28 +00:00
Jacob Burroughs 0e83411d14 Move root account index addition to a separate postdeploy
Change-Id: I386ca689471a272a5ee2eac4dde41dff6eb97a46
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239654
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-06-09 19:16:11 +00:00
Adrian Packel bf1be2fe0d Add root_account_id to submissions
closes PLAT-5552
closes TALLY-706
flag=none

Test plan:

Migration:
- Verify migrations run
- Verify a root_account_id can be set on a
  Submission record
- Verify Submissions always live on the same shard
  as their root account

DueDateCacher:
- Do something that triggers a DueDateCacher run (e.g., add some
  students to a course)
- The root_account_id of the resulting submission objects should match
  the owning course's root account ID

Change-Id: Ib4cd4396b736c4e5329c67caeb92cb9b74ddb1ca
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239395
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Oxana Jurosevic
2020-06-09 18:15:54 +00:00
Cody Cutrer 69f76f3871 add some missing if_not_exists calls on recent migrations
Change-Id: Ibaa80b9643a5e3754af0a152510b13e68fc6de44
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239648
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-06-09 16:37:03 +00:00
Ethan Vizitei 96c6d38b1a auditors read path
refs CNVS-48876
flag = none

make all auditors pass
backend strategy from dynamic
settings

configure indexes in
event_streams with columns
on db tables to search by

use a bookmarked collection
to return results with a simple
paginator

TEST PLAN:
  1) use a dual-writing system for a while
  2) examine API or UI results from auditor
     endpoints
  3) enable reading from postgres
  4) API and UI results from auditor endpoints
     should be equivalent
     (and loaded via SQL queries)

Change-Id: If5b10736077b7721348ede323a34dd843d08c75f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236498
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-09 16:10:33 +00:00
Cody Cutrer 54b53bc094 add if_not_exists option to add_column
and use it for a recent non-transactional migration

Change-Id: I28e6fcc22ff1b22064cde2baf600c86a7728038a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239564
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-06-09 15:36:06 +00:00
Cody Cutrer 1ac2a1b581 add if_not_exists option to add_index
and use it in recent non-transactional migrations

Change-Id: Ie96e3cbf727403c5dfe9d04bc3403170c076d5b6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239560
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-06-09 15:35:59 +00:00
Cody Cutrer d85aa95894 make it easy for add_column_and_fk helper to be idempotent
Change-Id: I4d5c8d85a7cd0a7aa2c84f3278bfcecef0425398
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239559
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-06-09 15:35:51 +00:00
Cody Cutrer a69b2d18cc skip populating course id in migration if they are all already populated
this query is fast, because there is already an index on the column

Change-Id: Iee781570bb897001724d5753a02dbb8b03911619
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239478
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-06-09 15:18:28 +00:00
James Williams 99c5a44fec drop conditional release template models
despite all initial appearances it turns out these are
functionally unused and probably won't change any time soon

test plan:
* specs

closes #LA-1108

Change-Id: Ia5411d355659471465971e3f154292230841a709
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239380
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-06-08 16:58:54 +00:00
Simon Williams ffd987116a squash old migrations, p31
Change-Id: I55fcceb76bae8f3d13d5b34c1cfc77b8e57a192e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236783
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-07 00:45:02 +00:00
Simon Williams 9535bee361 squash old migrations, p30
Change-Id: Ic70fd33a97c388cf4e1a1dfd6ad26c023f5f3040
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236782
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-06 03:44:59 +00:00
Simon Williams a72e6cd4fd squash old migrations, p29
Change-Id: I14eb45f796dfdf102f37b1aeb9ad664ab593465b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236781
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-06-06 02:55:12 +00:00
Mysti Lilla 57ed77011a Migration for root account id backfill
closes PLAT-5837,PLAT-5838,PLAT-5839
flags=none

- On running this, it should fill root_account_id
  for any tables currently in the migration_tables
  method in the referenced data fixup

Test plan
- Running this migration should cause any
  developer keys and developer key account bindings
  to have their root account ids populated as well
  as Context Modules

Change-Id: I1020f67475465b63f88a83353f5cb93ffe8d6b51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236779
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2020-06-06 02:17:03 +00:00
wdransfield f33b0c2662 Add root_account_ids to users
This change prepares Canvas Data 2 to route user
events to the proper customers

After getting feedback from folks all over the org,
we've decided to store root_account_ids on the users
table.

The intent is to populate this column with all with
global root account IDs as user_account_associations
are created, updated, and deleted for root accounts.

This population feature will be introudced in a
later commit with the ability to be turned off in
cisco accounts where a user can have many
user_account_associations with root accounts.

Here is some data that led us to this decision:

user -> root account association numbers for
all non-cisco canvas:

*One root account association:* 63% of users
*Five or fewer root account associations:* 90% of users
*Ten or fewer root account associations:* 96% of users
*Max root account associations:* 316 root accounts (1 user)
*Total Users: 118,216,506*

Closes PLAT-5596
flag=none

Test Plan:
- Verify the new migration can be run up and down
- Verify the root_account_ids attribute on the User
  model can be set and saved

Change-Id: I0a3e738d7a4cbdef224d381df488918d65e6cbc4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238281
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-06-05 15:04:29 +00:00
wdransfield 08110b6cda Add root_account_id to content_participation_counts
Closes PLAT-5561
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  ContentParticipationCount record
- Verify ContentParticipationCount records
  always live on the same shard as their root account

Change-Id: Iab1ca4aca9ba78d81f01ed427b13350edf26de44
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233684
Reviewed-by: Clint Furse <cfurse@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-06-05 15:04:01 +00:00
wdransfield cbf359cdb5 Add root_account_id to web_conference_participants
Closes PLAT-5817
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  WebConferenceParticipant

Note that backfill and model logic will come in a
later commit

Change-Id: I2790395aafe9921852b1ee814b30dff2a796c3ff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238662
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-06-04 14:56:55 +00:00
wdransfield feaa24b7d1 Add root_account_id to web_conferences
Closes PLAT-5816
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  WebConference

Note that backfill and model logic will come in a
later commit

Change-Id: If16f1bc10d752a57368764da1471644c1ae29834
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238663
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-06-04 14:56:27 +00:00
James Williams f16f2867b9 add conditional release tables and model scaffolds
- should only bring over the relevant tables (i.e.
 no copies of canvas objects or infrastructure tables)
 or rename the copied table if useful data is stored through it
 (i.e. cr's "assignments" are now "assignment_set_associations"
  because they were used to join to canvas assignments)

- should denormalize references to go directly to canvas
 tables (also use integers instead of strings for ids)

test plan:
* migrations and specs run

closes #LA-1093

Change-Id: I864e5332cf9f51d41f685a229c36c1afb8ac42ff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239016
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-06-03 20:52:05 +00:00
Ethan Vizitei e60716629c index foreign keys for test student reset
Change-Id: Ib0454b8ea2fec96e822d12b1535efdb83e9f3ddd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239131
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-06-03 18:29:56 +00:00
Xander Moffatt 30dca612db add root_account_id to favorites
closes PLAT-5605
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  Favorite record
* verify Favorites always
  live on the same shard as their root account

Change-Id: I2990a7d86f7c558b3a798a91926e7512cc037390
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236955
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-29 15:28:20 +00:00
wdransfield 3923e16041 Add root_account_id to asset_user_accesses
Note that the root_account_id should be
set to the root account ID of the asset
being accessed.

If the asset being accessed is not tied
directly to a root account (a user
attachment for example), root account id
will be left blank

Closes PLAT-5580
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  AssetUserAccess record
- Verify AssetUserAccess always live on
  the same shard as their root account

Change-Id: Iebf25798ec27023233be7eb0f9debdf3783b1a8e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236877
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2020-05-29 14:51:44 +00:00
Ethan Vizitei 8f328d531f annotate job-ids on auditor records
refs CNVS-48876
flag = none

TEST PLAN:
 1) run backfill
 2) migration cells should have job ids for logs

Change-Id: If716a1f673bd45ecc44a4c9cee2e1c7577d27d45
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238687
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-05-29 01:26:43 +00:00
James Williams 3f4a5d1084 drop submission.context_code in favor of submission.course_id
test plan:
* smoke test todo list
 (needs grading and peer review lists in particular)

closes #LA-952

Change-Id: I613ffa2499986700744482c56976bba207cfb971
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234903
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-05-28 23:31:13 +00:00
wdransfield 5532679416 Add root_account_id to custom_gradebook_columns
Closes PLAT-5543
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  CustomGradebookColumn record
- Verify CustomGradebookColumn records always live on the same shard
  as their root account

Change-Id: I0d2c3c25afe50fc9abdf57e2a3d8d089a9c8ee2b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235209
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-05-28 17:27:41 +00:00
wdransfield 96a1743858 Add root_account_id to post_policies
Closes PLAT-5547
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  PostPolicy record
- Verify PostPolicy records always live on the same shard
  as their root account

Change-Id: I5c274ba14d78969e1b3b71a7daedc12518f7f3b7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235198
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-05-28 17:27:20 +00:00
wdransfield b58ffab2e7 Add root_account_id to discussion_entry_participants
Closes PLAT-5736
flag=non

Test Plan
- Verify migrations run
- Verify you can set the root_account_id
  of a DiscussionEntryParticipant

Change-Id: Id9266ac7b38542d50dd9f39bd246eb2bf1131532
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238593
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-05-28 17:26:16 +00:00
wdransfield 906a7732af Add root_account_id to conversation_participants
Closes PLAT-5603
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  ConversationParticipant record
- Verify ConversationParticipant records
  always live on the same shard as their
  root account

Change-Id: I396cd193512cae37976241c73ff6e595b4e6083c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235265
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2020-05-27 18:59:00 +00:00
Xander Moffatt 56f9db167a add root_account_id to account_users
closes PLAT-5579

test plan:
* verify migrations run
* verify root_account_id can be set on an AccountUser
* verify AccountUser_s live on the same shard as their root account

Change-Id: I5a227a9d62552803085eb2db6d6568f58020d0d0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235721
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
2020-05-27 16:16:23 +00:00
wdransfield c5fe88bfc0 Add root_account_id to submission_versions
Closes PLAT-5554
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  SubmissionVersion record
- Verify SubmissionVersion always live on the same shard
  as their root account

Change-Id: I89953ce6be4c27c9226d454a50a968e9d56ad3e9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235011
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-05-27 16:02:06 +00:00
wdransfield 7140eed397 Add root_account_id to grading_periods
Closes PLAT-5549
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  GradingPeriods record
- Verify GradingPeriods always
  live on the same shard as their root account

Change-Id: I4a1935c7d7956dcc07919033a14e56136eb5ce63
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235018
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-05-27 14:58:50 +00:00
Xander Moffatt 22b191cd7f add root_account_id to user_account_associations
closes PLAT-5595

test plan:
* verify migrations run
* verify root_account_id can be set on a UserAccountAssociation
* verify UserAccountAssociation_s live on the same shard as their root account

Change-Id: Id337a5c0761de3491cb7e29b77acd989ec9dfab8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235727
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2020-05-27 14:41:21 +00:00
Xander Moffatt eaa7807bbb add root_account_id to user_notes
* note that only some UserNotes will have a root account id
(those associated with a faculty journal)
* all others will have blank root account ids

closes PLAT-5588
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  UserNote record
* verify UserNotes always
  live on the same shard as their root account

Change-Id: Ib734d3bb9f8365d315ee8bda5d9e1f1ae9736ae3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236933
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2020-05-27 14:41:03 +00:00
Xander Moffatt 1090a01f40 add root_account_id to conversation_messages
closes PLAT-5602
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  ConversationMessage record
* verify ConversationMessages always
  live on the same shard as their root account

Change-Id: I2e04a5eb6b3156fd14064954e73bbb6adafe8d3c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236953
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:40:49 +00:00
Xander Moffatt c5d108b3ce add root_account_id to folders
* note: records that have a context of course, group,
or account will have a root_account_id
* records with a user context will not have one

closes PLAT-5606
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  Folder record
* verify Folder always
  live on the same shard as their root account

Change-Id: Iaebeb34416a47279ec7e0bcb560dcc142afdf504
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236935
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:40:33 +00:00
Xander Moffatt b62fb7aad9 add root_account_id to communication_channels
closes PLAT-5600
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  CommunicationChannel record
* verify CommunicationChannels always
  live on the same shard as their root account

Change-Id: I9cfcc6bf52beeec5b7d697acc708ec509cbdca8c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236952
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2020-05-27 14:40:19 +00:00
Xander Moffatt 9b57ba1be1 add root_account_id to calendar_events
* note: only records with a context of course, group, or account
will have a root_account_id
* records with a user context will not have one

closes PLAT-5599
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  CalendarEvent record
* verify CalendarEvents always
  live on the same shard as their root account

Change-Id: I6b2c1f25aba2ddca32eaea14a121f8aedc4525c0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236934
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:40:03 +00:00
Xander Moffatt 6961fc81aa add root_account_id to discussion_topics
closes PLAT-5776
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  DiscussionTopic record
* verify DiscussionTopic always
  live on the same shard as their root account

Change-Id: I18c6e815490abea9633d466f2d8213f4894f8eae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236956
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
2020-05-27 14:39:51 +00:00
Xander Moffatt 2daa198644 add root_account_id to access_tokens
closes PLAT-5587

test plan:
* verify migrations run
* verify root_account_id can be set on an AccessToken
* verify AccessToken_s live on the same shard as their root account

Change-Id: I0183d39de21ae957eb49a2a68a6e750ab27060ad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235726
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2020-05-27 14:39:36 +00:00
Xander Moffatt ab62e1d4aa add root_account_id to conversation_message_participants
closes PLAT-5601
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  ConversationMessageParticipant record
* verify ConversationMessageParticipants always
  live on the same shard as their root account

Change-Id: Ib6eff6b6d8a2cdac2c00db6eeda45b5290927493
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236954
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:39:15 +00:00
Xander Moffatt ebd86d2497 add root_account_id to content_shares
closes PLAT-5563
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  ContentShare record
* verify ContentShares always
  live on the same shard as their root account

Change-Id: I3261791c49996047296b23c555eeb325d4cc8826
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236932
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
2020-05-27 14:38:59 +00:00
Xander Moffatt c0c3130b70 add root_account_id to attachments
* note: records with a context of group, course, or account will have a
root_account_id
* records with a user context will not

closes PLAT-5559
flag=none

test plan:
* verify migrations run
* verify a root_account_id can be set on a
  Attachment record
* verify Attachments always
  live on the same shard as their root account

Change-Id: Ib55f450ac5ad48973bd95d69a55b1edefef7f725
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236931
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clint Furse <cfurse@instructure.com>
2020-05-27 14:38:47 +00:00
Xander Moffatt cd8ac1490b add root_account_id to group_memberships
closes PLAT-5584

test plan:
* verify migrations run
* verify root_account_id can be set on a GroupMembership
* verify GroupMemberships_s live on the same shard as their root account

Change-Id: I517dff1ed7f0ff6f23d021f4e88e8f61e9dbe7b4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235724
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2020-05-27 14:38:36 +00:00
Xander Moffatt 8042270280 add root_account_id to role_overrides
closes PLAT-5585

test plan:
* verify migrations run
* verify root_account_id can be set on an RoleOverride
* verify RoleOverride_s live on the same shard as their root account

Change-Id: I43701e997abcb48553cbcc795a4d056d2cfdf940
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235725
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2020-05-27 14:38:23 +00:00
Xander Moffatt b898a7b428 add root_account_id to outcome_proficiency_ratings
closes PLAT-5733
flag=none

test plan:
* verify migrations run
* verify root_account_id on a OutcomeProficiencyRating
* verify OutcomeProficiencyRating_s live on the same shard as their root account

Change-Id: I5bd3e07cb2774f10fd88cbf823f12c1d3a4de55d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235395
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:38:08 +00:00
Xander Moffatt 5a8a206f65 add root_account_id to enrollment_states
closes PLAT-5582

test plan:
* verify migrations run
* verify root_account_id can be set on an EnrollmentState
* verify EnrollmentStates_s live on the same shard as their root account

Change-Id: I4a51d590dd0d3aa0200efbea88e3266b1b8325d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235723
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2020-05-27 14:37:51 +00:00
Xander Moffatt e510c61fc9 add root_account_id to outcome_proficiencies
closes PLAT-5732
flag=none

test plan:
* verify migrations run
* verify root_account_id can be set on an OutcomeProficiency
( may need to use OutcomeProficiency.new)
* verify that OutcomeProficiency_s live on the same shard as their root account

Change-Id: I7f4d30a6a0f7f272b839179d236173cd207b3f5a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235394
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
2020-05-27 14:37:38 +00:00
Xander Moffatt 040fadd394 add root_account_id to learning_outcome_question_results
closes PLAT-5729
flag=none

test plan:
* verify migrations run
* verify root_account_id can be set on a LearningOutcomeQuestionResult
* verify LearningOutcomeQuestionResult_s live on the same shard
as their root account

Change-Id: I537683a89510bbac83d8b2b3e381d5cca2728207
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235359
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:37:25 +00:00
Xander Moffatt c8672696dc add root_account_id to learning_outcome_results
closes PLAT-5730
flag=none

test plan
* verify migrations run
* verify root_account_id can be set on a LearningOutcomeResult
* verify that LearningOutcomeResult_s live on the same shard as their
root account

Change-Id: Ic840ca5b9066eb59a46b89485edd6859f47a9b4d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235360
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
2020-05-27 14:37:14 +00:00
Xander Moffatt e7b4961d12 add root_account_id to learning_outcomes
closes PLAT-5731
flag=none

test plan:
* verify migrations run
* verify root_account_id can be set on a LearningOutcome
* verify LearningOutcome_s always live on the same shard as their root_account

Change-Id: I5d361be36a9d71107b15a254f5a16f45c53a7017
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235358
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-27 14:36:54 +00:00
Xander Moffatt c65f057dc6 add root_account_id to learning_outcome_group
* prereq for root_account in ContentTag

closes PLAT-5727
flag=none

test plan
* verify migrations run
* verify root_account_id can be set on a LearningOutcomeGroup record
* verify LearningOutcomeGroup records always live on the
same shard as their root account

Change-Id: Id577f2166f9c913c071035cd5233ce7d0e46a350
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235224
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2020-05-27 14:36:31 +00:00
wdransfield f5026b1bf3 Add root_account_id to content_participations
Closes PLAT-5562
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a
  ContentParticipation record
- Verify ContentParticipation always live on
  the same shard as their root account

Change-Id: Ia7e766c3633f0864ba1158e71e7d47b9573dc9cb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233680
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-05-26 22:10:29 +00:00
James Williams 40550bdcb8 make submission course_id not null
Change-Id: I1f6445fa5898c6a9a757a7f7e643ada491703757
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234611
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2020-05-21 16:50:37 +00:00
Rob Orton 56f97d0f12 make access token for real_user
access tokens cannot be created when masquerading a user on purpose,
because this would allow a user to get the real token and use it when
permissions for the user could change in the future. A commit was made
ee50eec4bd to create the access tokens
used when doing an lti launch on the real_user instead of the user, but
this breaks some tools that are not handling all the masquerade data.
c94b34348a reverted that change to create
them on the user again.

This commit is adding a column to access_token so we can audit usage of
the tokens created from an LTI launch. When a token is created while
masquerading we add the real_user_id to the token and make the token
expire in one hour.

test plan
 - masquerade as a user
 - launch an lti_tool that creates an access token
 - the tool should see the end users token
 - in a console verify the token is set to expire in an hour
 - verify that real_user_id is used on the token
 - the token should expire within an hour

fixes KNO-464
flag=none

Change-Id: I1f8913fc536f4e2c8539551efed69b27fbdb6b1a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236443
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
2020-05-20 22:00:00 +00:00