Add PartialSyncChange Table
Creates the MicrosoftSync::PartialSyncChange Table. With this table,
we'll be able to track what users need to be examined when performing a
partial sync for the Microsoft Teams sync integration.
closes INTEROP-6803
flag = microsoft_group_enrollments_syncing
test-plan:
* Pull the change down and migrate your database.
* Using a rails console, try to create a
MicrosoftSync::PartialSyncChange record without any other parameters. It
should fail, as you have to have a course, user, and enrollment_type.
* Try and create another record, first with just a course, then just a
user, then just an enrollment type. Again, this should all fail.
* Create a new record, this time with a User, Course, and
enrollment_type (this should be "owner" or "member") and save it to
the database.
* Try and create another record with all of the same parameters. This
should fail, due to uniqueness contraints.
* Try and create another record with the same User and Course, but use
the opposite enrollment_type. This should successfully save.
Change-Id: I8ae899036672bc1e65d26a560c35743d7fb22024
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265628
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-05-25 05:19:47 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
#
|
|
|
|
# Copyright (C) 2021 - present Instructure, Inc.
|
|
|
|
#
|
|
|
|
# This file is part of Canvas.
|
|
|
|
#
|
|
|
|
# Canvas is free software: you can redistribute it and/or modify it under
|
|
|
|
# the terms of the GNU Affero General Public License as published by the Free
|
|
|
|
# Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
|
|
# details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License along
|
|
|
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
class CreateMicrosoftSyncPartialSyncChanges < ActiveRecord::Migration[6.0]
|
|
|
|
tag :predeploy
|
|
|
|
|
|
|
|
def change
|
|
|
|
create_table :microsoft_sync_partial_sync_changes do |t|
|
|
|
|
t.references :course, foreign_key: true, null: false
|
|
|
|
t.references :user, foreign_key: true, null: false
|
|
|
|
t.references :root_account, foreign_key: { to_table: :accounts }, index: false, null: false
|
|
|
|
|
|
|
|
t.string :enrollment_type, null: false
|
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
|
2023-04-29 04:59:51 +08:00
|
|
|
t.index %i[course_id user_id enrollment_type],
|
|
|
|
unique: true,
|
|
|
|
name: "index_microsoft_sync_partial_sync_changes_course_user_enroll"
|
Add PartialSyncChange Table
Creates the MicrosoftSync::PartialSyncChange Table. With this table,
we'll be able to track what users need to be examined when performing a
partial sync for the Microsoft Teams sync integration.
closes INTEROP-6803
flag = microsoft_group_enrollments_syncing
test-plan:
* Pull the change down and migrate your database.
* Using a rails console, try to create a
MicrosoftSync::PartialSyncChange record without any other parameters. It
should fail, as you have to have a course, user, and enrollment_type.
* Try and create another record, first with just a course, then just a
user, then just an enrollment type. Again, this should all fail.
* Create a new record, this time with a User, Course, and
enrollment_type (this should be "owner" or "member") and save it to
the database.
* Try and create another record with all of the same parameters. This
should fail, due to uniqueness contraints.
* Try and create another record with the same User and Course, but use
the opposite enrollment_type. This should successfully save.
Change-Id: I8ae899036672bc1e65d26a560c35743d7fb22024
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265628
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-05-25 05:19:47 +08:00
|
|
|
|
2023-04-29 04:59:51 +08:00
|
|
|
t.index [:root_account_id, :id],
|
|
|
|
unique: true,
|
|
|
|
name: "index_microsoft_sync_partial_sync_changes_replica_identity"
|
Add PartialSyncChange Table
Creates the MicrosoftSync::PartialSyncChange Table. With this table,
we'll be able to track what users need to be examined when performing a
partial sync for the Microsoft Teams sync integration.
closes INTEROP-6803
flag = microsoft_group_enrollments_syncing
test-plan:
* Pull the change down and migrate your database.
* Using a rails console, try to create a
MicrosoftSync::PartialSyncChange record without any other parameters. It
should fail, as you have to have a course, user, and enrollment_type.
* Try and create another record, first with just a course, then just a
user, then just an enrollment type. Again, this should all fail.
* Create a new record, this time with a User, Course, and
enrollment_type (this should be "owner" or "member") and save it to
the database.
* Try and create another record with all of the same parameters. This
should fail, due to uniqueness contraints.
* Try and create another record with the same User and Course, but use
the opposite enrollment_type. This should successfully save.
Change-Id: I8ae899036672bc1e65d26a560c35743d7fb22024
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265628
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-05-25 05:19:47 +08:00
|
|
|
end
|
|
|
|
set_replica_identity(:microsoft_sync_partial_sync_changes, :index_microsoft_sync_partial_sync_changes_replica_identity)
|
|
|
|
end
|
|
|
|
end
|