canvas_sync 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9134dcc286332c0330b16783033e524f75b69f7039455d2e0aab562a50709181
4
- data.tar.gz: 6575d7cb108b9977015db6f0e55c9de6fc3d7e0c8753e18889b381384d87b6e3
3
+ metadata.gz: 911d67b330dfd137deb4a5bc9dc87ae99efcd2f4906d27925044985299d405ff
4
+ data.tar.gz: e7ae278ea03a7cb0ef557af6b71f778b2754d0975e555c09894627b57c955c6f
5
5
  SHA512:
6
- metadata.gz: d21d1deaec48dc3eb4c008eacdf0336373a4aa3a0e0bf4d9e68050b65b7529be883756408b97999aa13a78d6c1c158412beaf3413fef87ece53a1623651be91b
7
- data.tar.gz: f8e73459889128a11793ecb0d9edf423edc3504c071eec4ed8728b79764f803395aa71a9a348108e38604eab1aedeba815cd023f75cfaa740686c22a5adec181
6
+ metadata.gz: c3dc580b3581a1549b85816f46eaca388abbd2cb5ca7db44bc1fb96fc2d453ace537beb7d8ac31ad53b0ef8ac365b45f4a1eeed0772791ef6d957087c5367ee6
7
+ data.tar.gz: e5785c8363ab10efafd1eee7798e1a5869067c65a998000cdac16418c194e50fca56e843f37c33449e456a80171d1f78ef6891377c66f53a188f4ecbbf63cd22
data/lib/canvas_sync.rb CHANGED
@@ -46,6 +46,7 @@ module CanvasSync
46
46
  syllabus
47
47
  grade
48
48
  module
49
+ module_item
49
50
  ].freeze
50
51
 
51
52
  # Runs a standard provisioning sync job with no extra report types.
@@ -0,0 +1,6 @@
1
+ # <%= autogenerated_event_warning %>
2
+
3
+ module LiveEvents
4
+ class ModuleItemCreatedEvent < LiveEvents::ModuleItemEvent
5
+ end
6
+ end
@@ -0,0 +1,37 @@
1
+ # <%= autogenerated_event_warning %>
2
+
3
+ module LiveEvents
4
+ class ModuleItemEvent < LiveEvents::BaseEvent
5
+ # The following is provided in the live events call:
6
+ # {
7
+ # module_item_id,
8
+ # module_id,
9
+ # context_id,
10
+ # context_type,
11
+ # position,
12
+ # workflow_state,
13
+ # }
14
+
15
+ def perform(_event_payload)
16
+ super
17
+ create_or_update_from_api(payload)
18
+ end
19
+
20
+ private
21
+
22
+ def create_or_update_from_api(payload)
23
+ context_module_item = ContextModuleItem.find_or_initialize_by(canvas_context_module_item_id: payload["module_item_id"])
24
+ api_params = canvas_sync_client.module_item(payload["context_id"], payload["module_id"], payload["module_item_id"])
25
+
26
+ context_module_item.assign_attributes(
27
+ canvas_context_module_id: payload["module_id"],
28
+ position: payload["position"],
29
+ workflow_state: payload["workflow_state"],
30
+ content_id: api_params["content_id"],
31
+ content_type: api_params["type"],
32
+ )
33
+
34
+ context_module_item.save! if context_module_item.changed?
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,6 @@
1
+ # <%= autogenerated_event_warning %>
2
+
3
+ module LiveEvents
4
+ class ModuleItemUpdatedEvent < LiveEvents::ModuleItemEvent
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
@@ -0,0 +1,47 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe LiveEvents::ModuleItemEvent do
4
+ let(:payload) {
5
+ {
6
+ "body" => {
7
+ module_item_id: 1,
8
+ module_id: 1,
9
+ context_id: 1,
10
+ context_type: "assignment",
11
+ position: 10,
12
+ workflow_state: "active",
13
+ },
14
+ }
15
+ }
16
+
17
+ describe "#perform" do
18
+ context "the module item already exists" do
19
+ let!(:cmi) { FactoryGirl.create(:context_module_item, canvas_context_module_item_id: payload["body"][:module_item_id]) }
20
+
21
+ it "updates it" do
22
+ expect {
23
+ LiveEvents::ModuleItemEvent.new.perform(payload)
24
+ }.to_not change { ContextModuleItem.count }
25
+ expect(cmi.reload.canvas_context_module_id).to eq(payload["body"][:module_item_id])
26
+ expect(cmi.position).to eq(payload["body"][:position])
27
+ expect(cmi.workflow_state).to eq(payload["body"][:workflow_state])
28
+ expect(cmi.content_type).to eq("Assignment")
29
+ expect(cmi.content_id).to eq(143)
30
+ end
31
+ end
32
+
33
+ context "the module item does not already exist" do
34
+ it "creates it" do
35
+ expect {
36
+ LiveEvents::ModuleItemEvent.new.perform(payload)
37
+ }.to change { ContextModuleItem.count }.by(1)
38
+ cmi = ContextModuleItem.last
39
+ expect(cmi.canvas_context_module_id).to eq(payload["body"][:module_item_id])
40
+ expect(cmi.position).to eq(payload["body"][:position])
41
+ expect(cmi.workflow_state).to eq(payload["body"][:workflow_state])
42
+ expect(cmi.content_type).to eq("Assignment")
43
+ expect(cmi.content_id).to eq(143)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ # #
2
+ # AUTO GENERATED LIVE EVENT
3
+ # This was auto generated by the CanvasSync Gem.
4
+ # You can customize it as needed, but make sure you test
5
+ # any changes you make to the auto generated methods.
6
+ #
7
+
8
+
9
+ module LiveEvents
10
+ class ModuleItemCreatedEvent < LiveEvents::ModuleItemEvent
11
+ end
12
+ end
@@ -0,0 +1,43 @@
1
+ # #
2
+ # AUTO GENERATED LIVE EVENT
3
+ # This was auto generated by the CanvasSync Gem.
4
+ # You can customize it as needed, but make sure you test
5
+ # any changes you make to the auto generated methods.
6
+ #
7
+
8
+
9
+ module LiveEvents
10
+ class ModuleItemEvent < LiveEvents::BaseEvent
11
+ # The following is provided in the live events call:
12
+ # {
13
+ # module_item_id,
14
+ # module_id,
15
+ # context_id,
16
+ # context_type,
17
+ # position,
18
+ # workflow_state,
19
+ # }
20
+
21
+ def perform(_event_payload)
22
+ super
23
+ create_or_update_from_api(payload)
24
+ end
25
+
26
+ private
27
+
28
+ def create_or_update_from_api(payload)
29
+ context_module_item = ContextModuleItem.find_or_initialize_by(canvas_context_module_item_id: payload["module_item_id"])
30
+ api_params = canvas_sync_client.module_item(payload["context_id"], payload["module_id"], payload["module_item_id"])
31
+
32
+ context_module_item.assign_attributes(
33
+ canvas_context_module_id: payload["module_id"],
34
+ position: payload["position"],
35
+ workflow_state: payload["workflow_state"],
36
+ content_id: api_params["content_id"],
37
+ content_type: api_params["type"],
38
+ )
39
+
40
+ context_module_item.save! if context_module_item.changed?
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,12 @@
1
+ # #
2
+ # AUTO GENERATED LIVE EVENT
3
+ # This was auto generated by the CanvasSync Gem.
4
+ # You can customize it as needed, but make sure you test
5
+ # any changes you make to the auto generated methods.
6
+ #
7
+
8
+
9
+ module LiveEvents
10
+ class ModuleItemUpdatedEvent < LiveEvents::ModuleItemEvent
11
+ end
12
+ end
@@ -2841,3 +2841,447 @@ Migrating to CreateContextModuleItems (20180411215633)
2841
2841
   (0.5ms) COMMIT
2842
2842
   (0.2ms) SELECT pg_advisory_unlock(1438354376499275445)
2843
2843
   (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2844
+  (14.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2845
+  (8.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2846
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2847
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2848
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2849
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2850
+  (210.0ms) DROP DATABASE IF EXISTS "canvas_sync_development"
2851
+  (197.9ms) DROP DATABASE IF EXISTS "canvas_sync_test"
2852
+  (11.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2853
+  (4.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2854
+  (0.2ms) SELECT pg_try_advisory_lock(1438354376499275445)
2855
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2856
+ Migrating to CreateEnrollments (20170905192509)
2857
+  (0.1ms) BEGIN
2858
+  (19.7ms) CREATE TABLE "enrollments" ("id" bigserial primary key, "canvas_enrollment_id" bigint NOT NULL, "canvas_course_id" bigint, "course_sis_id" character varying, "canvas_user_id" bigint, "user_sis_id" character varying, "role" character varying, "role_id" integer, "canvas_section_id" bigint, "section_sis_id" character varying, "status" character varying, "base_role_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2859
+  (1.6ms) CREATE UNIQUE INDEX "index_enrollments_on_canvas_enrollment_id" ON "enrollments" ("canvas_enrollment_id")
2860
+  (1.8ms) CREATE INDEX "index_enrollments_on_canvas_course_id" ON "enrollments" ("canvas_course_id")
2861
+  (1.7ms) CREATE INDEX "index_enrollments_on_canvas_user_id" ON "enrollments" ("canvas_user_id")
2862
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170905192509"]]
2863
+  (0.5ms) COMMIT
2864
+ Migrating to CreateTerms (20170906193506)
2865
+  (0.2ms) BEGIN
2866
+  (5.4ms) CREATE TABLE "terms" ("id" bigserial primary key, "canvas_term_id" integer NOT NULL, "name" character varying, "start_at" timestamp, "end_at" timestamp, "workflow_state" character varying, "grading_period_group_id" integer, "sis_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2867
+  (1.6ms) CREATE UNIQUE INDEX "index_terms_on_canvas_term_id" ON "terms" ("canvas_term_id")
2868
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170906193506"]]
2869
+  (0.4ms) COMMIT
2870
+ Migrating to CreateCourses (20170914181345)
2871
+  (0.2ms) BEGIN
2872
+  (5.1ms) CREATE TABLE "courses" ("id" bigserial primary key, "canvas_course_id" bigint NOT NULL, "sis_id" character varying, "short_name" character varying, "long_name" character varying, "status" character varying, "canvas_account_id" integer, "canvas_term_id" integer, "term_sis_id" integer, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2873
+  (1.5ms) CREATE UNIQUE INDEX "index_courses_on_canvas_course_id" ON "courses" ("canvas_course_id")
2874
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170914181345"]]
2875
+  (0.3ms) COMMIT
2876
+ Migrating to CreateCanvasSyncJobLog (20170915210836)
2877
+  (6.0ms) BEGIN
2878
+  (21.6ms) CREATE TABLE "canvas_sync_job_logs" ("id" bigserial primary key, "started_at" timestamp, "completed_at" timestamp, "exception" character varying, "backtrace" text, "job_class" character varying, "status" character varying, "metadata" text, "job_arguments" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2879
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170915210836"]]
2880
+  (0.5ms) COMMIT
2881
+ Migrating to CreateUsers (20170918221413)
2882
+  (0.2ms) BEGIN
2883
+  (5.0ms) CREATE TABLE "users" ("id" bigserial primary key, "canvas_user_id" bigint NOT NULL, "sis_id" character varying, "email" character varying, "first_name" character varying, "last_name" character varying, "status" character varying, "login_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2884
+  (1.5ms) CREATE UNIQUE INDEX "index_users_on_canvas_user_id" ON "users" ("canvas_user_id")
2885
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170918221413"]]
2886
+  (0.4ms) COMMIT
2887
+ Migrating to CreateSections (20171107213207)
2888
+  (0.2ms) BEGIN
2889
+  (4.8ms) CREATE TABLE "sections" ("id" bigserial primary key, "canvas_section_id" bigint NOT NULL, "sis_id" character varying, "canvas_course_id" bigint, "canvas_nonxlist_course_id" bigint, "name" character varying, "status" character varying, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2890
+  (1.7ms) CREATE UNIQUE INDEX "index_sections_on_canvas_section_id" ON "sections" ("canvas_section_id")
2891
+  (1.7ms) CREATE INDEX "index_sections_on_canvas_course_id" ON "sections" ("canvas_course_id")
2892
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171107213207"]]
2893
+  (0.4ms) COMMIT
2894
+ Migrating to CreateRoles (20180103162102)
2895
+  (0.2ms) BEGIN
2896
+  (5.3ms) CREATE TABLE "roles" ("id" bigserial primary key, "canvas_role_id" integer NOT NULL, "label" character varying NOT NULL, "base_role_type" character varying NOT NULL, "account" json, "workflow_state" character varying NOT NULL, "permissions" json, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2897
+  (1.7ms) CREATE UNIQUE INDEX "index_roles_on_canvas_role_id" ON "roles" ("canvas_role_id")
2898
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180103162102"]]
2899
+  (0.5ms) COMMIT
2900
+ Migrating to CreateAdmins (20180109210452)
2901
+  (0.2ms) BEGIN
2902
+  (4.8ms) CREATE TABLE "admins" ("id" bigserial primary key, "canvas_admin_id" bigint NOT NULL, "role_name" character varying, "canvas_role_id" bigint NOT NULL, "user_data" json, "canvas_user_id" bigint NOT NULL, "workflow_state" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2903
+  (2.0ms) CREATE UNIQUE INDEX "index_admins_on_canvas_admin_id" ON "admins" ("canvas_admin_id")
2904
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180109210452"]]
2905
+  (0.4ms) COMMIT
2906
+ Migrating to CreateAssignments (20180215214227)
2907
+  (0.2ms) BEGIN
2908
+  (5.2ms) CREATE TABLE "assignments" ("id" bigserial primary key, "canvas_assignment_id" bigint NOT NULL, "title" character varying, "description" text, "due_at" timestamp, "unlock_at" timestamp, "lock_at" timestamp, "points_possible" integer, "min_score" integer, "max_score" integer, "mastery_score" integer, "grading_type" character varying, "submission_types" character varying, "workflow_state" character varying, "context_id" integer, "context_type" character varying, "canvas_assignment_group_id" integer, "grading_scheme_id" integer, "grading_standard_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2909
+  (1.5ms) CREATE UNIQUE INDEX "index_assignments_on_canvas_assignment_id" ON "assignments" ("canvas_assignment_id")
2910
+  (1.6ms) CREATE INDEX "index_assignments_on_context_id_and_context_type" ON "assignments" ("context_id", "context_type")
2911
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180215214227"]]
2912
+  (0.4ms) COMMIT
2913
+ Migrating to CreateSubmissions (20180216171618)
2914
+  (0.2ms) BEGIN
2915
+  (5.1ms) CREATE TABLE "submissions" ("id" bigserial primary key, "canvas_submission_id" bigint NOT NULL, "canvas_course_id" bigint, "canvas_assignment_id" bigint, "canvas_user_id" bigint, "submitted_at" timestamp, "graded_at" timestamp, "score" integer, "points_possible" integer, "excused" boolean, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2916
+  (1.6ms) CREATE UNIQUE INDEX "index_submissions_on_canvas_submission_id" ON "submissions" ("canvas_submission_id")
2917
+  (1.6ms) CREATE INDEX "index_submissions_on_canvas_assignment_id" ON "submissions" ("canvas_assignment_id")
2918
+  (1.9ms) CREATE INDEX "index_submissions_on_canvas_course_id" ON "submissions" ("canvas_course_id")
2919
+  (1.6ms) CREATE INDEX "index_submissions_on_canvas_user_id" ON "submissions" ("canvas_user_id")
2920
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180216171618"]]
2921
+  (0.4ms) COMMIT
2922
+ Migrating to CreateAccounts (20180220172559)
2923
+  (0.2ms) BEGIN
2924
+  (5.2ms) CREATE TABLE "accounts" ("id" bigserial primary key, "canvas_account_id" bigint NOT NULL, "account_id" character varying, "canvas_parent_id" bigint, "parent_account_id" character varying, "name" character varying, "status" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2925
+  (1.7ms) CREATE UNIQUE INDEX "index_accounts_on_canvas_account_id" ON "accounts" ("canvas_account_id")
2926
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180220172559"]]
2927
+  (0.4ms) COMMIT
2928
+ Migrating to CreateAssignmentGroups (20180222163506)
2929
+  (0.2ms) BEGIN
2930
+  (5.4ms) CREATE TABLE "assignment_groups" ("id" bigserial primary key, "canvas_assignment_group_id" bigint NOT NULL, "canvas_course_id" bigint, "name" character varying, "rules" text, "position" integer, "group_weight" float, "workflow_state" character varying, "canvas_created_at" timestamp, "canvas_updated_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2931
+  (1.7ms) CREATE UNIQUE INDEX "index_assignment_groups_on_canvas_assignment_group_id" ON "assignment_groups" ("canvas_assignment_group_id")
2932
+  (1.6ms) CREATE INDEX "index_assignment_groups_on_canvas_course_id" ON "assignment_groups" ("canvas_course_id")
2933
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180222163506"]]
2934
+  (0.5ms) COMMIT
2935
+ Migrating to CreateContextModules (20180411215348)
2936
+  (0.2ms) BEGIN
2937
+  (4.9ms) CREATE TABLE "context_modules" ("id" bigserial primary key, "canvas_context_module_id" bigint, "canvas_context_id" bigint, "canvas_context_type" character varying, "position" integer, "name" character varying, "workflow_state" character varying, "deleted_at" timestamp, "unlock_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2938
+  (1.4ms) CREATE UNIQUE INDEX "index_context_modules_on_canvas_context_module_id" ON "context_modules" ("canvas_context_module_id")
2939
+  (1.6ms) CREATE INDEX "index_context_modules_on_context" ON "context_modules" ("canvas_context_id", "canvas_context_type")
2940
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215348"]]
2941
+  (0.4ms) COMMIT
2942
+ Migrating to CreateContextModuleItems (20180411215633)
2943
+  (0.2ms) BEGIN
2944
+  (4.8ms) CREATE TABLE "context_module_items" ("id" bigserial primary key, "canvas_context_module_item_id" bigint, "canvas_context_module_id" bigint, "position" integer, "content_type" character varying, "content_id" bigint, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2945
+  (1.7ms) CREATE UNIQUE INDEX "index_context_module_items_on_canvas_context_module_item_id" ON "context_module_items" ("canvas_context_module_item_id")
2946
+  (1.7ms) CREATE INDEX "index_context_module_items_on_canvas_context_module_id" ON "context_module_items" ("canvas_context_module_id")
2947
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215633"]]
2948
+  (0.4ms) COMMIT
2949
+ ActiveRecord::InternalMetadata Load (1.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2950
+  (0.1ms) BEGIN
2951
+ SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-05-02 18:57:15.642239"], ["updated_at", "2018-05-02 18:57:15.642239"]]
2952
+  (0.4ms) COMMIT
2953
+  (0.2ms) SELECT pg_advisory_unlock(1438354376499275445)
2954
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2955
+  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2956
+  (1.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2957
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2958
+  (0.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2959
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2960
+  (0.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
2961
+  (152.3ms) DROP DATABASE IF EXISTS "canvas_sync_development"
2962
+  (200.7ms) DROP DATABASE IF EXISTS "canvas_sync_test"
2963
+  (17.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
2964
+  (5.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2965
+  (0.2ms) SELECT pg_try_advisory_lock(1438354376499275445)
2966
+  (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
2967
+ Migrating to CreateEnrollments (20170905192509)
2968
+  (0.2ms) BEGIN
2969
+  (8.1ms) CREATE TABLE "enrollments" ("id" bigserial primary key, "canvas_enrollment_id" bigint NOT NULL, "canvas_course_id" bigint, "course_sis_id" character varying, "canvas_user_id" bigint, "user_sis_id" character varying, "role" character varying, "role_id" integer, "canvas_section_id" bigint, "section_sis_id" character varying, "status" character varying, "base_role_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2970
+  (2.0ms) CREATE UNIQUE INDEX "index_enrollments_on_canvas_enrollment_id" ON "enrollments" ("canvas_enrollment_id")
2971
+  (2.1ms) CREATE INDEX "index_enrollments_on_canvas_course_id" ON "enrollments" ("canvas_course_id")
2972
+  (2.0ms) CREATE INDEX "index_enrollments_on_canvas_user_id" ON "enrollments" ("canvas_user_id")
2973
+ SQL (1.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170905192509"]]
2974
+  (0.9ms) COMMIT
2975
+ Migrating to CreateTerms (20170906193506)
2976
+  (0.9ms) BEGIN
2977
+  (5.2ms) CREATE TABLE "terms" ("id" bigserial primary key, "canvas_term_id" integer NOT NULL, "name" character varying, "start_at" timestamp, "end_at" timestamp, "workflow_state" character varying, "grading_period_group_id" integer, "sis_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2978
+  (2.5ms) CREATE UNIQUE INDEX "index_terms_on_canvas_term_id" ON "terms" ("canvas_term_id")
2979
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170906193506"]]
2980
+  (0.5ms) COMMIT
2981
+ Migrating to CreateCourses (20170914181345)
2982
+  (0.4ms) BEGIN
2983
+  (6.9ms) CREATE TABLE "courses" ("id" bigserial primary key, "canvas_course_id" bigint NOT NULL, "sis_id" character varying, "short_name" character varying, "long_name" character varying, "status" character varying, "canvas_account_id" integer, "canvas_term_id" integer, "term_sis_id" integer, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2984
+  (2.3ms) CREATE UNIQUE INDEX "index_courses_on_canvas_course_id" ON "courses" ("canvas_course_id")
2985
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170914181345"]]
2986
+  (0.4ms) COMMIT
2987
+ Migrating to CreateCanvasSyncJobLog (20170915210836)
2988
+  (0.3ms) BEGIN
2989
+  (5.8ms) CREATE TABLE "canvas_sync_job_logs" ("id" bigserial primary key, "started_at" timestamp, "completed_at" timestamp, "exception" character varying, "backtrace" text, "job_class" character varying, "status" character varying, "metadata" text, "job_arguments" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2990
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170915210836"]]
2991
+  (0.4ms) COMMIT
2992
+ Migrating to CreateUsers (20170918221413)
2993
+  (0.3ms) BEGIN
2994
+  (6.4ms) CREATE TABLE "users" ("id" bigserial primary key, "canvas_user_id" bigint NOT NULL, "sis_id" character varying, "email" character varying, "first_name" character varying, "last_name" character varying, "status" character varying, "login_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2995
+  (2.0ms) CREATE UNIQUE INDEX "index_users_on_canvas_user_id" ON "users" ("canvas_user_id")
2996
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170918221413"]]
2997
+  (0.6ms) COMMIT
2998
+ Migrating to CreateSections (20171107213207)
2999
+  (0.2ms) BEGIN
3000
+  (5.1ms) CREATE TABLE "sections" ("id" bigserial primary key, "canvas_section_id" bigint NOT NULL, "sis_id" character varying, "canvas_course_id" bigint, "canvas_nonxlist_course_id" bigint, "name" character varying, "status" character varying, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3001
+  (1.5ms) CREATE UNIQUE INDEX "index_sections_on_canvas_section_id" ON "sections" ("canvas_section_id")
3002
+  (1.5ms) CREATE INDEX "index_sections_on_canvas_course_id" ON "sections" ("canvas_course_id")
3003
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171107213207"]]
3004
+  (0.4ms) COMMIT
3005
+ Migrating to CreateRoles (20180103162102)
3006
+  (0.2ms) BEGIN
3007
+  (5.6ms) CREATE TABLE "roles" ("id" bigserial primary key, "canvas_role_id" integer NOT NULL, "label" character varying NOT NULL, "base_role_type" character varying NOT NULL, "account" json, "workflow_state" character varying NOT NULL, "permissions" json, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3008
+  (1.9ms) CREATE UNIQUE INDEX "index_roles_on_canvas_role_id" ON "roles" ("canvas_role_id")
3009
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180103162102"]]
3010
+  (0.5ms) COMMIT
3011
+ Migrating to CreateAdmins (20180109210452)
3012
+  (0.2ms) BEGIN
3013
+  (5.0ms) CREATE TABLE "admins" ("id" bigserial primary key, "canvas_admin_id" bigint NOT NULL, "role_name" character varying, "canvas_role_id" bigint NOT NULL, "user_data" json, "canvas_user_id" bigint NOT NULL, "workflow_state" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3014
+  (1.8ms) CREATE UNIQUE INDEX "index_admins_on_canvas_admin_id" ON "admins" ("canvas_admin_id")
3015
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180109210452"]]
3016
+  (0.4ms) COMMIT
3017
+ Migrating to CreateAssignments (20180215214227)
3018
+  (0.2ms) BEGIN
3019
+  (5.8ms) CREATE TABLE "assignments" ("id" bigserial primary key, "canvas_assignment_id" bigint NOT NULL, "title" character varying, "description" text, "due_at" timestamp, "unlock_at" timestamp, "lock_at" timestamp, "points_possible" integer, "min_score" integer, "max_score" integer, "mastery_score" integer, "grading_type" character varying, "submission_types" character varying, "workflow_state" character varying, "context_id" integer, "context_type" character varying, "canvas_assignment_group_id" integer, "grading_scheme_id" integer, "grading_standard_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3020
+  (1.8ms) CREATE UNIQUE INDEX "index_assignments_on_canvas_assignment_id" ON "assignments" ("canvas_assignment_id")
3021
+  (1.7ms) CREATE INDEX "index_assignments_on_context_id_and_context_type" ON "assignments" ("context_id", "context_type")
3022
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180215214227"]]
3023
+  (0.5ms) COMMIT
3024
+ Migrating to CreateSubmissions (20180216171618)
3025
+  (0.2ms) BEGIN
3026
+  (4.9ms) CREATE TABLE "submissions" ("id" bigserial primary key, "canvas_submission_id" bigint NOT NULL, "canvas_course_id" bigint, "canvas_assignment_id" bigint, "canvas_user_id" bigint, "submitted_at" timestamp, "graded_at" timestamp, "score" integer, "points_possible" integer, "excused" boolean, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3027
+  (1.6ms) CREATE UNIQUE INDEX "index_submissions_on_canvas_submission_id" ON "submissions" ("canvas_submission_id")
3028
+  (1.6ms) CREATE INDEX "index_submissions_on_canvas_assignment_id" ON "submissions" ("canvas_assignment_id")
3029
+  (1.9ms) CREATE INDEX "index_submissions_on_canvas_course_id" ON "submissions" ("canvas_course_id")
3030
+  (1.9ms) CREATE INDEX "index_submissions_on_canvas_user_id" ON "submissions" ("canvas_user_id")
3031
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180216171618"]]
3032
+  (0.4ms) COMMIT
3033
+ Migrating to CreateAccounts (20180220172559)
3034
+  (0.3ms) BEGIN
3035
+  (6.0ms) CREATE TABLE "accounts" ("id" bigserial primary key, "canvas_account_id" bigint NOT NULL, "account_id" character varying, "canvas_parent_id" bigint, "parent_account_id" character varying, "name" character varying, "status" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3036
+  (2.2ms) CREATE UNIQUE INDEX "index_accounts_on_canvas_account_id" ON "accounts" ("canvas_account_id")
3037
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180220172559"]]
3038
+  (0.4ms) COMMIT
3039
+ Migrating to CreateAssignmentGroups (20180222163506)
3040
+  (0.2ms) BEGIN
3041
+  (6.2ms) CREATE TABLE "assignment_groups" ("id" bigserial primary key, "canvas_assignment_group_id" bigint NOT NULL, "canvas_course_id" bigint, "name" character varying, "rules" text, "position" integer, "group_weight" float, "workflow_state" character varying, "canvas_created_at" timestamp, "canvas_updated_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3042
+  (2.1ms) CREATE UNIQUE INDEX "index_assignment_groups_on_canvas_assignment_group_id" ON "assignment_groups" ("canvas_assignment_group_id")
3043
+  (1.7ms) CREATE INDEX "index_assignment_groups_on_canvas_course_id" ON "assignment_groups" ("canvas_course_id")
3044
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180222163506"]]
3045
+  (0.5ms) COMMIT
3046
+ Migrating to CreateContextModules (20180411215348)
3047
+  (0.2ms) BEGIN
3048
+  (4.9ms) CREATE TABLE "context_modules" ("id" bigserial primary key, "canvas_context_module_id" bigint, "canvas_context_id" bigint, "canvas_context_type" character varying, "position" integer, "name" character varying, "workflow_state" character varying, "deleted_at" timestamp, "unlock_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3049
+  (1.5ms) CREATE UNIQUE INDEX "index_context_modules_on_canvas_context_module_id" ON "context_modules" ("canvas_context_module_id")
3050
+  (1.8ms) CREATE INDEX "index_context_modules_on_context" ON "context_modules" ("canvas_context_id", "canvas_context_type")
3051
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215348"]]
3052
+  (0.4ms) COMMIT
3053
+ Migrating to CreateContextModuleItems (20180411215633)
3054
+  (0.2ms) BEGIN
3055
+  (5.4ms) CREATE TABLE "context_module_items" ("id" bigserial primary key, "canvas_context_module_item_id" bigint, "canvas_context_module_id" bigint, "position" integer, "content_type" character varying, "content_id" bigint, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3056
+  (1.7ms) CREATE UNIQUE INDEX "index_context_module_items_on_canvas_context_module_item_id" ON "context_module_items" ("canvas_context_module_item_id")
3057
+  (2.0ms) CREATE INDEX "index_context_module_items_on_canvas_context_module_id" ON "context_module_items" ("canvas_context_module_id")
3058
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215633"]]
3059
+  (0.5ms) COMMIT
3060
+ ActiveRecord::InternalMetadata Load (1.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
3061
+  (0.1ms) BEGIN
3062
+ SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-05-02 19:12:11.751650"], ["updated_at", "2018-05-02 19:12:11.751650"]]
3063
+  (0.3ms) COMMIT
3064
+  (0.2ms) SELECT pg_advisory_unlock(1438354376499275445)
3065
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3066
+  (8.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3067
+  (9.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
3068
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3069
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
3070
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3071
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
3072
+  (199.5ms) DROP DATABASE IF EXISTS "canvas_sync_development"
3073
+  (201.8ms) DROP DATABASE IF EXISTS "canvas_sync_test"
3074
+  (14.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
3075
+  (5.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3076
+  (0.2ms) SELECT pg_try_advisory_lock(1438354376499275445)
3077
+  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3078
+ Migrating to CreateEnrollments (20170905192509)
3079
+  (0.1ms) BEGIN
3080
+  (16.2ms) CREATE TABLE "enrollments" ("id" bigserial primary key, "canvas_enrollment_id" bigint NOT NULL, "canvas_course_id" bigint, "course_sis_id" character varying, "canvas_user_id" bigint, "user_sis_id" character varying, "role" character varying, "role_id" integer, "canvas_section_id" bigint, "section_sis_id" character varying, "status" character varying, "base_role_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3081
+  (7.6ms) CREATE UNIQUE INDEX "index_enrollments_on_canvas_enrollment_id" ON "enrollments" ("canvas_enrollment_id")
3082
+  (7.0ms) CREATE INDEX "index_enrollments_on_canvas_course_id" ON "enrollments" ("canvas_course_id")
3083
+  (6.9ms) CREATE INDEX "index_enrollments_on_canvas_user_id" ON "enrollments" ("canvas_user_id")
3084
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170905192509"]]
3085
+  (6.2ms) COMMIT
3086
+ Migrating to CreateTerms (20170906193506)
3087
+  (0.2ms) BEGIN
3088
+  (5.1ms) CREATE TABLE "terms" ("id" bigserial primary key, "canvas_term_id" integer NOT NULL, "name" character varying, "start_at" timestamp, "end_at" timestamp, "workflow_state" character varying, "grading_period_group_id" integer, "sis_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3089
+  (1.7ms) CREATE UNIQUE INDEX "index_terms_on_canvas_term_id" ON "terms" ("canvas_term_id")
3090
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170906193506"]]
3091
+  (0.4ms) COMMIT
3092
+ Migrating to CreateCourses (20170914181345)
3093
+  (0.4ms) BEGIN
3094
+  (5.8ms) CREATE TABLE "courses" ("id" bigserial primary key, "canvas_course_id" bigint NOT NULL, "sis_id" character varying, "short_name" character varying, "long_name" character varying, "status" character varying, "canvas_account_id" integer, "canvas_term_id" integer, "term_sis_id" integer, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3095
+  (1.7ms) CREATE UNIQUE INDEX "index_courses_on_canvas_course_id" ON "courses" ("canvas_course_id")
3096
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170914181345"]]
3097
+  (0.4ms) COMMIT
3098
+ Migrating to CreateCanvasSyncJobLog (20170915210836)
3099
+  (6.1ms) BEGIN
3100
+  (17.2ms) CREATE TABLE "canvas_sync_job_logs" ("id" bigserial primary key, "started_at" timestamp, "completed_at" timestamp, "exception" character varying, "backtrace" text, "job_class" character varying, "status" character varying, "metadata" text, "job_arguments" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3101
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170915210836"]]
3102
+  (0.4ms) COMMIT
3103
+ Migrating to CreateUsers (20170918221413)
3104
+  (0.2ms) BEGIN
3105
+  (5.5ms) CREATE TABLE "users" ("id" bigserial primary key, "canvas_user_id" bigint NOT NULL, "sis_id" character varying, "email" character varying, "first_name" character varying, "last_name" character varying, "status" character varying, "login_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3106
+  (1.5ms) CREATE UNIQUE INDEX "index_users_on_canvas_user_id" ON "users" ("canvas_user_id")
3107
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170918221413"]]
3108
+  (0.4ms) COMMIT
3109
+ Migrating to CreateSections (20171107213207)
3110
+  (0.3ms) BEGIN
3111
+  (6.2ms) CREATE TABLE "sections" ("id" bigserial primary key, "canvas_section_id" bigint NOT NULL, "sis_id" character varying, "canvas_course_id" bigint, "canvas_nonxlist_course_id" bigint, "name" character varying, "status" character varying, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3112
+  (2.5ms) CREATE UNIQUE INDEX "index_sections_on_canvas_section_id" ON "sections" ("canvas_section_id")
3113
+  (2.7ms) CREATE INDEX "index_sections_on_canvas_course_id" ON "sections" ("canvas_course_id")
3114
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171107213207"]]
3115
+  (0.6ms) COMMIT
3116
+ Migrating to CreateRoles (20180103162102)
3117
+  (0.4ms) BEGIN
3118
+  (7.8ms) CREATE TABLE "roles" ("id" bigserial primary key, "canvas_role_id" integer NOT NULL, "label" character varying NOT NULL, "base_role_type" character varying NOT NULL, "account" json, "workflow_state" character varying NOT NULL, "permissions" json, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3119
+  (3.6ms) CREATE UNIQUE INDEX "index_roles_on_canvas_role_id" ON "roles" ("canvas_role_id")
3120
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180103162102"]]
3121
+  (0.6ms) COMMIT
3122
+ Migrating to CreateAdmins (20180109210452)
3123
+  (0.4ms) BEGIN
3124
+  (7.3ms) CREATE TABLE "admins" ("id" bigserial primary key, "canvas_admin_id" bigint NOT NULL, "role_name" character varying, "canvas_role_id" bigint NOT NULL, "user_data" json, "canvas_user_id" bigint NOT NULL, "workflow_state" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3125
+  (2.0ms) CREATE UNIQUE INDEX "index_admins_on_canvas_admin_id" ON "admins" ("canvas_admin_id")
3126
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180109210452"]]
3127
+  (0.4ms) COMMIT
3128
+ Migrating to CreateAssignments (20180215214227)
3129
+  (0.3ms) BEGIN
3130
+  (6.0ms) CREATE TABLE "assignments" ("id" bigserial primary key, "canvas_assignment_id" bigint NOT NULL, "title" character varying, "description" text, "due_at" timestamp, "unlock_at" timestamp, "lock_at" timestamp, "points_possible" integer, "min_score" integer, "max_score" integer, "mastery_score" integer, "grading_type" character varying, "submission_types" character varying, "workflow_state" character varying, "context_id" integer, "context_type" character varying, "canvas_assignment_group_id" integer, "grading_scheme_id" integer, "grading_standard_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3131
+  (1.8ms) CREATE UNIQUE INDEX "index_assignments_on_canvas_assignment_id" ON "assignments" ("canvas_assignment_id")
3132
+  (1.8ms) CREATE INDEX "index_assignments_on_context_id_and_context_type" ON "assignments" ("context_id", "context_type")
3133
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180215214227"]]
3134
+  (0.4ms) COMMIT
3135
+ Migrating to CreateSubmissions (20180216171618)
3136
+  (0.3ms) BEGIN
3137
+  (5.5ms) CREATE TABLE "submissions" ("id" bigserial primary key, "canvas_submission_id" bigint NOT NULL, "canvas_course_id" bigint, "canvas_assignment_id" bigint, "canvas_user_id" bigint, "submitted_at" timestamp, "graded_at" timestamp, "score" integer, "points_possible" integer, "excused" boolean, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3138
+  (2.2ms) CREATE UNIQUE INDEX "index_submissions_on_canvas_submission_id" ON "submissions" ("canvas_submission_id")
3139
+  (2.6ms) CREATE INDEX "index_submissions_on_canvas_assignment_id" ON "submissions" ("canvas_assignment_id")
3140
+  (3.0ms) CREATE INDEX "index_submissions_on_canvas_course_id" ON "submissions" ("canvas_course_id")
3141
+  (2.8ms) CREATE INDEX "index_submissions_on_canvas_user_id" ON "submissions" ("canvas_user_id")
3142
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180216171618"]]
3143
+  (0.4ms) COMMIT
3144
+ Migrating to CreateAccounts (20180220172559)
3145
+  (0.3ms) BEGIN
3146
+  (5.4ms) CREATE TABLE "accounts" ("id" bigserial primary key, "canvas_account_id" bigint NOT NULL, "account_id" character varying, "canvas_parent_id" bigint, "parent_account_id" character varying, "name" character varying, "status" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3147
+  (2.6ms) CREATE UNIQUE INDEX "index_accounts_on_canvas_account_id" ON "accounts" ("canvas_account_id")
3148
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180220172559"]]
3149
+  (0.5ms) COMMIT
3150
+ Migrating to CreateAssignmentGroups (20180222163506)
3151
+  (0.3ms) BEGIN
3152
+  (4.9ms) CREATE TABLE "assignment_groups" ("id" bigserial primary key, "canvas_assignment_group_id" bigint NOT NULL, "canvas_course_id" bigint, "name" character varying, "rules" text, "position" integer, "group_weight" float, "workflow_state" character varying, "canvas_created_at" timestamp, "canvas_updated_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3153
+  (2.3ms) CREATE UNIQUE INDEX "index_assignment_groups_on_canvas_assignment_group_id" ON "assignment_groups" ("canvas_assignment_group_id")
3154
+  (2.1ms) CREATE INDEX "index_assignment_groups_on_canvas_course_id" ON "assignment_groups" ("canvas_course_id")
3155
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180222163506"]]
3156
+  (0.5ms) COMMIT
3157
+ Migrating to CreateContextModules (20180411215348)
3158
+  (0.2ms) BEGIN
3159
+  (5.3ms) CREATE TABLE "context_modules" ("id" bigserial primary key, "canvas_context_module_id" bigint, "canvas_context_id" bigint, "canvas_context_type" character varying, "position" integer, "name" character varying, "workflow_state" character varying, "deleted_at" timestamp, "unlock_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3160
+  (2.1ms) CREATE UNIQUE INDEX "index_context_modules_on_canvas_context_module_id" ON "context_modules" ("canvas_context_module_id")
3161
+  (1.7ms) CREATE INDEX "index_context_modules_on_context" ON "context_modules" ("canvas_context_id", "canvas_context_type")
3162
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215348"]]
3163
+  (0.4ms) COMMIT
3164
+ Migrating to CreateContextModuleItems (20180411215633)
3165
+  (0.3ms) BEGIN
3166
+  (6.8ms) CREATE TABLE "context_module_items" ("id" bigserial primary key, "canvas_context_module_item_id" bigint, "canvas_context_module_id" bigint, "position" integer, "content_type" character varying, "content_id" bigint, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3167
+  (2.2ms) CREATE UNIQUE INDEX "index_context_module_items_on_canvas_context_module_item_id" ON "context_module_items" ("canvas_context_module_item_id")
3168
+  (2.1ms) CREATE INDEX "index_context_module_items_on_canvas_context_module_id" ON "context_module_items" ("canvas_context_module_id")
3169
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215633"]]
3170
+  (0.5ms) COMMIT
3171
+ ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
3172
+  (0.2ms) BEGIN
3173
+ SQL (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-05-02 19:19:44.298446"], ["updated_at", "2018-05-02 19:19:44.298446"]]
3174
+  (6.0ms) COMMIT
3175
+  (0.2ms) SELECT pg_advisory_unlock(1438354376499275445)
3176
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3177
+  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3178
+  (1.3ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
3179
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3180
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
3181
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3182
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]
3183
+  (207.3ms) DROP DATABASE IF EXISTS "canvas_sync_development"
3184
+  (208.9ms) DROP DATABASE IF EXISTS "canvas_sync_test"
3185
+  (16.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)
3186
+  (4.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3187
+  (0.2ms) SELECT pg_try_advisory_lock(1438354376499275445)
3188
+  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
3189
+ Migrating to CreateEnrollments (20170905192509)
3190
+  (0.2ms) BEGIN
3191
+  (20.6ms) CREATE TABLE "enrollments" ("id" bigserial primary key, "canvas_enrollment_id" bigint NOT NULL, "canvas_course_id" bigint, "course_sis_id" character varying, "canvas_user_id" bigint, "user_sis_id" character varying, "role" character varying, "role_id" integer, "canvas_section_id" bigint, "section_sis_id" character varying, "status" character varying, "base_role_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3192
+  (1.6ms) CREATE UNIQUE INDEX "index_enrollments_on_canvas_enrollment_id" ON "enrollments" ("canvas_enrollment_id")
3193
+  (1.5ms) CREATE INDEX "index_enrollments_on_canvas_course_id" ON "enrollments" ("canvas_course_id")
3194
+  (1.5ms) CREATE INDEX "index_enrollments_on_canvas_user_id" ON "enrollments" ("canvas_user_id")
3195
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170905192509"]]
3196
+  (0.5ms) COMMIT
3197
+ Migrating to CreateTerms (20170906193506)
3198
+  (0.2ms) BEGIN
3199
+  (4.8ms) CREATE TABLE "terms" ("id" bigserial primary key, "canvas_term_id" integer NOT NULL, "name" character varying, "start_at" timestamp, "end_at" timestamp, "workflow_state" character varying, "grading_period_group_id" integer, "sis_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3200
+  (1.5ms) CREATE UNIQUE INDEX "index_terms_on_canvas_term_id" ON "terms" ("canvas_term_id")
3201
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170906193506"]]
3202
+  (0.4ms) COMMIT
3203
+ Migrating to CreateCourses (20170914181345)
3204
+  (0.3ms) BEGIN
3205
+  (4.9ms) CREATE TABLE "courses" ("id" bigserial primary key, "canvas_course_id" bigint NOT NULL, "sis_id" character varying, "short_name" character varying, "long_name" character varying, "status" character varying, "canvas_account_id" integer, "canvas_term_id" integer, "term_sis_id" integer, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3206
+  (1.8ms) CREATE UNIQUE INDEX "index_courses_on_canvas_course_id" ON "courses" ("canvas_course_id")
3207
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170914181345"]]
3208
+  (0.4ms) COMMIT
3209
+ Migrating to CreateCanvasSyncJobLog (20170915210836)
3210
+  (6.1ms) BEGIN
3211
+  (23.0ms) CREATE TABLE "canvas_sync_job_logs" ("id" bigserial primary key, "started_at" timestamp, "completed_at" timestamp, "exception" character varying, "backtrace" text, "job_class" character varying, "status" character varying, "metadata" text, "job_arguments" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3212
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170915210836"]]
3213
+  (0.6ms) COMMIT
3214
+ Migrating to CreateUsers (20170918221413)
3215
+  (0.3ms) BEGIN
3216
+  (5.1ms) CREATE TABLE "users" ("id" bigserial primary key, "canvas_user_id" bigint NOT NULL, "sis_id" character varying, "email" character varying, "first_name" character varying, "last_name" character varying, "status" character varying, "login_id" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3217
+  (1.6ms) CREATE UNIQUE INDEX "index_users_on_canvas_user_id" ON "users" ("canvas_user_id")
3218
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20170918221413"]]
3219
+  (0.4ms) COMMIT
3220
+ Migrating to CreateSections (20171107213207)
3221
+  (0.2ms) BEGIN
3222
+  (4.5ms) CREATE TABLE "sections" ("id" bigserial primary key, "canvas_section_id" bigint NOT NULL, "sis_id" character varying, "canvas_course_id" bigint, "canvas_nonxlist_course_id" bigint, "name" character varying, "status" character varying, "start_date" timestamp, "end_date" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3223
+  (1.5ms) CREATE UNIQUE INDEX "index_sections_on_canvas_section_id" ON "sections" ("canvas_section_id")
3224
+  (1.5ms) CREATE INDEX "index_sections_on_canvas_course_id" ON "sections" ("canvas_course_id")
3225
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171107213207"]]
3226
+  (0.5ms) COMMIT
3227
+ Migrating to CreateRoles (20180103162102)
3228
+  (0.2ms) BEGIN
3229
+  (4.4ms) CREATE TABLE "roles" ("id" bigserial primary key, "canvas_role_id" integer NOT NULL, "label" character varying NOT NULL, "base_role_type" character varying NOT NULL, "account" json, "workflow_state" character varying NOT NULL, "permissions" json, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3230
+  (1.4ms) CREATE UNIQUE INDEX "index_roles_on_canvas_role_id" ON "roles" ("canvas_role_id")
3231
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180103162102"]]
3232
+  (0.4ms) COMMIT
3233
+ Migrating to CreateAdmins (20180109210452)
3234
+  (0.2ms) BEGIN
3235
+  (4.5ms) CREATE TABLE "admins" ("id" bigserial primary key, "canvas_admin_id" bigint NOT NULL, "role_name" character varying, "canvas_role_id" bigint NOT NULL, "user_data" json, "canvas_user_id" bigint NOT NULL, "workflow_state" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3236
+  (1.6ms) CREATE UNIQUE INDEX "index_admins_on_canvas_admin_id" ON "admins" ("canvas_admin_id")
3237
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180109210452"]]
3238
+  (0.4ms) COMMIT
3239
+ Migrating to CreateAssignments (20180215214227)
3240
+  (0.2ms) BEGIN
3241
+  (4.6ms) CREATE TABLE "assignments" ("id" bigserial primary key, "canvas_assignment_id" bigint NOT NULL, "title" character varying, "description" text, "due_at" timestamp, "unlock_at" timestamp, "lock_at" timestamp, "points_possible" integer, "min_score" integer, "max_score" integer, "mastery_score" integer, "grading_type" character varying, "submission_types" character varying, "workflow_state" character varying, "context_id" integer, "context_type" character varying, "canvas_assignment_group_id" integer, "grading_scheme_id" integer, "grading_standard_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3242
+  (1.4ms) CREATE UNIQUE INDEX "index_assignments_on_canvas_assignment_id" ON "assignments" ("canvas_assignment_id")
3243
+  (2.0ms) CREATE INDEX "index_assignments_on_context_id_and_context_type" ON "assignments" ("context_id", "context_type")
3244
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180215214227"]]
3245
+  (0.4ms) COMMIT
3246
+ Migrating to CreateSubmissions (20180216171618)
3247
+  (0.2ms) BEGIN
3248
+  (5.3ms) CREATE TABLE "submissions" ("id" bigserial primary key, "canvas_submission_id" bigint NOT NULL, "canvas_course_id" bigint, "canvas_assignment_id" bigint, "canvas_user_id" bigint, "submitted_at" timestamp, "graded_at" timestamp, "score" integer, "points_possible" integer, "excused" boolean, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3249
+  (1.5ms) CREATE UNIQUE INDEX "index_submissions_on_canvas_submission_id" ON "submissions" ("canvas_submission_id")
3250
+  (1.5ms) CREATE INDEX "index_submissions_on_canvas_assignment_id" ON "submissions" ("canvas_assignment_id")
3251
+  (1.4ms) CREATE INDEX "index_submissions_on_canvas_course_id" ON "submissions" ("canvas_course_id")
3252
+  (1.6ms) CREATE INDEX "index_submissions_on_canvas_user_id" ON "submissions" ("canvas_user_id")
3253
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180216171618"]]
3254
+  (0.5ms) COMMIT
3255
+ Migrating to CreateAccounts (20180220172559)
3256
+  (0.2ms) BEGIN
3257
+  (4.6ms) CREATE TABLE "accounts" ("id" bigserial primary key, "canvas_account_id" bigint NOT NULL, "account_id" character varying, "canvas_parent_id" bigint, "parent_account_id" character varying, "name" character varying, "status" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3258
+  (2.6ms) CREATE UNIQUE INDEX "index_accounts_on_canvas_account_id" ON "accounts" ("canvas_account_id")
3259
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180220172559"]]
3260
+  (0.3ms) COMMIT
3261
+ Migrating to CreateAssignmentGroups (20180222163506)
3262
+  (0.7ms) BEGIN
3263
+  (4.5ms) CREATE TABLE "assignment_groups" ("id" bigserial primary key, "canvas_assignment_group_id" bigint NOT NULL, "canvas_course_id" bigint, "name" character varying, "rules" text, "position" integer, "group_weight" float, "workflow_state" character varying, "canvas_created_at" timestamp, "canvas_updated_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3264
+  (1.5ms) CREATE UNIQUE INDEX "index_assignment_groups_on_canvas_assignment_group_id" ON "assignment_groups" ("canvas_assignment_group_id")
3265
+  (1.4ms) CREATE INDEX "index_assignment_groups_on_canvas_course_id" ON "assignment_groups" ("canvas_course_id")
3266
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180222163506"]]
3267
+  (0.4ms) COMMIT
3268
+ Migrating to CreateContextModules (20180411215348)
3269
+  (0.2ms) BEGIN
3270
+  (4.4ms) CREATE TABLE "context_modules" ("id" bigserial primary key, "canvas_context_module_id" bigint, "canvas_context_id" bigint, "canvas_context_type" character varying, "position" integer, "name" character varying, "workflow_state" character varying, "deleted_at" timestamp, "unlock_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3271
+  (1.5ms) CREATE UNIQUE INDEX "index_context_modules_on_canvas_context_module_id" ON "context_modules" ("canvas_context_module_id")
3272
+  (1.5ms) CREATE INDEX "index_context_modules_on_context" ON "context_modules" ("canvas_context_id", "canvas_context_type")
3273
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215348"]]
3274
+  (0.4ms) COMMIT
3275
+ Migrating to CreateContextModuleItems (20180411215633)
3276
+  (0.2ms) BEGIN
3277
+  (4.6ms) CREATE TABLE "context_module_items" ("id" bigserial primary key, "canvas_context_module_item_id" bigint, "canvas_context_module_id" bigint, "position" integer, "content_type" character varying, "content_id" bigint, "workflow_state" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
3278
+  (1.6ms) CREATE UNIQUE INDEX "index_context_module_items_on_canvas_context_module_item_id" ON "context_module_items" ("canvas_context_module_item_id")
3279
+  (1.4ms) CREATE INDEX "index_context_module_items_on_canvas_context_module_id" ON "context_module_items" ("canvas_context_module_id")
3280
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180411215633"]]
3281
+  (0.4ms) COMMIT
3282
+ ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
3283
+  (0.2ms) BEGIN
3284
+ SQL (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-05-02 19:21:57.868306"], ["updated_at", "2018-05-02 19:21:57.868306"]]
3285
+  (0.3ms) COMMIT
3286
+  (0.2ms) SELECT pg_advisory_unlock(1438354376499275445)
3287
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC