openstax_accounts 7.9.0 → 7.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/handlers/openstax/accounts/sessions_callback.rb +1 -0
  3. data/app/models/openstax/accounts/account.rb +3 -3
  4. data/app/representers/openstax/accounts/api/v1/account_representer.rb +6 -0
  5. data/app/representers/openstax/accounts/api/v1/unclaimed_account_representer.rb +6 -0
  6. data/app/routines/openstax/accounts/dev/create_account.rb +2 -1
  7. data/app/routines/openstax/accounts/find_or_create_account.rb +3 -0
  8. data/app/routines/openstax/accounts/sync_accounts.rb +9 -6
  9. data/db/migrate/11_add_support_identifier_to_accounts_accounts.rb +8 -0
  10. data/lib/openstax/accounts/version.rb +1 -1
  11. data/spec/cassettes/OpenStax_Accounts_FindOrCreateAccount/can_create_users.yml +9 -9
  12. data/spec/controllers/openstax/accounts/dev/accounts_controller_spec.rb +1 -1
  13. data/spec/controllers/openstax/accounts/forwards_params_spec.rb +1 -1
  14. data/spec/controllers/openstax/accounts/sessions_controller_spec.rb +1 -1
  15. data/spec/controllers/openstax/accounts/uses_this_engine_controller_spec.rb +1 -1
  16. data/spec/dummy/db/schema.rb +3 -0
  17. data/spec/dummy/log/development.log +560 -0
  18. data/spec/dummy/log/test.log +27696 -0
  19. data/spec/factories/openstax_accounts_account.rb +7 -6
  20. data/spec/handlers/openstax/accounts/accounts_search_spec.rb +1 -1
  21. data/spec/handlers/openstax/accounts/dev/accounts_search_spec.rb +1 -1
  22. data/spec/handlers/openstax/accounts/sessions_callback_spec.rb +27 -7
  23. data/spec/lib/openstax/accounts/api_spec.rb +1 -1
  24. data/spec/lib/openstax/accounts/configuration_spec.rb +1 -1
  25. data/spec/lib/openstax/accounts/current_user_manager_spec.rb +1 -1
  26. data/spec/lib/openstax/accounts/has_many_through_groups/active_record/base_spec.rb +1 -1
  27. data/spec/models/openstax/accounts/account_spec.rb +5 -1
  28. data/spec/models/openstax/accounts/anonymous_account_spec.rb +1 -1
  29. data/spec/models/openstax/accounts/group_spec.rb +1 -1
  30. data/spec/routines/openstax/accounts/create_group_spec.rb +1 -1
  31. data/spec/routines/openstax/accounts/find_or_create_account_spec.rb +18 -8
  32. data/spec/routines/openstax/accounts/search_accounts_spec.rb +1 -1
  33. data/spec/routines/openstax/accounts/sync_accounts_spec.rb +39 -29
  34. data/spec/routines/openstax/accounts/sync_groups_spec.rb +47 -65
  35. data/spec/spec_helper.rb +17 -9
  36. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bef0159179b28deec9d472b9cb27364f042ab36
4
- data.tar.gz: 896f0a36f899d4151cb8c262b59be7e463a726aa
3
+ metadata.gz: 7a3a818263cae68cd11e274bc806919549ed7ff6
4
+ data.tar.gz: f3ee45a3605f0dc205c217362a92b02a6adc56c1
5
5
  SHA512:
6
- metadata.gz: 5e882df36bb92b078455d41fff3b98585f11f9c5a79758f52644be6ca3de0beabd5d00f81f2f0d96f79fce0184c66a9aef617d75bb71d3546d0ce94c6cddad1d
7
- data.tar.gz: c08ecff3ccc0285ee52f4ec1003fd901571c2d1db40a6c3cf70b39908169113af456c55ed4fee971cb269094cd716287a68230a16e19359975084f5d1dc5fca6
6
+ metadata.gz: 03d98354d298471e084f2a4048907e87bb47b4c87326185fd0894879ec2b639558e770597b7596dcf06ec2d71a27274e99be93f3d37e585603f770db0606a9e0
7
+ data.tar.gz: ffa1e8ef58adbea901abb9652474e83811eee1b22304ad31d887227b9b7e843cf3c22075bfea187fbdfe086ab0ff1b6b2c5fd34dbcfc248fc722a850a024edb7
@@ -45,6 +45,7 @@ module OpenStax
45
45
  end
46
46
 
47
47
  account.uuid = raw_info['uuid']
48
+ account.support_identifier = raw_info['support_identifier']
48
49
  end
49
50
  end
50
51
 
@@ -20,8 +20,7 @@ module OpenStax::Accounts
20
20
  inverse_of: :user
21
21
  has_many :groups_as_member, through: :group_members, source: :group
22
22
 
23
- enum faculty_status: [:no_faculty_info, :pending_faculty,
24
- :confirmed_faculty, :rejected_faculty]
23
+ enum faculty_status: [:no_faculty_info, :pending_faculty, :confirmed_faculty, :rejected_faculty]
25
24
 
26
25
  after_initialize :set_default_faculty_status
27
26
  validates :faculty_status, presence: true
@@ -31,7 +30,8 @@ module OpenStax::Accounts
31
30
 
32
31
  validates :openstax_uid, uniqueness: { allow_nil: true }
33
32
  validates :username, uniqueness: { allow_nil: true }
34
- validates :uuid, uniqueness: { allow_nil: true }
33
+ validates :uuid, presence: true, uniqueness: true
34
+ validates :support_identifier, uniqueness: { allow_nil: true }
35
35
 
36
36
  before_update :update_openstax_accounts, if: :should_send_updates_to_accounts?
37
37
 
@@ -84,6 +84,12 @@ module OpenStax
84
84
  description: "The UUID as set by Accounts"
85
85
  }
86
86
 
87
+ property :support_identifier,
88
+ type: String,
89
+ schema_info: {
90
+ description: "The support_identifier as set by Accounts"
91
+ }
92
+
87
93
  end
88
94
  end
89
95
  end
@@ -24,6 +24,12 @@ module OpenStax
24
24
  required: true
25
25
  }
26
26
 
27
+ property :support_identifier,
28
+ type: String,
29
+ schema_info: {
30
+ description: "The unclaimed account's support_identifier"
31
+ }
32
+
27
33
  end
28
34
  end
29
35
  end
@@ -23,8 +23,9 @@ module OpenStax
23
23
  account.openstax_uid = -SecureRandom.hex(4).to_i(16)/2
24
24
  account.access_token = SecureRandom.hex.to_s
25
25
  account.username = username
26
- account.uuid = SecureRandom.uuid
27
26
  account.role = inputs[:role] || :unknown_role
27
+ account.uuid = SecureRandom.uuid
28
+ account.support_identifier = "cs_#{SecureRandom.hex(4)}"
28
29
 
29
30
  account.save
30
31
 
@@ -18,6 +18,7 @@ module OpenStax
18
18
  id = Account.find_by(username: username).try!(:openstax_uid) ||
19
19
  -SecureRandom.hex(4).to_i(16)/2
20
20
  uuid = SecureRandom.uuid
21
+ support_identifier = "cs_#{SecureRandom.hex(4)}"
21
22
  else
22
23
  response = Api.find_or_create_account(
23
24
  email: email, username: username, password: password,
@@ -30,6 +31,7 @@ module OpenStax
30
31
  Api::V1::UnclaimedAccountRepresenter.new(struct).from_json(response.body)
31
32
  id = struct.id
32
33
  uuid = struct.uuid
34
+ support_identifier = struct.support_identifier
33
35
  end
34
36
 
35
37
  account = Account.find_or_initialize_by(openstax_uid: id)
@@ -47,6 +49,7 @@ module OpenStax
47
49
  account.faculty_status = faculty_status || :no_faculty_info
48
50
  account.role = role || :unknown_role
49
51
  account.uuid = uuid
52
+ account.support_identifier = support_identifier
50
53
  account.save!
51
54
  end
52
55
 
@@ -7,8 +7,10 @@ module OpenStax
7
7
 
8
8
  class SyncAccounts
9
9
 
10
- SYNC_ATTRIBUTES = ['username', 'first_name', 'last_name', 'full_name', 'title',
11
- 'faculty_status', 'salesforce_contact_id', 'uuid', 'role']
10
+ SYNC_ATTRIBUTES = [
11
+ 'username', 'first_name', 'last_name', 'full_name', 'title', 'faculty_status',
12
+ 'salesforce_contact_id', 'uuid', 'support_identifier', 'role'
13
+ ]
12
14
 
13
15
  lev_routine transaction: :no_transaction
14
16
 
@@ -29,9 +31,9 @@ module OpenStax
29
31
 
30
32
  updated_app_accounts = []
31
33
  app_accounts.each do |app_account|
32
- account = OpenStax::Accounts::Account.where(
34
+ account = OpenStax::Accounts::Account.find_by(
33
35
  openstax_uid: app_account.account.openstax_uid
34
- ).first || app_account.account
36
+ ) || app_account.account
35
37
  account.syncing = true
36
38
 
37
39
  if account != app_account.account
@@ -42,8 +44,9 @@ module OpenStax
42
44
 
43
45
  next unless account.save
44
46
 
45
- updated_app_accounts << {user_id: account.openstax_uid,
46
- read_updates: app_account.unread_updates}
47
+ updated_app_accounts << {
48
+ user_id: account.openstax_uid, read_updates: app_account.unread_updates
49
+ }
47
50
  end
48
51
 
49
52
  OpenStax::Accounts::Api.mark_account_updates_as_read(updated_app_accounts)
@@ -0,0 +1,8 @@
1
+ class AddSupportIdentifierToAccountsAccounts < ActiveRecord::Migration
2
+ def change
3
+ enable_extension :citext
4
+
5
+ add_column :openstax_accounts_accounts, :support_identifier, :citext
6
+ add_index :openstax_accounts_accounts, :support_identifier, unique: true
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Accounts
3
- VERSION = "7.9.0"
3
+ VERSION = "7.10.0"
4
4
  end
5
5
  end
@@ -47,7 +47,7 @@ http_interactions:
47
47
  body:
48
48
  encoding: UTF-8
49
49
  string: '{"access_token":"c31fe09157c9801c88356a972d0e0c95aa13081cea77ae45f098b5dc7f614642","token_type":"bearer","created_at":1497844427}'
50
- http_version:
50
+ http_version:
51
51
  recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
52
52
  - request:
53
53
  method: post
@@ -97,8 +97,8 @@ http_interactions:
97
97
  - thin
98
98
  body:
99
99
  encoding: UTF-8
100
- string: '{"id":18,"uuid":"8c5c819f-d9d9-46e7-98b9-d737fc0f13fe"}'
101
- http_version:
100
+ string: '{"id":18,"uuid":"8c5c819f-d9d9-46e7-98b9-d737fc0f13fe","support_identifier":"cs_6f3b305b"}'
101
+ http_version:
102
102
  recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
103
103
  - request:
104
104
  method: post
@@ -147,7 +147,7 @@ http_interactions:
147
147
  body:
148
148
  encoding: UTF-8
149
149
  string: '{"access_token":"1c4df98e8f1b07b4dd33aa81150262c829999aaf0564721c423f01c263c2114f","token_type":"bearer","created_at":1497844427}'
150
- http_version:
150
+ http_version:
151
151
  recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
152
152
  - request:
153
153
  method: post
@@ -197,8 +197,8 @@ http_interactions:
197
197
  - thin
198
198
  body:
199
199
  encoding: UTF-8
200
- string: '{"id":19,"uuid":"c1ebaa86-b8ef-4100-9213-a16ca741d47f"}'
201
- http_version:
200
+ string: '{"id":19,"uuid":"c1ebaa86-b8ef-4100-9213-a16ca741d47f","support_identifier":"cs_edc0b069"}'
201
+ http_version:
202
202
  recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
203
203
  - request:
204
204
  method: post
@@ -247,7 +247,7 @@ http_interactions:
247
247
  body:
248
248
  encoding: UTF-8
249
249
  string: '{"access_token":"21bb7c60df067e7354ec7e3b2e83d2d39831aece5938d20e8e68e6ea52ab59ff","token_type":"bearer","created_at":1497844427}'
250
- http_version:
250
+ http_version:
251
251
  recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
252
252
  - request:
253
253
  method: post
@@ -297,7 +297,7 @@ http_interactions:
297
297
  - thin
298
298
  body:
299
299
  encoding: UTF-8
300
- string: '{"id":20,"uuid":"76c36a75-5b5a-4dbd-8800-5c1916c6f1f2"}'
301
- http_version:
300
+ string: '{"id":20,"uuid":"76c36a75-5b5a-4dbd-8800-5c1916c6f1f2","support_identifier":"cs_bccb058a"}'
301
+ http_version:
302
302
  recorded_at: Mon, 19 Jun 2017 03:53:48 GMT
303
303
  recorded_with: VCR 3.0.3
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module OpenStax::Accounts
4
4
  module Dev
5
- describe AccountsController, type: :controller do
5
+ RSpec.describe AccountsController, type: :controller do
6
6
  routes { Engine.routes }
7
7
 
8
8
  let!(:account) { FactoryBot.create :openstax_accounts_account,
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Forwards params", type: :request do
3
+ RSpec.describe "Forwards params", type: :request do
4
4
 
5
5
  class ForwardsParamsController < OpenStax::Accounts::ApplicationController
6
6
  before_filter :set_login_param
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module OpenStax::Accounts
4
- describe SessionsController, type: :controller do
4
+ RSpec.describe SessionsController, type: :controller do
5
5
  routes { Engine.routes }
6
6
 
7
7
  let!(:account) { FactoryBot.create :openstax_accounts_account,
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Controllers that use this engine", type: :controller do
3
+ RSpec.describe "Controllers that use this engine", type: :controller do
4
4
 
5
5
  controller do
6
6
  before_filter :authenticate_user!
@@ -16,6 +16,7 @@ ActiveRecord::Schema.define(version: 1001) do
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
18
18
  enable_extension "pgcrypto"
19
+ enable_extension "citext"
19
20
 
20
21
  create_table "openstax_accounts_accounts", force: :cascade do |t|
21
22
  t.integer "openstax_uid"
@@ -31,6 +32,7 @@ ActiveRecord::Schema.define(version: 1001) do
31
32
  t.string "salesforce_contact_id"
32
33
  t.uuid "uuid", default: "gen_random_uuid()", null: false
33
34
  t.integer "role", default: 0, null: false
35
+ t.citext "support_identifier"
34
36
  end
35
37
 
36
38
  add_index "openstax_accounts_accounts", ["access_token"], name: "index_openstax_accounts_accounts_on_access_token", unique: true, using: :btree
@@ -41,6 +43,7 @@ ActiveRecord::Schema.define(version: 1001) do
41
43
  add_index "openstax_accounts_accounts", ["openstax_uid"], name: "index_openstax_accounts_accounts_on_openstax_uid", unique: true, using: :btree
42
44
  add_index "openstax_accounts_accounts", ["role"], name: "index_openstax_accounts_accounts_on_role", using: :btree
43
45
  add_index "openstax_accounts_accounts", ["salesforce_contact_id"], name: "index_openstax_accounts_accounts_on_salesforce_contact_id", using: :btree
46
+ add_index "openstax_accounts_accounts", ["support_identifier"], name: "index_openstax_accounts_accounts_on_support_identifier", unique: true, using: :btree
44
47
  add_index "openstax_accounts_accounts", ["username"], name: "index_openstax_accounts_accounts_on_username", unique: true, using: :btree
45
48
  add_index "openstax_accounts_accounts", ["uuid"], name: "index_openstax_accounts_accounts_on_uuid", unique: true, using: :btree
46
49
 
@@ -3986,3 +3986,563 @@ WHERE c.contype = 'f'
3986
3986
  ORDER BY c.conname
3987
3987
  
3988
3988
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3989
+  (27.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
3990
+  (13.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3991
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
3992
+ Migrating to CreateOpenStaxAccountsAccounts (0)
3993
+  (0.2ms) BEGIN
3994
+  (17.2ms) CREATE TABLE "openstax_accounts_accounts" ("id" serial primary key, "openstax_uid" integer NOT NULL, "username" character varying NOT NULL, "access_token" character varying, "first_name" character varying, "last_name" character varying, "full_name" character varying, "title" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
3995
+  (5.9ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_openstax_uid" ON "openstax_accounts_accounts" ("openstax_uid")
3996
+  (1.1ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_username" ON "openstax_accounts_accounts" ("username")
3997
+  (0.9ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_access_token" ON "openstax_accounts_accounts" ("access_token")
3998
+  (1.3ms) CREATE INDEX "index_openstax_accounts_accounts_on_first_name" ON "openstax_accounts_accounts" ("first_name")
3999
+  (0.9ms) CREATE INDEX "index_openstax_accounts_accounts_on_last_name" ON "openstax_accounts_accounts" ("last_name")
4000
+  (1.0ms) CREATE INDEX "index_openstax_accounts_accounts_on_full_name" ON "openstax_accounts_accounts" ("full_name")
4001
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "0"]]
4002
+  (0.6ms) COMMIT
4003
+ Migrating to CreateOpenStaxAccountsGroups (1)
4004
+  (0.3ms) BEGIN
4005
+  (3.4ms) CREATE TABLE "openstax_accounts_groups" ("id" serial primary key, "openstax_uid" integer NOT NULL, "is_public" boolean DEFAULT 'f' NOT NULL, "name" character varying, "cached_subtree_group_ids" text, "cached_supertree_group_ids" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4006
+  (1.1ms) CREATE UNIQUE INDEX "index_openstax_accounts_groups_on_openstax_uid" ON "openstax_accounts_groups" ("openstax_uid")
4007
+  (0.9ms) CREATE INDEX "index_openstax_accounts_groups_on_is_public" ON "openstax_accounts_groups" ("is_public")
4008
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1"]]
4009
+  (0.5ms) COMMIT
4010
+ Migrating to CreateOpenStaxAccountsGroupMembers (2)
4011
+  (0.3ms) BEGIN
4012
+  (1.9ms) CREATE TABLE "openstax_accounts_group_members" ("id" serial primary key, "group_id" integer NOT NULL, "user_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4013
+  (1.0ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_members_on_group_id_and_user_id" ON "openstax_accounts_group_members" ("group_id", "user_id")
4014
+  (0.7ms) CREATE INDEX "index_openstax_accounts_group_members_on_user_id" ON "openstax_accounts_group_members" ("user_id")
4015
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "2"]]
4016
+  (0.4ms) COMMIT
4017
+ Migrating to CreateOpenStaxAccountsGroupOwners (3)
4018
+  (0.2ms) BEGIN
4019
+  (1.7ms) CREATE TABLE "openstax_accounts_group_owners" ("id" serial primary key, "group_id" integer NOT NULL, "user_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4020
+  (1.0ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_owners_on_group_id_and_user_id" ON "openstax_accounts_group_owners" ("group_id", "user_id")
4021
+  (0.8ms) CREATE INDEX "index_openstax_accounts_group_owners_on_user_id" ON "openstax_accounts_group_owners" ("user_id")
4022
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "3"]]
4023
+  (0.4ms) COMMIT
4024
+ Migrating to CreateOpenStaxAccountsGroupNestings (4)
4025
+  (0.2ms) BEGIN
4026
+  (1.5ms) CREATE TABLE "openstax_accounts_group_nestings" ("id" serial primary key, "member_group_id" integer NOT NULL, "container_group_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4027
+  (0.7ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_nestings_on_member_group_id" ON "openstax_accounts_group_nestings" ("member_group_id")
4028
+  (0.8ms) CREATE INDEX "index_openstax_accounts_group_nestings_on_container_group_id" ON "openstax_accounts_group_nestings" ("container_group_id")
4029
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "4"]]
4030
+  (0.4ms) COMMIT
4031
+ Migrating to AddFacultyStatusToAccountsAccounts (5)
4032
+  (0.2ms) BEGIN
4033
+  (6.7ms) ALTER TABLE "openstax_accounts_accounts" ADD "faculty_status" integer DEFAULT 0 NOT NULL
4034
+  (0.8ms) CREATE INDEX "index_openstax_accounts_accounts_on_faculty_status" ON "openstax_accounts_accounts" ("faculty_status")
4035
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "5"]]
4036
+  (1.6ms) COMMIT
4037
+ Migrating to AddSalesforceContactIdToAccountsAccounts (6)
4038
+  (0.1ms) BEGIN
4039
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ADD "salesforce_contact_id" character varying
4040
+  (0.8ms) CREATE INDEX "index_openstax_accounts_accounts_on_salesforce_contact_id" ON "openstax_accounts_accounts" ("salesforce_contact_id")
4041
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "6"]]
4042
+  (0.4ms) COMMIT
4043
+ Migrating to ChangeAccountsOpenStaxUidToBeNullable (7)
4044
+  (0.1ms) BEGIN
4045
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "openstax_uid" DROP NOT NULL
4046
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "7"]]
4047
+  (0.3ms) COMMIT
4048
+ Migrating to ChangeAccountsUsernameToBeNullable (8)
4049
+  (0.1ms) BEGIN
4050
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "username" DROP NOT NULL
4051
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "8"]]
4052
+  (0.4ms) COMMIT
4053
+ Migrating to AddUuidAndRoleToAccountsAccounts (9)
4054
+  (0.1ms) BEGIN
4055
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ADD "uuid" character varying
4056
+  (0.9ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_uuid" ON "openstax_accounts_accounts" ("uuid")
4057
+  (8.3ms) ALTER TABLE "openstax_accounts_accounts" ADD "role" integer DEFAULT 0 NOT NULL
4058
+  (0.8ms) CREATE INDEX "index_openstax_accounts_accounts_on_role" ON "openstax_accounts_accounts" ("role")
4059
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "9"]]
4060
+  (1.7ms) COMMIT
4061
+ Migrating to AssignMissingUuidsForLocalAccounts (10)
4062
+  (0.1ms) BEGIN
4063
+ SQL (14.5ms) CREATE EXTENSION IF NOT EXISTS "pgcrypto"
4064
+ SQL (0.7ms) UPDATE "openstax_accounts_accounts" SET "uuid" = gen_random_uuid() WHERE "openstax_accounts_accounts"."uuid" IS NULL
4065
+  (28.4ms) ALTER TABLE "openstax_accounts_accounts" ALTER COLUMN "uuid" TYPE uuid USING uuid::uuid
4066
+  (0.4ms) ALTER TABLE "openstax_accounts_accounts" ALTER COLUMN "uuid" SET DEFAULT gen_random_uuid()
4067
+  (0.6ms) UPDATE "openstax_accounts_accounts" SET "uuid"=gen_random_uuid() WHERE "uuid" IS NULL
4068
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "uuid" SET NOT NULL
4069
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "10"]]
4070
+  (2.5ms) COMMIT
4071
+ Migrating to AddSupportIdentifierToAccountsAccounts (11)
4072
+  (0.2ms) BEGIN
4073
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ADD "support_identifier" character varying
4074
+  (0.8ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_support_identifier" ON "openstax_accounts_accounts" ("support_identifier")
4075
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "11"]]
4076
+  (0.3ms) COMMIT
4077
+ Migrating to CreateUsers (1000)
4078
+  (0.1ms) BEGIN
4079
+  (1.5ms) CREATE TABLE "users" ("id" serial primary key, "account_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
4080
+  (0.7ms) CREATE UNIQUE INDEX "index_users_on_account_id" ON "users" ("account_id")
4081
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1000"]]
4082
+  (0.4ms) COMMIT
4083
+ Migrating to CreateOwnerships (1001)
4084
+  (0.2ms) BEGIN
4085
+  (2.3ms) CREATE TABLE "ownerships" ("id" serial primary key, "owner_id" integer NOT NULL, "owner_type" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4086
+  (0.8ms) CREATE UNIQUE INDEX "index_ownerships_on_owner_id_and_owner_type" ON "ownerships" ("owner_id", "owner_type")
4087
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1001"]]
4088
+  (0.5ms) COMMIT
4089
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
4090
+  (1.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4091
+ FROM pg_constraint c
4092
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4093
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4094
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4095
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4096
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4097
+ WHERE c.contype = 'f'
4098
+ AND t1.relname = 'openstax_accounts_accounts'
4099
+ AND t3.nspname = ANY (current_schemas(false))
4100
+ ORDER BY c.conname
4101
+
4102
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4103
+ FROM pg_constraint c
4104
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4105
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4106
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4107
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4108
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4109
+ WHERE c.contype = 'f'
4110
+ AND t1.relname = 'openstax_accounts_group_members'
4111
+ AND t3.nspname = ANY (current_schemas(false))
4112
+ ORDER BY c.conname
4113
+ 
4114
+  (1.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4115
+ FROM pg_constraint c
4116
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4117
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4118
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4119
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4120
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4121
+ WHERE c.contype = 'f'
4122
+ AND t1.relname = 'openstax_accounts_group_nestings'
4123
+ AND t3.nspname = ANY (current_schemas(false))
4124
+ ORDER BY c.conname
4125
+
4126
+  (2.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4127
+ FROM pg_constraint c
4128
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4129
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4130
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4131
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4132
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4133
+ WHERE c.contype = 'f'
4134
+ AND t1.relname = 'openstax_accounts_group_owners'
4135
+ AND t3.nspname = ANY (current_schemas(false))
4136
+ ORDER BY c.conname
4137
+ 
4138
+  (2.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4139
+ FROM pg_constraint c
4140
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4141
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4142
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4143
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4144
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4145
+ WHERE c.contype = 'f'
4146
+ AND t1.relname = 'openstax_accounts_groups'
4147
+ AND t3.nspname = ANY (current_schemas(false))
4148
+ ORDER BY c.conname
4149
+
4150
+  (2.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4151
+ FROM pg_constraint c
4152
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4153
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4154
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4155
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4156
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4157
+ WHERE c.contype = 'f'
4158
+ AND t1.relname = 'ownerships'
4159
+ AND t3.nspname = ANY (current_schemas(false))
4160
+ ORDER BY c.conname
4161
+ 
4162
+  (1.8ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4163
+ FROM pg_constraint c
4164
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4165
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4166
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4167
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4168
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4169
+ WHERE c.contype = 'f'
4170
+ AND t1.relname = 'users'
4171
+ AND t3.nspname = ANY (current_schemas(false))
4172
+ ORDER BY c.conname
4173
+
4174
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4175
+  (3.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
4176
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4177
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4178
+ Migrating to CreateOpenStaxAccountsAccounts (0)
4179
+  (0.1ms) BEGIN
4180
+  (3.6ms) CREATE TABLE "openstax_accounts_accounts" ("id" serial primary key, "openstax_uid" integer NOT NULL, "username" character varying NOT NULL, "access_token" character varying, "first_name" character varying, "last_name" character varying, "full_name" character varying, "title" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4181
+  (0.8ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_openstax_uid" ON "openstax_accounts_accounts" ("openstax_uid")
4182
+  (0.7ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_username" ON "openstax_accounts_accounts" ("username")
4183
+  (0.7ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_access_token" ON "openstax_accounts_accounts" ("access_token")
4184
+  (0.7ms) CREATE INDEX "index_openstax_accounts_accounts_on_first_name" ON "openstax_accounts_accounts" ("first_name")
4185
+  (0.7ms) CREATE INDEX "index_openstax_accounts_accounts_on_last_name" ON "openstax_accounts_accounts" ("last_name")
4186
+  (0.7ms) CREATE INDEX "index_openstax_accounts_accounts_on_full_name" ON "openstax_accounts_accounts" ("full_name")
4187
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "0"]]
4188
+  (0.6ms) COMMIT
4189
+ Migrating to CreateOpenStaxAccountsGroups (1)
4190
+  (0.2ms) BEGIN
4191
+  (2.7ms) CREATE TABLE "openstax_accounts_groups" ("id" serial primary key, "openstax_uid" integer NOT NULL, "is_public" boolean DEFAULT 'f' NOT NULL, "name" character varying, "cached_subtree_group_ids" text, "cached_supertree_group_ids" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4192
+  (0.7ms) CREATE UNIQUE INDEX "index_openstax_accounts_groups_on_openstax_uid" ON "openstax_accounts_groups" ("openstax_uid")
4193
+  (0.7ms) CREATE INDEX "index_openstax_accounts_groups_on_is_public" ON "openstax_accounts_groups" ("is_public")
4194
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1"]]
4195
+  (0.4ms) COMMIT
4196
+ Migrating to CreateOpenStaxAccountsGroupMembers (2)
4197
+  (0.3ms) BEGIN
4198
+  (2.0ms) CREATE TABLE "openstax_accounts_group_members" ("id" serial primary key, "group_id" integer NOT NULL, "user_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4199
+  (1.0ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_members_on_group_id_and_user_id" ON "openstax_accounts_group_members" ("group_id", "user_id")
4200
+  (0.7ms) CREATE INDEX "index_openstax_accounts_group_members_on_user_id" ON "openstax_accounts_group_members" ("user_id")
4201
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "2"]]
4202
+  (0.3ms) COMMIT
4203
+ Migrating to CreateOpenStaxAccountsGroupOwners (3)
4204
+  (0.2ms) BEGIN
4205
+  (1.9ms) CREATE TABLE "openstax_accounts_group_owners" ("id" serial primary key, "group_id" integer NOT NULL, "user_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4206
+  (0.7ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_owners_on_group_id_and_user_id" ON "openstax_accounts_group_owners" ("group_id", "user_id")
4207
+  (0.7ms) CREATE INDEX "index_openstax_accounts_group_owners_on_user_id" ON "openstax_accounts_group_owners" ("user_id")
4208
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "3"]]
4209
+  (0.4ms) COMMIT
4210
+ Migrating to CreateOpenStaxAccountsGroupNestings (4)
4211
+  (0.2ms) BEGIN
4212
+  (1.5ms) CREATE TABLE "openstax_accounts_group_nestings" ("id" serial primary key, "member_group_id" integer NOT NULL, "container_group_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4213
+  (0.7ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_nestings_on_member_group_id" ON "openstax_accounts_group_nestings" ("member_group_id")
4214
+  (0.7ms) CREATE INDEX "index_openstax_accounts_group_nestings_on_container_group_id" ON "openstax_accounts_group_nestings" ("container_group_id")
4215
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "4"]]
4216
+  (0.4ms) COMMIT
4217
+ Migrating to AddFacultyStatusToAccountsAccounts (5)
4218
+  (0.3ms) BEGIN
4219
+  (5.7ms) ALTER TABLE "openstax_accounts_accounts" ADD "faculty_status" integer DEFAULT 0 NOT NULL
4220
+  (0.8ms) CREATE INDEX "index_openstax_accounts_accounts_on_faculty_status" ON "openstax_accounts_accounts" ("faculty_status")
4221
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "5"]]
4222
+  (1.6ms) COMMIT
4223
+ Migrating to AddSalesforceContactIdToAccountsAccounts (6)
4224
+  (0.1ms) BEGIN
4225
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ADD "salesforce_contact_id" character varying
4226
+  (1.1ms) CREATE INDEX "index_openstax_accounts_accounts_on_salesforce_contact_id" ON "openstax_accounts_accounts" ("salesforce_contact_id")
4227
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "6"]]
4228
+  (0.3ms) COMMIT
4229
+ Migrating to ChangeAccountsOpenStaxUidToBeNullable (7)
4230
+  (0.1ms) BEGIN
4231
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "openstax_uid" DROP NOT NULL
4232
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "7"]]
4233
+  (0.3ms) COMMIT
4234
+ Migrating to ChangeAccountsUsernameToBeNullable (8)
4235
+  (0.1ms) BEGIN
4236
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "username" DROP NOT NULL
4237
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "8"]]
4238
+  (0.3ms) COMMIT
4239
+ Migrating to AddUuidAndRoleToAccountsAccounts (9)
4240
+  (0.1ms) BEGIN
4241
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ADD "uuid" character varying
4242
+  (0.6ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_uuid" ON "openstax_accounts_accounts" ("uuid")
4243
+  (6.3ms) ALTER TABLE "openstax_accounts_accounts" ADD "role" integer DEFAULT 0 NOT NULL
4244
+  (1.2ms) CREATE INDEX "index_openstax_accounts_accounts_on_role" ON "openstax_accounts_accounts" ("role")
4245
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "9"]]
4246
+  (1.8ms) COMMIT
4247
+ Migrating to AssignMissingUuidsForLocalAccounts (10)
4248
+  (0.1ms) BEGIN
4249
+ SQL (5.0ms) CREATE EXTENSION IF NOT EXISTS "pgcrypto"
4250
+ SQL (0.7ms) UPDATE "openstax_accounts_accounts" SET "uuid" = gen_random_uuid() WHERE "openstax_accounts_accounts"."uuid" IS NULL
4251
+  (8.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER COLUMN "uuid" TYPE uuid USING uuid::uuid
4252
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ALTER COLUMN "uuid" SET DEFAULT gen_random_uuid()
4253
+  (0.7ms) UPDATE "openstax_accounts_accounts" SET "uuid"=gen_random_uuid() WHERE "uuid" IS NULL
4254
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "uuid" SET NOT NULL
4255
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "10"]]
4256
+  (2.3ms) COMMIT
4257
+ Migrating to AddSupportIdentifierToAccountsAccounts (11)
4258
+  (0.2ms) BEGIN
4259
+ SQL (14.5ms) CREATE EXTENSION IF NOT EXISTS "citext"
4260
+  (0.4ms) ALTER TABLE "openstax_accounts_accounts" ADD "support_identifier" citext
4261
+  (1.3ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_support_identifier" ON "openstax_accounts_accounts" ("support_identifier")
4262
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "11"]]
4263
+  (0.9ms) COMMIT
4264
+ Migrating to CreateUsers (1000)
4265
+  (0.1ms) BEGIN
4266
+  (1.7ms) CREATE TABLE "users" ("id" serial primary key, "account_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4267
+  (0.7ms) CREATE UNIQUE INDEX "index_users_on_account_id" ON "users" ("account_id")
4268
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1000"]]
4269
+  (0.4ms) COMMIT
4270
+ Migrating to CreateOwnerships (1001)
4271
+  (0.2ms) BEGIN
4272
+  (2.4ms) CREATE TABLE "ownerships" ("id" serial primary key, "owner_id" integer NOT NULL, "owner_type" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
4273
+  (0.7ms) CREATE UNIQUE INDEX "index_ownerships_on_owner_id_and_owner_type" ON "ownerships" ("owner_id", "owner_type")
4274
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1001"]]
4275
+  (0.5ms) COMMIT
4276
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4277
+  (1.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4278
+ FROM pg_constraint c
4279
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4280
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4281
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4282
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4283
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4284
+ WHERE c.contype = 'f'
4285
+ AND t1.relname = 'openstax_accounts_accounts'
4286
+ AND t3.nspname = ANY (current_schemas(false))
4287
+ ORDER BY c.conname
4288
+ 
4289
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4290
+ FROM pg_constraint c
4291
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4292
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4293
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4294
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4295
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4296
+ WHERE c.contype = 'f'
4297
+ AND t1.relname = 'openstax_accounts_group_members'
4298
+ AND t3.nspname = ANY (current_schemas(false))
4299
+ ORDER BY c.conname
4300
+
4301
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4302
+ FROM pg_constraint c
4303
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4304
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4305
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4306
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4307
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4308
+ WHERE c.contype = 'f'
4309
+ AND t1.relname = 'openstax_accounts_group_nestings'
4310
+ AND t3.nspname = ANY (current_schemas(false))
4311
+ ORDER BY c.conname
4312
+ 
4313
+  (1.6ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4314
+ FROM pg_constraint c
4315
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4316
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4317
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4318
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4319
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4320
+ WHERE c.contype = 'f'
4321
+ AND t1.relname = 'openstax_accounts_group_owners'
4322
+ AND t3.nspname = ANY (current_schemas(false))
4323
+ ORDER BY c.conname
4324
+
4325
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4326
+ FROM pg_constraint c
4327
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4328
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4329
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4330
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4331
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4332
+ WHERE c.contype = 'f'
4333
+ AND t1.relname = 'openstax_accounts_groups'
4334
+ AND t3.nspname = ANY (current_schemas(false))
4335
+ ORDER BY c.conname
4336
+ 
4337
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4338
+ FROM pg_constraint c
4339
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4340
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4341
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4342
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4343
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4344
+ WHERE c.contype = 'f'
4345
+ AND t1.relname = 'ownerships'
4346
+ AND t3.nspname = ANY (current_schemas(false))
4347
+ ORDER BY c.conname
4348
+
4349
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4350
+ FROM pg_constraint c
4351
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4352
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4353
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4354
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4355
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4356
+ WHERE c.contype = 'f'
4357
+ AND t1.relname = 'users'
4358
+ AND t3.nspname = ANY (current_schemas(false))
4359
+ ORDER BY c.conname
4360
+ 
4361
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4362
+  (26.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
4363
+  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4364
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
4365
+ Migrating to CreateOpenStaxAccountsAccounts (0)
4366
+  (0.2ms) BEGIN
4367
+  (16.4ms) CREATE TABLE "openstax_accounts_accounts" ("id" serial primary key, "openstax_uid" integer NOT NULL, "username" character varying NOT NULL, "access_token" character varying, "first_name" character varying, "last_name" character varying, "full_name" character varying, "title" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4368
+  (8.9ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_openstax_uid" ON "openstax_accounts_accounts" ("openstax_uid")
4369
+  (1.1ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_username" ON "openstax_accounts_accounts" ("username")
4370
+  (1.2ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_access_token" ON "openstax_accounts_accounts" ("access_token")
4371
+  (1.0ms) CREATE INDEX "index_openstax_accounts_accounts_on_first_name" ON "openstax_accounts_accounts" ("first_name")
4372
+  (1.4ms) CREATE INDEX "index_openstax_accounts_accounts_on_last_name" ON "openstax_accounts_accounts" ("last_name")
4373
+  (0.7ms) CREATE INDEX "index_openstax_accounts_accounts_on_full_name" ON "openstax_accounts_accounts" ("full_name")
4374
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "0"]]
4375
+  (0.4ms) COMMIT
4376
+ Migrating to CreateOpenStaxAccountsGroups (1)
4377
+  (5.5ms) BEGIN
4378
+  (15.6ms) CREATE TABLE "openstax_accounts_groups" ("id" serial primary key, "openstax_uid" integer NOT NULL, "is_public" boolean DEFAULT 'f' NOT NULL, "name" character varying, "cached_subtree_group_ids" text, "cached_supertree_group_ids" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4379
+  (1.0ms) CREATE UNIQUE INDEX "index_openstax_accounts_groups_on_openstax_uid" ON "openstax_accounts_groups" ("openstax_uid")
4380
+  (1.1ms) CREATE INDEX "index_openstax_accounts_groups_on_is_public" ON "openstax_accounts_groups" ("is_public")
4381
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1"]]
4382
+  (0.4ms) COMMIT
4383
+ Migrating to CreateOpenStaxAccountsGroupMembers (2)
4384
+  (6.2ms) BEGIN
4385
+  (9.0ms) CREATE TABLE "openstax_accounts_group_members" ("id" serial primary key, "group_id" integer NOT NULL, "user_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4386
+  (7.3ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_members_on_group_id_and_user_id" ON "openstax_accounts_group_members" ("group_id", "user_id")
4387
+  (1.2ms) CREATE INDEX "index_openstax_accounts_group_members_on_user_id" ON "openstax_accounts_group_members" ("user_id")
4388
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "2"]]
4389
+  (0.5ms) COMMIT
4390
+ Migrating to CreateOpenStaxAccountsGroupOwners (3)
4391
+  (6.4ms) BEGIN
4392
+  (8.2ms) CREATE TABLE "openstax_accounts_group_owners" ("id" serial primary key, "group_id" integer NOT NULL, "user_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4393
+  (7.0ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_owners_on_group_id_and_user_id" ON "openstax_accounts_group_owners" ("group_id", "user_id")
4394
+  (1.1ms) CREATE INDEX "index_openstax_accounts_group_owners_on_user_id" ON "openstax_accounts_group_owners" ("user_id")
4395
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "3"]]
4396
+  (0.6ms) COMMIT
4397
+ Migrating to CreateOpenStaxAccountsGroupNestings (4)
4398
+  (6.0ms) BEGIN
4399
+  (7.8ms) CREATE TABLE "openstax_accounts_group_nestings" ("id" serial primary key, "member_group_id" integer NOT NULL, "container_group_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4400
+  (6.1ms) CREATE UNIQUE INDEX "index_openstax_accounts_group_nestings_on_member_group_id" ON "openstax_accounts_group_nestings" ("member_group_id")
4401
+  (0.9ms) CREATE INDEX "index_openstax_accounts_group_nestings_on_container_group_id" ON "openstax_accounts_group_nestings" ("container_group_id")
4402
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "4"]]
4403
+  (0.7ms) COMMIT
4404
+ Migrating to AddFacultyStatusToAccountsAccounts (5)
4405
+  (5.5ms) BEGIN
4406
+  (26.5ms) ALTER TABLE "openstax_accounts_accounts" ADD "faculty_status" integer DEFAULT 0 NOT NULL
4407
+  (1.0ms) CREATE INDEX "index_openstax_accounts_accounts_on_faculty_status" ON "openstax_accounts_accounts" ("faculty_status")
4408
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "5"]]
4409
+  (1.8ms) COMMIT
4410
+ Migrating to AddSalesforceContactIdToAccountsAccounts (6)
4411
+  (0.1ms) BEGIN
4412
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ADD "salesforce_contact_id" character varying
4413
+  (6.6ms) CREATE INDEX "index_openstax_accounts_accounts_on_salesforce_contact_id" ON "openstax_accounts_accounts" ("salesforce_contact_id")
4414
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "6"]]
4415
+  (6.3ms) COMMIT
4416
+ Migrating to ChangeAccountsOpenStaxUidToBeNullable (7)
4417
+  (0.2ms) BEGIN
4418
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ALTER "openstax_uid" DROP NOT NULL
4419
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "7"]]
4420
+  (6.3ms) COMMIT
4421
+ Migrating to ChangeAccountsUsernameToBeNullable (8)
4422
+  (0.2ms) BEGIN
4423
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ALTER "username" DROP NOT NULL
4424
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "8"]]
4425
+  (6.4ms) COMMIT
4426
+ Migrating to AddUuidAndRoleToAccountsAccounts (9)
4427
+  (0.4ms) BEGIN
4428
+  (0.4ms) ALTER TABLE "openstax_accounts_accounts" ADD "uuid" character varying
4429
+  (7.2ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_uuid" ON "openstax_accounts_accounts" ("uuid")
4430
+  (22.2ms) ALTER TABLE "openstax_accounts_accounts" ADD "role" integer DEFAULT 0 NOT NULL
4431
+  (1.1ms) CREATE INDEX "index_openstax_accounts_accounts_on_role" ON "openstax_accounts_accounts" ("role")
4432
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "9"]]
4433
+  (2.0ms) COMMIT
4434
+ Migrating to AssignMissingUuidsForLocalAccounts (10)
4435
+  (0.1ms) BEGIN
4436
+ SQL (38.7ms) CREATE EXTENSION IF NOT EXISTS "pgcrypto"
4437
+ SQL (1.2ms) UPDATE "openstax_accounts_accounts" SET "uuid" = gen_random_uuid() WHERE "openstax_accounts_accounts"."uuid" IS NULL
4438
+  (28.8ms) ALTER TABLE "openstax_accounts_accounts" ALTER COLUMN "uuid" TYPE uuid USING uuid::uuid
4439
+  (0.4ms) ALTER TABLE "openstax_accounts_accounts" ALTER COLUMN "uuid" SET DEFAULT gen_random_uuid()
4440
+  (0.5ms) UPDATE "openstax_accounts_accounts" SET "uuid"=gen_random_uuid() WHERE "uuid" IS NULL
4441
+  (0.2ms) ALTER TABLE "openstax_accounts_accounts" ALTER "uuid" SET NOT NULL
4442
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "10"]]
4443
+  (3.2ms) COMMIT
4444
+ Migrating to AddSupportIdentifierToAccountsAccounts (11)
4445
+  (0.2ms) BEGIN
4446
+ SQL (14.7ms) CREATE EXTENSION IF NOT EXISTS "citext"
4447
+  (0.3ms) ALTER TABLE "openstax_accounts_accounts" ADD "support_identifier" citext
4448
+  (1.5ms) CREATE UNIQUE INDEX "index_openstax_accounts_accounts_on_support_identifier" ON "openstax_accounts_accounts" ("support_identifier")
4449
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "11"]]
4450
+  (1.1ms) COMMIT
4451
+ Migrating to CreateUsers (1000)
4452
+  (0.2ms) BEGIN
4453
+  (7.5ms) CREATE TABLE "users" ("id" serial primary key, "account_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4454
+  (6.8ms) CREATE UNIQUE INDEX "index_users_on_account_id" ON "users" ("account_id")
4455
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1000"]]
4456
+  (6.0ms) COMMIT
4457
+ Migrating to CreateOwnerships (1001)
4458
+  (6.3ms) BEGIN
4459
+  (15.5ms) CREATE TABLE "ownerships" ("id" serial primary key, "owner_id" integer NOT NULL, "owner_type" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
4460
+  (1.1ms) CREATE UNIQUE INDEX "index_ownerships_on_owner_id_and_owner_type" ON "ownerships" ("owner_id", "owner_type")
4461
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "1001"]]
4462
+  (0.6ms) COMMIT
4463
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4464
+  (1.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4465
+ FROM pg_constraint c
4466
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4467
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4468
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4469
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4470
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4471
+ WHERE c.contype = 'f'
4472
+ AND t1.relname = 'openstax_accounts_accounts'
4473
+ AND t3.nspname = ANY (current_schemas(false))
4474
+ ORDER BY c.conname
4475
+ 
4476
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4477
+ FROM pg_constraint c
4478
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4479
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4480
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4481
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4482
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4483
+ WHERE c.contype = 'f'
4484
+ AND t1.relname = 'openstax_accounts_group_members'
4485
+ AND t3.nspname = ANY (current_schemas(false))
4486
+ ORDER BY c.conname
4487
+
4488
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4489
+ FROM pg_constraint c
4490
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4491
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4492
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4493
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4494
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4495
+ WHERE c.contype = 'f'
4496
+ AND t1.relname = 'openstax_accounts_group_nestings'
4497
+ AND t3.nspname = ANY (current_schemas(false))
4498
+ ORDER BY c.conname
4499
+ 
4500
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4501
+ FROM pg_constraint c
4502
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4503
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4504
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4505
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4506
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4507
+ WHERE c.contype = 'f'
4508
+ AND t1.relname = 'openstax_accounts_group_owners'
4509
+ AND t3.nspname = ANY (current_schemas(false))
4510
+ ORDER BY c.conname
4511
+
4512
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4513
+ FROM pg_constraint c
4514
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4515
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4516
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4517
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4518
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4519
+ WHERE c.contype = 'f'
4520
+ AND t1.relname = 'openstax_accounts_groups'
4521
+ AND t3.nspname = ANY (current_schemas(false))
4522
+ ORDER BY c.conname
4523
+ 
4524
+  (1.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4525
+ FROM pg_constraint c
4526
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4527
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4528
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4529
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4530
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4531
+ WHERE c.contype = 'f'
4532
+ AND t1.relname = 'ownerships'
4533
+ AND t3.nspname = ANY (current_schemas(false))
4534
+ ORDER BY c.conname
4535
+
4536
+  (1.7ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
4537
+ FROM pg_constraint c
4538
+ JOIN pg_class t1 ON c.conrelid = t1.oid
4539
+ JOIN pg_class t2 ON c.confrelid = t2.oid
4540
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
4541
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
4542
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
4543
+ WHERE c.contype = 'f'
4544
+ AND t1.relname = 'users'
4545
+ AND t3.nspname = ANY (current_schemas(false))
4546
+ ORDER BY c.conname
4547
+ 
4548
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"